Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/121408
Change subject: Refactoring of basic Cucumber steps ...................................................................... Refactoring of basic Cucumber steps Change-Id: I906e08c7e9ddc35d9cac8991138db782d6f8dd06 --- M tests/browser/features/step_definitions/entity_steps.rb M tests/browser/features/support/modules/url_module.rb 2 files changed, 29 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/08/121408/1 diff --git a/tests/browser/features/step_definitions/entity_steps.rb b/tests/browser/features/step_definitions/entity_steps.rb index 7377713..d0aec76 100644 --- a/tests/browser/features/step_definitions/entity_steps.rb +++ b/tests/browser/features/step_definitions/entity_steps.rb @@ -10,10 +10,34 @@ visit(RepoLoginPage).login_with(ENV["WB_REPO_USERNAME"], ENV["WB_REPO_PASSWORD"]) end +Given /^I am not logged in to the repo$/ do + visit(RepoLogoutPage) +end + Given /^I am on an item page$/ do - item_data = '{"labels":{"en":{"language":"en","value":"' + generate_random_string(8) + '"}},"descriptions":{"en":{"language":"en","value":"' + generate_random_string(20) + '"}}}' + step 'I have an item to test' + step 'I am on the page of the item to test' +end + +Given /^I have an item to test$/ do + step 'I have an item with label "' + generate_random_string(8) + '" and description "' + generate_random_string(20) + '"' +end + +Given /^I have an item with empty label and description$/ do + step 'I have an item with label "" and description ""' +end + +Given /^I have an item with label "([^"]*)"$/ do |label| + step 'I have an item with label "' + label + '" and description "' + generate_random_string(20) + '"' +end + +Given /^I have an item with label "(.*)" and description "(.*)"$/ do |label,description| + item_data = '{"labels":{"en":{"language":"en","value":"' + label + '"}},"descriptions":{"en":{"language":"en","value":"' + description + '"}}}' wb_api = WikibaseAPI::Gateway.new(URL.repo_api) @item_under_test = wb_api.wb_create_entity(item_data, "item") +end + +Given /^I am on the page of the item to test$/ do on(ItemPage).navigate_to_entity @item_under_test["url"] end @@ -37,10 +61,8 @@ end Given /^I am on an item page with empty label and description$/ do - item_data = '{"labels":{"en":{"language":"en","value":"' + '' + '"}},"descriptions":{"en":{"language":"en","value":"' + '' + '"}}}' - wb_api = WikibaseAPI::Gateway.new(URL.repo_api) - @item_under_test = wb_api.wb_create_entity(item_data, "item") - on(ItemPage).navigate_to_entity @item_under_test["url"] + step 'I have an item with empty label and description' + step 'I am on the page of the item to test' end Given /^The following sitelinks do not exist:$/ do |sitelinks| diff --git a/tests/browser/features/support/modules/url_module.rb b/tests/browser/features/support/modules/url_module.rb index f491505..26d0c0e 100644 --- a/tests/browser/features/support/modules/url_module.rb +++ b/tests/browser/features/support/modules/url_module.rb @@ -16,7 +16,8 @@ def self.repo_url(name) url = ENV["WIKIDATA_REPO_URL"] - "#{url}#{name}" + lang = ENV["LANGUAGE_CODE"] + "#{url}#{name}?setlang=#{lang}" end def self.repo_api() -- To view, visit https://gerrit.wikimedia.org/r/121408 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I906e08c7e9ddc35d9cac8991138db782d6f8dd06 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits