Zfilipin has uploaded a new change for review. https://gerrit.wikimedia.org/r/251953
Change subject: Fixed Style/Tab RuboCop offense ...................................................................... Fixed Style/Tab RuboCop offense Bug: T117987 Change-Id: I71e95abbb285bab0b260eee7a481b6d5fa59ff3f --- M .rubocop_todo.yml M tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb M tests/browser/features/step_definitions/special_translate_steps.rb M tests/browser/features/step_definitions/translation_stash_steps.rb M tests/browser/features/support/hooks.rb M tests/browser/features/support/pages/manage_translator_sandbox_page.rb M tests/browser/features/support/pages/stash_page.rb M tests/browser/features/support/pages/translate_page.rb M tests/browser/features/support/pages/user_page.rb 9 files changed, 246 insertions(+), 259 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/53/251953/1 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c28774b..b080ce0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -61,19 +61,6 @@ Style/StringLiterals: Enabled: false -# Offense count: 246 -# Cop supports --auto-correct. -Style/Tab: - Exclude: - - 'tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb' - - 'tests/browser/features/step_definitions/special_translate_steps.rb' - - 'tests/browser/features/step_definitions/translation_stash_steps.rb' - - 'tests/browser/features/support/hooks.rb' - - 'tests/browser/features/support/pages/manage_translator_sandbox_page.rb' - - 'tests/browser/features/support/pages/stash_page.rb' - - 'tests/browser/features/support/pages/translate_page.rb' - - 'tests/browser/features/support/pages/user_page.rb' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: WordRegex. 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 8f0624b..a2872a4 100644 --- a/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb +++ b/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb @@ -1,214 +1,214 @@ Given(/^I am logged in as a translation administrator$/) do - step "I am logged in" + step "I am logged in" end Given(/^I am on the Translator sandbox management page with no users in the sandbox$/) do - visit(ManageTranslatorSandboxPage, using_params: {extra: "integrationtesting=empty"}) + visit(ManageTranslatorSandboxPage, using_params: {extra: "integrationtesting=empty"}) end Given(/^I am on the Translator sandbox management page with users in the sandbox$/) do - visit(ManageTranslatorSandboxPage, using_params: {extra: "integrationtesting=populate"}) + visit(ManageTranslatorSandboxPage, using_params: {extra: "integrationtesting=populate"}) end When(/^I search for "(.*)" in the sandboxed users search field$/) do |string| - on(ManageTranslatorSandboxPage) do |page| - page.search = string - page.search_element.send_keys :enter - end + on(ManageTranslatorSandboxPage) do |page| + page.search = string + page.search_element.send_keys :enter + end end When(/^I click the sandboxed users language filter button$/) do - on(ManageTranslatorSandboxPage).language_selector_button + on(ManageTranslatorSandboxPage).language_selector_button end When(/^I type "(.+)" in the language filter$/) do |text| - on(ManageTranslatorSandboxPage) do |page| - page.language_filter = text - page.language_filter_element.send_keys [:enter, "\n"] - end + on(ManageTranslatorSandboxPage) do |page| + page.language_filter = text + page.language_filter_element.send_keys [:enter, "\n"] + end end When(/^I click the button that clears language selection$/) do - on(ManageTranslatorSandboxPage).clear_language_selector_element.click + on(ManageTranslatorSandboxPage).clear_language_selector_element.click end When(/^I click the checkbox to select all users$/) do - on(ManageTranslatorSandboxPage).select_all_checkbox_element.click + on(ManageTranslatorSandboxPage).select_all_checkbox_element.click end When(/^I click the "(.+)" button$/) do |label| - on(ManageTranslatorSandboxPage).click_button(label) + on(ManageTranslatorSandboxPage).click_button(label) end When(/^I click on "(.+)" in the first column$/) do |username| - on(ManageTranslatorSandboxPage).request_with_username(username).click + on(ManageTranslatorSandboxPage).request_with_username(username).click end When(/^I click on the checkbox near "(.+)" in the first column$/) do |username| - on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(username).click + on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(username).click end When(/^I click on the link that says "\d+ older requests?" at the bottom of the first column$/) do - on(ManageTranslatorSandboxPage).older_requests_indicator_element.click + on(ManageTranslatorSandboxPage).older_requests_indicator_element.click end When(/^I go to the userpage of user "(.*?)"$/) do |username| - visit(UserPage, using_params: {extra: username}) + visit(UserPage, using_params: {extra: username}) end Then(/^I should see a babel box with languages "(.*?)"$/) do |languages| - on(UserPage).babel_box_has_languages?(languages).should be_true + on(UserPage).babel_box_has_languages?(languages).should be_true end Then(/^I should not see the older requests link at the bottom of the first column$/) do - on(ManageTranslatorSandboxPage).older_requests_indicator_element.should_not be_visible + on(ManageTranslatorSandboxPage).older_requests_indicator_element.should_not be_visible end Then(/^I should not see any users except "(.+)" selected$/) do |username| - on(ManageTranslatorSandboxPage).only_request_with_username_is_selected?(username).should be_true + 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.size.should == 0 - page.details_no_translations.size.should == 1 - page.details_no_translations[0].should be_visible - end + on(ManageTranslatorSandboxPage) do |page| + page.translation_elements.size.should == 0 + page.details_no_translations.size.should == 1 + page.details_no_translations[0].should be_visible + end end Then(/^I should not see any translations done by the users in the second column$/) do - on(ManageTranslatorSandboxPage).translation_elements.length.should == 0 + 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| - on(ManageTranslatorSandboxPage) do |page| - page.translation_elements.size.should == translations.to_i - page.details_no_translations.size.should == 0 - end + on(ManageTranslatorSandboxPage) do |page| + page.translation_elements.size.should == translations.to_i + page.details_no_translations.size.should == 0 + end end Then(/^I should not see user "(.+)" in the first column$/) do |username| - on(ManageTranslatorSandboxPage) do |page| - Watir::Wait.until { page.visible_requests_element.size < 11 } - page.request_with_username(username).should_not exist - end + on(ManageTranslatorSandboxPage) do |page| + Watir::Wait.until { page.visible_requests_element.size < 11 } + page.request_with_username(username).should_not exist + end end Then(/^I should see that (\d+) reminders were sent to the user$/) do |count| - on(ManageTranslatorSandboxPage) do |page| - page.reminder_status_element.should be_visible - page.reminder_status.should match(/^Sent #{count} reminders/i) - end + on(ManageTranslatorSandboxPage) do |page| + page.reminder_status_element.should be_visible + page.reminder_status.should match(/^Sent #{count} reminders/i) + end end Then(/^I should see that no reminders have been sent to the user$/) do - on(ManageTranslatorSandboxPage).reminder_status.should == "" + on(ManageTranslatorSandboxPage).reminder_status.should == "" end Then(/^the direction of the users language filter button is "(.+)"$/) do |dir_value| - on(ManageTranslatorSandboxPage).language_selector_button_element.attribute("dir").should == dir_value + on(ManageTranslatorSandboxPage).language_selector_button_element.attribute("dir").should == dir_value end Then(/^the language code of the users language filter button is "(.+)"$/) do |lang_value| - on(ManageTranslatorSandboxPage).language_selector_button_element.attribute("lang").should == lang_value + on(ManageTranslatorSandboxPage).language_selector_button_element.attribute("lang").should == lang_value end Then(/^usernames are visible in the first column$/) do - on(ManageTranslatorSandboxPage).visible_users_element.size.should_not == 0 + on(ManageTranslatorSandboxPage).visible_users_element.size.should_not == 0 end Then(/^I should see the name of language "(.+)" in the second column$/) do |language| - on(ManageTranslatorSandboxPage).details_autonym.text.should == language + on(ManageTranslatorSandboxPage).details_autonym.text.should == language end Then(/^I should see that the language of the first translation is "(.+)"$/) do |language| - on(ManageTranslatorSandboxPage).translations_autonyms[0].text.should == language + on(ManageTranslatorSandboxPage).translations_autonyms[0].text.should == language end Then(/^only users whose name begins with "(.*)" are displayed in the first column$/) do |prefix| - on(ManageTranslatorSandboxPage).visible_users_start_with?(prefix).should be_true + on(ManageTranslatorSandboxPage).visible_users_start_with?(prefix).should be_true end Then(/^a user whose name begins with "(.*)" is displayed in the first column$/) do |prefix| - on(ManageTranslatorSandboxPage).the_first_column_has_username_starting_with?(prefix).should be_true + on(ManageTranslatorSandboxPage).the_first_column_has_username_starting_with?(prefix).should be_true end Then(/^no users are displayed in the first column$/) do - on(ManageTranslatorSandboxPage) do |page| - Watir::Wait.until { page.visible_requests_element.size < 11 } - page.visible_users_element.length.should == 0 - end + on(ManageTranslatorSandboxPage) do |page| + Watir::Wait.until { page.visible_requests_element.size < 11 } + page.visible_users_element.length.should == 0 + end end Then(/^I should see "(.+)" at the top of the first column$/) do |text| - on(ManageTranslatorSandboxPage).request_count.should == text + on(ManageTranslatorSandboxPage).request_count.should == text end Then(/^I should see the button that clears language selection$/) do - on(ManageTranslatorSandboxPage).clear_language_selector_element.should be_visible + on(ManageTranslatorSandboxPage).clear_language_selector_element.should be_visible end Then(/^I should not see the button that clears language selection$/) do - on(ManageTranslatorSandboxPage).clear_language_selector_element.should_not be_visible + on(ManageTranslatorSandboxPage).clear_language_selector_element.should_not be_visible end Then(/^only users who translate to language "(.+)" are displayed in the first column$/) do |language| - on(ManageTranslatorSandboxPage).all_visible_requests_translate_to?(language).should be_true + on(ManageTranslatorSandboxPage).all_visible_requests_translate_to?(language).should be_true end Then(/^I should see "(.+)" at the bottom of the first column$/) do |text| - on(ManageTranslatorSandboxPage).selected_counter.should == text + on(ManageTranslatorSandboxPage).selected_counter.should == text end Then(/^I should see that the user wrote a comment that says "(.*?)"$/) do |text| - on(ManageTranslatorSandboxPage).signup_comment_text.should == text + on(ManageTranslatorSandboxPage).signup_comment_text.should == text end Then(/^I should not see that the user wrote a comment$/) do - on(ManageTranslatorSandboxPage).signup_comment_text_element.should_not exist + on(ManageTranslatorSandboxPage).signup_comment_text_element.should_not exist end Then(/^I should see the name of the first user in the first column in the header of the second column$/) do - on(ManageTranslatorSandboxPage) do |page| - page.details_header.text.should == page.username_in_request(0) - end + on(ManageTranslatorSandboxPage) do |page| + page.details_header.text.should == page.username_in_request(0) + end end Then(/^I should see "(.+)" in the header of the second column$/) do |text| - on(ManageTranslatorSandboxPage).details_header.text.should == text + on(ManageTranslatorSandboxPage).details_header.text.should == text end Then(/^I should see the userlist in the first column sorted by the number of translations and the most recent within them$/) do - on(ManageTranslatorSandboxPage).requests_are_sorted_by_translation_count_and_date?.should be_true + on(ManageTranslatorSandboxPage).requests_are_sorted_by_translation_count_and_date?.should be_true end Then(/^I should see the checkbox next to the request from "(.+)" checked$/) do |user| - on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should be_checked + on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should be_checked end Then(/^I should see the checkbox next to the request from "(.+)" unchecked$/) do |user| - on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should_not be_checked + on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should_not be_checked end Then(/^I should see the checkbox next to the request from "(.+)" disabled$/) do |user| - on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should be_disabled + on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should be_disabled end Then(/^I should see the checkbox next to the request from "(.+)" enabled$/) do |user| - on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should_not be_disabled + on(ManageTranslatorSandboxPage).checkbox_for_request_with_username(user).should_not be_disabled end Then(/^I should see the "(.+)" button displayed in the second column$/) do |label| - on(ManageTranslatorSandboxPage).details_button(label).should be_visible + on(ManageTranslatorSandboxPage).details_button(label).should be_visible end Then(/^I should see "(.+)" in the older requests link at the bottom of the first column$/) do |text| - on(ManageTranslatorSandboxPage) do |page| - page.older_requests_indicator_element.should be_visible - page.older_requests_indicator_element.text.should == text - end + on(ManageTranslatorSandboxPage) do |page| + page.older_requests_indicator_element.should be_visible + page.older_requests_indicator_element.text.should == text + end end Then(/^I should see that the user's translations are sorted by the language code$/) do - on(ManageTranslatorSandboxPage).translations_languages_are_sorted?.should be_true + on(ManageTranslatorSandboxPage).translations_languages_are_sorted?.should be_true end diff --git a/tests/browser/features/step_definitions/special_translate_steps.rb b/tests/browser/features/step_definitions/special_translate_steps.rb index e3eb863..04bf7f2 100644 --- a/tests/browser/features/step_definitions/special_translate_steps.rb +++ b/tests/browser/features/step_definitions/special_translate_steps.rb @@ -1,23 +1,23 @@ Given(/^I am translating a message group which doesn't have workflow states$/) do - visit(TranslatePage, using_params: {extra: "language=fi"}) + visit(TranslatePage, using_params: {extra: "language=fi"}) end Given(/^I am translating a message group which has workflow states$/) do - visit(TranslatePage, using_params: {extra: "language=fi&group=page-Language+committee"}) + visit(TranslatePage, using_params: {extra: "language=fi&group=page-Language+committee"}) end When(/^I click the workflow state$/) do - on(TranslatePage).workflow_state_element.when_present.click + on(TranslatePage).workflow_state_element.when_present.click end Then(/^I should see a workflow state$/) do - on(TranslatePage).workflow_state_element.when_present.should be_visible + on(TranslatePage).workflow_state_element.when_present.should be_visible end Then(/^I should not see a workflow state$/) do - on(TranslatePage).workflow_state_element.should_not be_visible + on(TranslatePage).workflow_state_element.should_not be_visible end Then(/^I should see a list of states$/) do - on(TranslatePage).workflow_state_selector_element.should be_visible + on(TranslatePage).workflow_state_selector_element.should be_visible end diff --git a/tests/browser/features/step_definitions/translation_stash_steps.rb b/tests/browser/features/step_definitions/translation_stash_steps.rb index 94911b9..95303ef 100644 --- a/tests/browser/features/step_definitions/translation_stash_steps.rb +++ b/tests/browser/features/step_definitions/translation_stash_steps.rb @@ -3,66 +3,66 @@ end Given(/^I am a sandboxed user on the stash page$/) do - visit(StashPage, using_params: {extra: "integrationtesting=activatestash"}) + visit(StashPage, using_params: {extra: "integrationtesting=activatestash"}) end Then(/^I should see a language selector$/) do - on(StashPage).language_selector_element.should be_visible + on(StashPage).language_selector_element.should be_visible end Then(/^I should be able to select a language$/) do - on(StashPage).select_language("fi") + on(StashPage).select_language("fi") end Then(/^I should see the save button$/) do - on(StashPage).save_button_element.when_present.should be_visible + on(StashPage).save_button_element.when_present.should be_visible end Then(/^I should see the skip button$/) do - on(StashPage).skip_button_element.when_present.should be_visible + on(StashPage).skip_button_element.when_present.should be_visible end When(/^I make a translation$/) do - on(StashPage).make_a_translation + on(StashPage).make_a_translation end Then(/^I should see my translation saved$/) do - on(StashPage).status_saved_element.when_present.should be_visible + on(StashPage).status_saved_element.when_present.should be_visible end Then(/^I should see the next message open for translation$/) do - on(StashPage) do |page| - page.translation_element(1).when_present.should be_visible - page.translation_element(1).value.should == "" - end + on(StashPage) do |page| + page.translation_element(1).when_present.should be_visible + page.translation_element(1).value.should == "" + end end When(/^I reload the page$/) do - visit StashPage + visit StashPage end Then(/^I can open and see my earlier translation$/) do - pending("Does not work because of random language selection on reload.") do - on(StashPage) do |page| - page.edit_element.when_present(10).click - page.translation_element.when_present.value.should == "Pupu" - end - end + pending("Does not work because of random language selection on reload.") do + on(StashPage) do |page| + page.edit_element.when_present(10).click + page.translation_element.when_present.value.should == "Pupu" + end + end end Then(/^I should see a message indicating I have one completed translation$/) do - on(StashPage).translation_stats.should match(/1/) + on(StashPage).translation_stats.should match(/1/) end When(/^I translate all the messages in the sandbox$/) do - # Sandbox needs to get enough messages - pending - (0..19).each do |i| - on(StashPage).make_a_translation(i) - step "I should see my translation saved" - end + # Sandbox needs to get enough messages + pending + (0..19).each do |i| + on(StashPage).make_a_translation(i) + step "I should see my translation saved" + end end Then(/^I can see a message that maximum number of translations has been reached$/) do - on(StashPage).limit_message_element.should be_visible + on(StashPage).limit_message_element.should be_visible end diff --git a/tests/browser/features/support/hooks.rb b/tests/browser/features/support/hooks.rb index 3eb8079..b0a5876 100644 --- a/tests/browser/features/support/hooks.rb +++ b/tests/browser/features/support/hooks.rb @@ -1,3 +1,3 @@ After("@stash") do - visit(StashPage, using_params: {extra: "integrationtesting=deactivatestash"}) + visit(StashPage, using_params: {extra: "integrationtesting=deactivatestash"}) end 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 d803d68..2128690 100644 --- a/tests/browser/features/support/pages/manage_translator_sandbox_page.rb +++ b/tests/browser/features/support/pages/manage_translator_sandbox_page.rb @@ -1,143 +1,143 @@ require "json" class ManageTranslatorSandboxPage - include PageObject + include PageObject - page_url "Special:ManageTranslatorSandbox?<%=params[:extra]%>" + page_url "Special:ManageTranslatorSandbox?<%=params[:extra]%>" - button(:clear_language_selector, class: "clear-language-selector") + button(:clear_language_selector, class: "clear-language-selector") - div(:details, class: "details") + div(:details, class: "details") - text_field(:language_filter, id: "languagefilter") - button(:language_selector_button, class: "language-selector") + text_field(:language_filter, id: "languagefilter") + button(:language_selector_button, class: "language-selector") - a(:older_requests_indicator, class: "older-requests-indicator") + a(:older_requests_indicator, class: "older-requests-indicator") - div(:request_count, class: "request-count") - span(:reminder_status, class: "reminder-status") + div(:request_count, class: "request-count") + span(:reminder_status, class: "reminder-status") - span(:selected_counter, class: "selected-counter") + span(:selected_counter, class: "selected-counter") - text_field(:search, class: "request-filter-box") + text_field(:search, class: "request-filter-box") - checkbox(:select_all_checkbox, class: "request-selector-all") + checkbox(:select_all_checkbox, class: "request-selector-all") - div(:signup_comment_text, class: "signup-comment-text") + div(:signup_comment_text, class: "signup-comment-text") - # This must be reloaded every time, because it may change during the test - def details_header - browser.element(class: "tsb-header") - end + # This must be reloaded every time, because it may change during the test + def details_header + browser.element(class: "tsb-header") + end - def details_button(label) - button_class = label.downcase.gsub(" ", "-") - browser.button(class: button_class) - end + def details_button(label) + button_class = label.downcase.gsub(" ", "-") + browser.button(class: button_class) + end - def details_no_translations - browser.divs(class: "tsb-details-no-translations") - end + def details_no_translations + browser.divs(class: "tsb-details-no-translations") + end - def visible_request_selectors_element - browser.elements(css: ".row.request:not(.hide) .request-selector") - end + def visible_request_selectors_element + browser.elements(css: ".row.request:not(.hide) .request-selector") + end - def visible_users_element - browser.elements(css: ".row.request:not(.hide) .username") - end + def visible_users_element + browser.elements(css: ".row.request:not(.hide) .username") + end - def visible_requests_element - browser.elements(css: ".row.request:not(.hide)") - end + def visible_requests_element + browser.elements(css: ".row.request:not(.hide)") + end - def hidden_users_element - browser.elements(css: ".requests .request.hide") - end + def hidden_users_element + browser.elements(css: ".requests .request.hide") + end - def request_with_username(username) - browser.div(id: "tsb-request-#{username}") - end + def request_with_username(username) + browser.div(id: "tsb-request-#{username}") + end - def requests_without_username(username) - browser.elements(css: ".row.request:not(#tsb-request-#{username})") - end + def requests_without_username(username) + browser.elements(css: ".row.request:not(#tsb-request-#{username})") + end - def translation_elements - browser.elements(css: ".details .translation") - end + def translation_elements + browser.elements(css: ".details .translation") + end - def checkbox_for_request_with_username(username) - browser.div(id: "tsb-request-#{username}").checkbox(class: "request-selector") - end + def checkbox_for_request_with_username(username) + browser.div(id: "tsb-request-#{username}").checkbox(class: "request-selector") + end - def visible_users_start_with?(prefix) - Watir::Wait.until { hidden_users_element.size > 0 } - visible_users_element.all? do |element| - element.text.match(/^#{prefix}/i) - end - end + def visible_users_start_with?(prefix) + Watir::Wait.until { hidden_users_element.size > 0 } + visible_users_element.all? do |element| + element.text.match(/^#{prefix}/i) + end + end - def the_first_column_has_username_starting_with?(prefix) - visible_users_element.any? do |element| - element.text.match(/^#{prefix}/i) - end - end + def the_first_column_has_username_starting_with?(prefix) + visible_users_element.any? do |element| + element.text.match(/^#{prefix}/i) + end + end - def all_visible_requests_translate_to?(language) - Watir::Wait.until { hidden_users_element.size > 0 } - visible_requests_element.all? do |element| - user_data = JSON.parse(element.attribute_value("data-data")) - user_data["languagepreferences"]["languages"].include?(language) - end - end + def all_visible_requests_translate_to?(language) + Watir::Wait.until { hidden_users_element.size > 0 } + visible_requests_element.all? do |element| + user_data = JSON.parse(element.attribute_value("data-data")) + user_data["languagepreferences"]["languages"].include?(language) + end + end - def username_in_request(index) - visible_users_element[index].text - end + def username_in_request(index) + visible_users_element[index].text + end - def requests_are_sorted_by_translation_count_and_date? - expected_usernames = [] - Array(0..4).each do |num| - %w{Pupu Orava}.each do |name| - expected_usernames.unshift("#{name}#{num}") - end - end - expected_usernames.unshift("Kissa") - usernames = visible_users_element.collect { |element| element.text } + def requests_are_sorted_by_translation_count_and_date? + expected_usernames = [] + Array(0..4).each do |num| + %w{Pupu Orava}.each do |name| + expected_usernames.unshift("#{name}#{num}") + end + end + expected_usernames.unshift("Kissa") + usernames = visible_users_element.collect { |element| element.text } - expected_usernames == usernames - end + expected_usernames == usernames + end - def details_autonym - browser.elements(css: ".details.pane .languages span")[0] - end + def details_autonym + browser.elements(css: ".details.pane .languages span")[0] + end - def translations_languages_are_sorted? - expected_langs = ["bn", "fi", "he", "nl", "uk"] - langs = translations_autonyms.collect { |element| element.attribute_value("lang") } + def translations_languages_are_sorted? + expected_langs = ["bn", "fi", "he", "nl", "uk"] + langs = translations_autonyms.collect { |element| element.attribute_value("lang") } - expected_langs == langs - end + expected_langs == langs + end - def translations_autonyms - browser.elements(css: ".details.pane .translations .info.autonym") - end + def translations_autonyms + browser.elements(css: ".details.pane .translations .info.autonym") + end - def click_button(label) - initial_header_text = details_header.text + def click_button(label) + initial_header_text = details_header.text - details_button(label).click + details_button(label).click - # It takes a few moments until Accept and Reject buttons - # finish performing the action, and this action always - # removes the currently displayed users and changes the header - Watir::Wait.while { browser.execute_script "return window.tsbUpdatingUsers" } - end + # It takes a few moments until Accept and Reject buttons + # finish performing the action, and this action always + # removes the currently displayed users and changes the header + Watir::Wait.while { browser.execute_script "return window.tsbUpdatingUsers" } + 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 + 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 diff --git a/tests/browser/features/support/pages/stash_page.rb b/tests/browser/features/support/pages/stash_page.rb index ea76221..2c04091 100644 --- a/tests/browser/features/support/pages/stash_page.rb +++ b/tests/browser/features/support/pages/stash_page.rb @@ -1,36 +1,36 @@ class StashPage - include PageObject + include PageObject - page_url "Special:TranslationStash?<%=params[:extra]%>" + page_url "Special:TranslationStash?<%=params[:extra]%>" - a(:edit, text: "Edit") + a(:edit, text: "Edit") - a(:language_selector, class: "uls-trigger") - text_field(:language_filter, id: "uls-languagefilter") + a(:language_selector, class: "uls-trigger") + text_field(:language_filter, id: "uls-languagefilter") - button(:skip_button, class: "tux-editor-skip-button") + button(:skip_button, class: "tux-editor-skip-button") - span(:status_saved, class: "tux-status-translated") + span(:status_saved, class: "tux-status-translated") - div(:translation_stats, class: "stash-stats") - div(:limit_message, class: "limit-reached") + div(:translation_stats, class: "stash-stats") + div(:limit_message, class: "limit-reached") - def make_a_translation(index = 0) - translation_element(index).when_present.set "Pupu" - save_button_element(index).click - end + def make_a_translation(index = 0) + translation_element(index).when_present.set "Pupu" + save_button_element(index).click + end - def save_button_element(index = 0) - browser.button(class: "tux-editor-save-button", index: index) - end + def save_button_element(index = 0) + browser.button(class: "tux-editor-save-button", index: index) + end - def select_language(language) - self.language_selector_element.click - self.language_filter = language - self.language_filter_element.send_keys :enter - end + def select_language(language) + self.language_selector_element.click + self.language_filter = language + self.language_filter_element.send_keys :enter + end - def translation_element(index = 0) - browser.text_field(class: "tux-textarea-translation", index: index) - end + def translation_element(index = 0) + browser.text_field(class: "tux-textarea-translation", index: index) + end end diff --git a/tests/browser/features/support/pages/translate_page.rb b/tests/browser/features/support/pages/translate_page.rb index 69cc6ae..77aced0 100644 --- a/tests/browser/features/support/pages/translate_page.rb +++ b/tests/browser/features/support/pages/translate_page.rb @@ -1,8 +1,8 @@ class TranslatePage - include PageObject + include PageObject - page_url "Special:Translate?<%=params[:extra]%>" + page_url "Special:Translate?<%=params[:extra]%>" - div(:workflow_state, class: "tux-workflow-status") - ul(:workflow_state_selector, class: "tux-workflow-status-selector") + div(:workflow_state, class: "tux-workflow-status") + ul(:workflow_state_selector, class: "tux-workflow-status-selector") end diff --git a/tests/browser/features/support/pages/user_page.rb b/tests/browser/features/support/pages/user_page.rb index f274c9b..657e1bc 100644 --- a/tests/browser/features/support/pages/user_page.rb +++ b/tests/browser/features/support/pages/user_page.rb @@ -1,12 +1,12 @@ class UserPage - include PageObject + include PageObject - page_url "User:<%=params[:extra]%>" + page_url "User:<%=params[:extra]%>" - def babel_box_has_languages?(languages) - languages.split(/, /).all? do |language| - browser.element(css: ".mw-babel-box td[lang=#{language}]").visible? - end - end + def babel_box_has_languages?(languages) + languages.split(/, /).all? do |language| + browser.element(css: ".mw-babel-box td[lang=#{language}]").visible? + end + end end -- To view, visit https://gerrit.wikimedia.org/r/251953 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I71e95abbb285bab0b260eee7a481b6d5fa59ff3f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Zfilipin <zfili...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits