Tobias Gritschacher has uploaded a new change for review. https://gerrit.wikimedia.org/r/53382
Change subject: (testing) selenium tests for multiline references (DNM) ...................................................................... (testing) selenium tests for multiline references (DNM) - first step: checking button behavior still ongoing work, so DO NOT MERGE Change-Id: Id55e2f723bfae2b620b3e3b0e95ce51abd700d17 --- M repo/tests/selenium/statements/references_spec.rb M selenium/lib/modules/reference_module.rb 2 files changed, 79 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/82/53382/1 diff --git a/repo/tests/selenium/statements/references_spec.rb b/repo/tests/selenium/statements/references_spec.rb index ab07bef..4bd09a2 100644 --- a/repo/tests/selenium/statements/references_spec.rb +++ b/repo/tests/selenium/statements/references_spec.rb @@ -39,6 +39,8 @@ cm_statement_value = "Louisiana 462.svg" cm_reference_value = "Lousiana Red Kammgarn.jpg" cm_reference_value_changed = "Denkmal.png" +# TODO: silly workaround; the tooltip should really not hide any UI elements! +set_copyright_ack_cookie = "$.cookie( 'wikibase.acknowledgedentitycopyright', 'By clicking \"save\", you agree to the terms of use, and you irrevocably agree to release your contribution under the [ ].', { 'expires': null, 'path': '/' } );" describe "Check references UI" do before :all do @@ -56,6 +58,8 @@ end end on_page(ItemPage) do |page| + # TODO: silly workaround; see other TODO above; + @browser.execute_script(set_copyright_ack_cookie) page.navigate_to items[0]["url"] page.wait_for_entity_to_load page.add_statement(properties_cm[0]["label"], cm_statement_value) @@ -69,43 +73,105 @@ page.wait_for_entity_to_load page.referenceContainer?.should be_true page.referenceHeading?.should be_true + page.referenceEditHeading?.should be_false page.addReferenceToFirstClaim?.should be_true + page.addReferenceToFirstClaim + page.referenceEditHeading?.should be_true page.addReferenceToFirstClaim?.should be_false page.saveReference?.should be_false page.removeReference?.should be_false page.cancelReference?.should be_true + page.addReferenceLine?.should be_false + page.entitySelectorInput?.should be_true + page.removeReferenceLine1?.should be_true + page.removeReferenceLine1 + page.removeReferenceLine1?.should be_false + page.entitySelectorInput?.should be_false + # TODO: bug -> add should be true in that case + #page.addReferenceLine?.should be_true page.cancelReference + page.addReferenceToFirstClaim + # TODO end + page.referenceEditHeading?.should be_true + page.addReferenceToFirstClaim?.should be_false + page.saveReference?.should be_false + page.removeReference?.should be_false + page.cancelReference?.should be_true + page.addReferenceLine?.should be_false + page.entitySelectorInput?.should be_true + page.removeReferenceLine1?.should be_true + page.cancelReference + page.addReferenceToFirstClaim?.should be_true page.saveReference?.should be_false page.removeReference?.should be_false page.cancelReference?.should be_false + page.addReferenceLine?.should be_false + page.removeReferenceLine1?.should be_false + page.entitySelectorInput?.should be_false page.addReferenceToFirstClaim page.saveReference?.should be_false page.entitySelectorInput = generate_random_string(10) page.saveReference?.should be_false + page.referenceValueInput?.should be_false + page.addReferenceLine?.should be_false + page.removeReferenceLine1?.should be_true + page.entitySelectorInput_element.clear page.entitySelectorInput = properties_cm[1]["label"] ajax_wait page.wait_for_reference_value_box - page.referenceValueInput.should be_true + page.referenceValueInput?.should be_true page.saveReference?.should be_false page.cancelReference?.should be_true page.removeReference?.should be_false - page.referenceValueInput = generate_random_string(10) + page.addReferenceLine?.should be_false + page.removeReferenceLine1?.should be_true + random_ref_value = generate_random_string(10) + page.referenceValueInput = random_ref_value page.saveReference?.should be_true page.cancelReference?.should be_true + page.addReferenceLine?.should be_true + page.removeReferenceLine1?.should be_true + page.addReferenceLine + page.removeReferenceLine1?.should be_true + page.removeReferenceLine2?.should be_true + page.addReferenceLine?.should be_false + page.removeReferenceLine2 + page.removeReferenceLine1?.should be_true + page.removeReferenceLine2?.should be_false + page.addReferenceLine?.should be_true + page.entitySelectorInput?.should be_true + page.referenceValueInput?.should be_true + page.entitySelectorInput.should == properties_cm[1]["label"] + page.referenceValueInput.should == random_ref_value + page.entitySelectorInput_element.clear page.entitySelectorInput = " " # TODO: this will fail because of bug 44543 - # page.saveReference?.should be_false + #page.saveReference?.should be_false + #page.addReferenceLine?.should be_false page.referenceValueInput?.should be_false page.entitySelectorInput = properties_cm[1]["label"] ajax_wait page.wait_for_reference_value_box + page.referenceValueInput_element.clear page.referenceValueInput = generate_random_string(10) page.saveReference?.should be_true page.cancelReference?.should be_true + + page.addReferenceLine + page.addReferenceLine?.should be_false + page.removeReferenceLine1?.should be_true + page.removeReferenceLine2?.should be_true + page.removeReferenceLine1 + page.removeReferenceLine1?.should be_true + page.removeReferenceLine2?.should be_false + page.entitySelectorInput.should == '' + page.referenceValueInput?.should be_false + page.addReferenceLine?.should be_false + page.cancelReference?.should be_true page.cancelReference end end diff --git a/selenium/lib/modules/reference_module.rb b/selenium/lib/modules/reference_module.rb index 3ed9d39..8e72f74 100644 --- a/selenium/lib/modules/reference_module.rb +++ b/selenium/lib/modules/reference_module.rb @@ -12,6 +12,7 @@ div(:referenceContainer, :class => "wb-statement-references-container") div(:referenceHeading, :class => "wb-statement-references-heading") link(:referenceHeadingToggleLink, :css => ".wb-statement-references-heading a") + div(:referenceEditHeading, :xpath => "//div[contains(@class, 'wb-referenceview')]/div[contains(@class, 'wb-snaklistview-heading')]") div(:referenceListItems, :xpath => "//div[contains(@class, 'wb-statement-references')]/div[contains(@class, 'wb-listview')]") div(:reference1Property, :xpath => "//div[contains(@class, 'wb-referenceview')][1]/div[contains(@class, 'wb-listview')]/div[contains(@class, 'wb-snakview')]/div[contains(@class, 'wb-snak-property-container')]/div") div(:reference2Property, :xpath => "//div[contains(@class, 'wb-referenceview')][2]/div[contains(@class, 'wb-listview')]/div[contains(@class, 'wb-snakview')]/div[contains(@class, 'wb-snak-property-container')]/div") @@ -22,9 +23,15 @@ div(:reference3Value, :xpath => "//div[contains(@class, 'wb-referenceview')][3]/div[contains(@class, 'wb-listview')]/div[contains(@class, 'wb-snakview')]/div[contains(@class, 'wb-snak-value-container')]/div[contains(@class, 'wb-snak-value')]/div/div") link(:reference1ValueLink, :xpath => "//div[contains(@class, 'wb-referenceview')][1]/div[contains(@class, 'wb-listview')]/div[contains(@class, 'wb-snakview')]/div[contains(@class, 'wb-snak-value-container')]/div[contains(@class, 'wb-snak-value')]/div/div/a") text_area(:referenceValueInput, :xpath => "//div[contains(@class, 'valueview-ineditmode')]/div/a/textarea[contains(@class, 'valueview-input')]") - link(:saveReference, :xpath => "//div[contains(@class, 'wb-snaklistview-toolbar')]/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='save']") - link(:cancelReference, :xpath => "//div[contains(@class, 'wb-snaklistview-toolbar')]/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='cancel']") - link(:removeReference, :xpath => "//div[contains(@class, 'wb-snaklistview-toolbar')]/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='remove']") + #link(:saveReference, :xpath => "//div[contains(@class, 'wb-snaklistview-toolbar')]/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='save']") + #link(:cancelReference, :xpath => "//div[contains(@class, 'wb-snaklistview-toolbar')]/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='cancel']") + #link(:removeReference, :xpath => "//div[contains(@class, 'wb-snaklistview-toolbar')]/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='remove']") + link(:saveReference, :xpath => "//div[contains(@class, 'wb-referenceview')]/div[contains(@class, 'wb-snaklistview-heading')]/div/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='save']") + link(:cancelReference, :xpath => "//div[contains(@class, 'wb-referenceview')]/div[contains(@class, 'wb-snaklistview-heading')]/div/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='cancel']") + link(:removeReference, :xpath => "//div[contains(@class, 'wb-referenceview')]/div[contains(@class, 'wb-snaklistview-heading')]/div/span/span/span[contains(@class, 'wb-ui-toolbar-editgroup-ineditmode')]/span/a[text()='remove']") + link(:removeReferenceLine1, :xpath => "//div[contains(@class, 'wb-referenceview')]/div[contains(@class, 'wb-snaklistview-listview')]/div[contains(@class, 'wb-snakview')][1]/span/div/span/span/a[text()='remove']") + link(:removeReferenceLine2, :xpath => "//div[contains(@class, 'wb-referenceview')]/div[contains(@class, 'wb-snaklistview-listview')]/div[contains(@class, 'wb-snakview')][2]/span/div/span/span/a[text()='remove']") + link(:addReferenceLine, :xpath => "//div[contains(@class, 'wb-referenceview')]/span[contains(@class, 'wb-ui-toolbar')]/div/span/span/a[text()='add']") link(:addReferenceToFirstClaim, :xpath => "//div[contains(@class, 'wb-statement-references-container')][1]/div[contains(@class, 'wb-statement-references')]/span[contains(@class, 'wb-ui-toolbar')]/div/span/span/a") link(:editReference1, :xpath => "//div[contains(@class, 'wb-referenceview')][1]/div[contains(@class, 'wb-snaklistview-heading')]/div[contains(@class, 'wb-snaklistview-toolbar')]/span/span/span/span/a[text()='edit']") -- To view, visit https://gerrit.wikimedia.org/r/53382 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id55e2f723bfae2b620b3e3b0e95ce51abd700d17 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits