Amire80 has uploaded a new change for review. https://gerrit.wikimedia.org/r/100549
Change subject: Clean up the translator sandbox tests ...................................................................... Clean up the translator sandbox tests Refactoring the steps. Change-Id: I694ec5350adaad7a5f3a878196e2d8298d312be7 --- M tests/browser/features/manage_translator_sandbox.feature M tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb M tests/browser/features/support/pages/manage_translator_sandbox_page.rb 3 files changed, 30 insertions(+), 28 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/49/100549/1 diff --git a/tests/browser/features/manage_translator_sandbox.feature b/tests/browser/features/manage_translator_sandbox.feature index 1c3aa4a..de5c7bc 100644 --- a/tests/browser/features/manage_translator_sandbox.feature +++ b/tests/browser/features/manage_translator_sandbox.feature @@ -14,31 +14,31 @@ Given I am logged in as a translation administrator Scenario: There are no users in the sandbox - Given I am on the Special:ManageTranslatorSandbox page with no users in the sandbox + Given I am on the Translator Sandbox management page with no users in the sandbox Then no users are displayed in the first column And I should see 'No requests from new users' in the second column Scenario: Existing users can be searched on the list - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I search for 'pupu' in the sandboxed users search field Then only users whose name begins with 'pupu' are displayed in the first column And I should see '5 requests' at the top of the first column Scenario: Searching for non-existing users displays no results - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I search for 'nosuchuser' in the sandboxed users search field Then no users are displayed in the first column And I should see '0 requests' at the top of the first column Scenario: Emptying the search field shows all the users - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I search for 'pupu' in the sandboxed users search field And I search for '' in the sandboxed users search field Then a user whose name begins with 'pupu' is displayed in the first column And a user whose name begins with 'orava' is displayed in the first column Scenario: Selecting older requests - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Orava1' in the first column And I click on the link that says '3 older requests' at the bottom of the first column Then I should see the checkbox next to the request from 'Orava1' checked @@ -53,7 +53,7 @@ And I should see '4 users selected' in the header of the second column Scenario: Searching for a user by language - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click the sandboxed users language filter button And I type 'ml' in the language filter Then only users who translate to language 'ml' are displayed in the first column @@ -63,7 +63,7 @@ And I should see the button that clears language selection Scenario: Searching for a user by language and selecting all users - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click the sandboxed users language filter button And I type 'uk' in the language filter And I click the checkbox to select all users @@ -73,7 +73,7 @@ And I should see '2 users selected' in the header of the second column Scenario: Showing user who translate to all languages - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click the sandboxed users language filter button And I type 'nl' in the language filter And I click the button that clears language selection @@ -84,7 +84,7 @@ And I should not see the button that clears language selection Scenario: Translation Administrator should be able to see a list of pending requests with usernames in the first column, sorted by the number of translations and the most recent within them, and the first user should be selected - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox Then I should see the userlist in the first column sorted by the number of translations and the most recent within them And I should see the checkbox next to the request from 'Orava4' checked And I should see the checkbox next to the request from 'Orava4' disabled @@ -94,7 +94,7 @@ And I should see '1 user selected' at the bottom of the first column Scenario: Clicking on a name of a user who didn't make any translations shows the user information and the action buttons and doesn't show translations - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Orava0' in the first column Then I should see the checkbox next to the request from 'Orava0' checked And I should see the checkbox next to the request from 'Orava0' disabled @@ -106,7 +106,7 @@ And I should see '1 user selected' at the bottom of the first column Scenario: Clicking a username when another user is selected selects only the new user; Clicking on a name of a user who made some translations shows the user information and the action buttons and some translations - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Orava0' in the first column And I click on 'Orava3' in the first column Then I should see the checkbox next to the request from 'Orava3' checked @@ -119,7 +119,7 @@ And I should see '1 user selected' at the bottom of the first column Scenario: Selecting multiple users - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Orava4' in the first column And I click on the checkbox near 'Pupu3' in the first column Then I should see the checkbox next to the request from 'Orava4' checked @@ -133,7 +133,7 @@ And I should see the 'Reject all' button displayed in the second column Scenario: Selecting multiple users and then one user again - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Pupu3' in the first column And I click on the checkbox near 'Pupu2' in the first column And I click on 'Orava2' in the first column @@ -150,7 +150,7 @@ And I should see the 'Reject' button displayed in the second column Scenario: Accepting one user - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Pupu2' in the first column And I click the 'Accept' button Then I should not see user 'Pupu2' in the first column @@ -161,7 +161,7 @@ And I should see '9 requests' at the top of the first column Scenario: Rejecting one user - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Pupu2' in the first column And I click the 'Reject' button Then I should not see user 'Pupu2' in the first column @@ -172,7 +172,7 @@ And I should see '9 requests' at the top of the first column Scenario: Accepting multiple users - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Pupu2' in the first column And I click on the checkbox near 'Orava3' in the first column And I click the 'Accept all' button @@ -185,7 +185,7 @@ And I should see '8 requests' at the top of the first column Scenario: Rejecting multiple users - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click on 'Pupu2' in the first column And I click on the checkbox near 'Orava3' in the first column And I click the 'Reject all' button @@ -198,7 +198,7 @@ And I should see '8 requests' at the top of the first column Scenario: Accepting all users - Given I am on the Special:ManageTranslatorSandbox page with users in the sandbox + Given I am on the Translator Sandbox management page with users in the sandbox When I click the checkbox to select all users And I click the 'Accept all' button Then no users are displayed in the first column diff --git a/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb b/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb index f49d798..23e36e7 100644 --- a/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb +++ b/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb @@ -2,11 +2,11 @@ step "I am logged in" end -Given(/^I am on the Special:ManageTranslatorSandbox page with no users in the sandbox$/) do +Given(/^I am on the Translator Sandbox management page with no users in the sandbox$/) do visit(ManageTranslatorSandboxPage, :using_params => {:extra => "integrationtesting=empty"}) end -Given(/^I am on the Special:ManageTranslatorSandbox page with users in the sandbox$/) do +Given(/^I am on the Translator Sandbox management page with users in the sandbox$/) do visit(ManageTranslatorSandboxPage, :using_params => {:extra => "integrationtesting=populate"}) end @@ -126,22 +126,18 @@ end Then(/^I should not see any users except '(.+)' selected$/) do |username| - on(ManageTranslatorSandboxPage).requests_without_username(username).all? do |element| - not element.attribute_value("class").split(" ").include?("selected") - end + on(ManageTranslatorSandboxPage).only_request_with_username_is_selected?(username).should be_true end Then(/^I should not see any translations done by the user in the second column$/) do on(ManageTranslatorSandboxPage) do |page| page.translation_elements.length.should == 0 - page.no_translations_name_element.should be_visible + page.details_no_translations_element.should be_visible end end Then(/^I should not see any translations done by the users in the second column$/) do - on(ManageTranslatorSandboxPage) do |page| - page.translation_elements.length.should == 0 - end + on(ManageTranslatorSandboxPage).translation_elements.length.should == 0 end Then(/^I should see the details of (\d+) sandboxed translations done by the user in the second column$/) do |translations| diff --git a/tests/browser/features/support/pages/manage_translator_sandbox_page.rb b/tests/browser/features/support/pages/manage_translator_sandbox_page.rb index 82990dd..9b1fab9 100644 --- a/tests/browser/features/support/pages/manage_translator_sandbox_page.rb +++ b/tests/browser/features/support/pages/manage_translator_sandbox_page.rb @@ -14,7 +14,7 @@ text_field(:language_filter, id: "languagefilter") button(:language_selector_button, class: "language-selector") - div(:no_translations_name, text: "This user did not make any translations.") + div(:details_no_translations, class: "tsb-details-no-translations") div(:requests_list, class: "requests-list") div(:request_count, class: "request-count") @@ -98,4 +98,10 @@ expected_usernames == usernames end + + def only_request_with_username_is_selected?(username) + requests_without_username(username).all? do |element| + not element.attribute_value("class").split(" ").include?("selected") + end + end end -- To view, visit https://gerrit.wikimedia.org/r/100549 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I694ec5350adaad7a5f3a878196e2d8298d312be7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits