Henning Snater has submitted this change and it was merged. Change subject: Selenium tests for deleted-item handling in statements UI ......................................................................
Selenium tests for deleted-item handling in statements UI Bug: 48135 Change-Id: Ib4500685810ef493c02e1559b9e259f2198e223d --- A repo/tests/selenium/statements/statements_deleted_item_spec.rb M selenium/Rakefile M selenium/lib/modules/statement_module.rb 3 files changed, 92 insertions(+), 1 deletion(-) Approvals: Henning Snater: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/repo/tests/selenium/statements/statements_deleted_item_spec.rb b/repo/tests/selenium/statements/statements_deleted_item_spec.rb new file mode 100644 index 0000000..3cfaa1d --- /dev/null +++ b/repo/tests/selenium/statements/statements_deleted_item_spec.rb @@ -0,0 +1,85 @@ +# -*- encoding : utf-8 -*- +# Wikidata UI tests +# +# Author:: Tobias Gritschacher ([email protected]) +# License:: GNU GPL v2+ +# +# tests for statements with deleted items + +require 'spec_helper' + +num_items = 2 +num_props_item = 1 + +# items +count = 0 +items = Array.new +while count < num_items do + items.push({"label"=>generate_random_string(10), "description"=>generate_random_string(20)}) + count = count + 1 +end + +# item properties +count = 0 +properties_item = Array.new +while count < num_props_item do + properties_item.push({"label"=>generate_random_string(10), "description"=>generate_random_string(20), "datatype"=>"Item"}) + count = count + 1 +end + +describe "Check deleted item in statements UI" do + before :all do + # set up: create items & properties, add statements, delete item + items.each do |item| + visit_page(CreateItemPage) do |page| + item['id'] = page.create_new_item(item['label'], item['description']) + item['url'] = page.current_url + end + end + properties_item.each do |property| + visit_page(NewPropertyPage) do |page| + property['id'] = page.create_new_property(property['label'], property['description'], property['datatype']) + property['url'] = page.current_url + end + end + on_page(ItemPage) do |page| + page.navigate_to items[0]["url"] + page.wait_for_entity_to_load + page.add_statement(properties_item[0]["label"], items[1]["label"]) + page.add_reference_to_first_claim(properties_item[0]["label"], items[1]["label"]) + end + visit_page(RepoLoginPage) do |page| + page.login_with(WIKI_ADMIN_USERNAME, WIKI_ADMIN_PASSWORD) + end + visit_page(DeleteEntityPage) do |page| + page.delete_entity(items[1]["url"]) + end + end + + context "Check statements UI with deleted item" do + it "should check correct UI behavior on deleted item" do + on_page(ItemPage) do |page| + page.navigate_to items[0]["url"] + page.wait_for_entity_to_load + page.statement1ClaimValue1Nolink.should_not == items[1]["label"] + page.statement1ClaimValue1Nolink.include?(items[1]["id"]).should be_true + page.statement1ClaimValue1Nolink.include?("Deleted item").should be_true + + page.toggle_reference_section + page.reference1Value.should_not == items[1]["label"] + page.reference1Value.include?(items[1]["id"]).should be_true + page.reference1Value.include?("Deleted item").should be_true + page.reference1ValueLink?.should be_false + page.editReference1 + page.referenceValueInput.should == "" + end + end + end + + after :all do + # tear down: logout + visit_page(RepoLoginPage) do |page| + page.logout_user + end + end +end diff --git a/selenium/Rakefile b/selenium/Rakefile index 73f4384..0d1dd1c 100644 --- a/selenium/Rakefile +++ b/selenium/Rakefile @@ -220,7 +220,7 @@ RSpec::Core::RakeTask.new(:statements) do |spec| spec.ruby_opts = "-I lib:spec" - spec.pattern = '../repo/tests/selenium/statements/{statements_spec.rb,statements_cm_spec.rb,statements_item_spec.rb,statements_string_spec.rb,references_spec.rb,qualifiers_spec.rb,statements_deleted_prop_spec.rb}' + spec.pattern = '../repo/tests/selenium/statements/{statements_spec.rb,statements_cm_spec.rb,statements_item_spec.rb,statements_string_spec.rb,references_spec.rb,qualifiers_spec.rb,statements_deleted_prop_spec.rb,statements_deleted_item_spec.rb}' end RSpec::Core::RakeTask.new(:statements_basic) do |spec| @@ -253,6 +253,11 @@ spec.pattern = '../repo/tests/selenium/statements/statements_deleted_prop_spec.rb' end +RSpec::Core::RakeTask.new(:statements_deleted_item) do |spec| + spec.ruby_opts = "-I lib:spec" + spec.pattern = '../repo/tests/selenium/statements/statements_deleted_item_spec.rb' +end + RSpec::Core::RakeTask.new(:references) do |spec| spec.ruby_opts = "-I lib:spec" spec.pattern = '../repo/tests/selenium/statements/references_spec.rb' diff --git a/selenium/lib/modules/statement_module.rb b/selenium/lib/modules/statement_module.rb index 53fdc22..4f792a5 100644 --- a/selenium/lib/modules/statement_module.rb +++ b/selenium/lib/modules/statement_module.rb @@ -32,6 +32,7 @@ element(:statement2ClaimValue1, :a, :xpath => "//div[contains(@class, 'wb-claim-section')][2]/div[contains(@class, 'wb-claimview')][1]/div/div/div[contains(@class, 'wb-claim-mainsnak')]/div[contains(@class, 'wb-snak-value-container')]/div[contains(@class, 'wb-snak-value')]/div/div/a") element(:statement2ClaimValue2, :a, :xpath => "//div[contains(@class, 'wb-claim-section')][2]/div[contains(@class, 'wb-claimview')][2]/div/div/div[contains(@class, 'wb-claim-mainsnak')]/div[contains(@class, 'wb-snak-value-container')]/div[contains(@class, 'wb-snak-value')]/div/div/a") element(:statement2ClaimValue3, :a, :xpath => "//div[contains(@class, 'wb-claim-section')][2]/div[contains(@class, 'wb-claimview')][3]/div/div/div[contains(@class, 'wb-claim-mainsnak')]/div[contains(@class, 'wb-snak-value-container')]/div[contains(@class, 'wb-snak-value')]/div/div/a") + span(:statement1ClaimValue1Nolink, :xpath => "//div[contains(@class, 'wb-claim-section')][1]/div[contains(@class, 'wb-claimview')][1]/div/div/div[contains(@class, 'wb-claim-mainsnak')]/div[contains(@class, 'wb-snak-value-container')]/div[contains(@class, 'wb-snak-value')]/div/div/span") span(:snaktypeSelectorIcon, :xpath => "//div[contains(@class, 'wb-snak-typeselector')]/span[contains(@class, 'wb-snaktypeselector')]") link(:snaktypeSelectorValue, :xpath => "//ul[contains(@class, 'wb-snaktypeselector-menu')]/li[contains(@class, 'wb-snaktypeselector-menuitem-value')]/a") link(:snaktypeSelectorSomevalue, :xpath => "//ul[contains(@class, 'wb-snaktypeselector-menu')]/li[contains(@class, 'wb-snaktypeselector-menuitem-somevalue')]/a") -- To view, visit https://gerrit.wikimedia.org/r/64073 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib4500685810ef493c02e1559b9e259f2198e223d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Tobias Gritschacher <[email protected]> Gerrit-Reviewer: Daniel Werner <[email protected]> Gerrit-Reviewer: Henning Snater <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
