Nikerabbit has uploaded a new change for review.
https://gerrit.wikimedia.org/r/86175
Change subject: Tests for translate recent and proofread recent button
......................................................................
Tests for translate recent and proofread recent button
Change-Id: I5545d284a59acaac9cdd81bfee7797e940c4f09b
---
M tests/browser/features/signed_in_and_approved_users.feature
M tests/browser/features/step_definitions/common_steps.rb
M tests/browser/features/step_definitions/signed_in_and_approved_user_steps.rb
M tests/browser/features/support/pages/main_page.rb
A tests/browser/features/support/pages/translate_page.rb
5 files changed, 66 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TwnMainPage
refs/changes/75/86175/1
diff --git a/tests/browser/features/signed_in_and_approved_users.feature
b/tests/browser/features/signed_in_and_approved_users.feature
index f2c3209..18faac3 100644
--- a/tests/browser/features/signed_in_and_approved_users.feature
+++ b/tests/browser/features/signed_in_and_approved_users.feature
@@ -11,25 +11,31 @@
Background:
Given I am logged in
- When I go to the main page
Scenario: General statistics about the site are shown
+ When I go to the main page
Then I should see general statistics about the site
Scenario: General statistics about the user's contributions are shown
+ When I go to the main page
Then I should see statistics about myself
- Scenario: 'Translate' button takes the user to the translation editor in a
'translation view'
- Given that I am an approved translator on TWN
- And I am logged in
- When I click on the 'Translate' button on the first page displayed after
logging-in
- Then I should see the translation editor in the translate view
- Scenario: "Proofread" button takes the user to the translation editor in a
'proofreading view'
- Given that I am an approved translator on TWN
- And I am logged in
- When I click on the 'Proofread' button on the first page displayed after
logging-in
- Then I should see the translation editor in the proofreading view
+ For these two tests below, we will change the language to somethinge else
+ because in English you will get an error message "translation to the source
+ language" has been disabled.
+
+ Scenario: Going to translate recently changes messages
+ When I change my interface language away from English
+ And I go to the main page
+ And I click the "Translate" button in my personal stats
+ Then I should see list of recent messages in the translation view
+
+ Scenario: Going to proofread recently changes translations
+ When I change my interface language away from English
+ And I go to the main page
+ And I click the "Proofread" button in my personal stats
+ Then I should see list of recent translations in the proofreading view
Scenario: "View language statistics" link should take the user to the
statistics page on TWN
Given that I am an approved translator on TWN
diff --git a/tests/browser/features/step_definitions/common_steps.rb
b/tests/browser/features/step_definitions/common_steps.rb
index 9738611..fa8ed56 100644
--- a/tests/browser/features/step_definitions/common_steps.rb
+++ b/tests/browser/features/step_definitions/common_steps.rb
@@ -11,3 +11,10 @@
Given(/^I am on the main page$/) do
visit(MainPage)
end
+
+When(/^I change my interface language away from English$/) do
+ visit(PreferencesPage) do |page|
+ page.set_interface_language_element.select_value 'fi'
+ page.save_element.click
+ end
+end
diff --git
a/tests/browser/features/step_definitions/signed_in_and_approved_user_steps.rb
b/tests/browser/features/step_definitions/signed_in_and_approved_user_steps.rb
index 7591dbf..3944fd7 100644
---
a/tests/browser/features/step_definitions/signed_in_and_approved_user_steps.rb
+++
b/tests/browser/features/step_definitions/signed_in_and_approved_user_steps.rb
@@ -12,3 +12,32 @@
Then(/^I should see statistics about myself$/) do
on(MainPage).personal_statistics_element.should be_visible
end
+
+
+When(/^I click the "Translate" button in my personal stats$/) do
+ on(MainPage).translate_recent_messages_element.click
+end
+
+When(/^I click the "Proofread" button in my personal stats$/) do
+ on(MainPage).proofread_recent_translations_element.click
+end
+
+Then(/^I should see list of recent messages in the translation view$/) do
+ on(TranslatePage) do |page|
+ # Assuming Finnish here. If that assumption proves to be
unreliable,
+ # we can check the data msggroupid attribute instead.
+ page.selected_group.should == 'Tuoreet lisäykset'
+ page.translate_mode_button_element.attribute('class').should
match(/\bdown\b/)
+ end
+end
+
+
+Then(/^I should see list of recent translations in the proofreading view$/) do
+ on(TranslatePage) do |page|
+ # Assuming Finnish here. If that assumption proves to be
unreliable,
+ # we can check the data msggroupid attribute instead.
+ page.selected_group.should == 'Tuoreet käännökset'
+ page.proofread_mode_button_element.attribute('class').should
match(/\bdown\b/)
+ end
+end
+
diff --git a/tests/browser/features/support/pages/main_page.rb
b/tests/browser/features/support/pages/main_page.rb
index efae492..855c54d 100644
--- a/tests/browser/features/support/pages/main_page.rb
+++ b/tests/browser/features/support/pages/main_page.rb
@@ -8,4 +8,7 @@
div(:number_of_projects, id: 'twnmp-s-projects')
div(:personal_statistics, class: 'stats-widget')
+
+ button(:translate_recent_messages, id: 'twnmp-translate')
+ button(:proofread_recent_translations, id: 'twnmp-proofread')
end
diff --git a/tests/browser/features/support/pages/translate_page.rb
b/tests/browser/features/support/pages/translate_page.rb
new file mode 100644
index 0000000..eb269f2
--- /dev/null
+++ b/tests/browser/features/support/pages/translate_page.rb
@@ -0,0 +1,10 @@
+class TranslatePage
+ include PageObject
+
+ include URL
+ page_url URL.url('Special:Translate')
+
+ span(:selected_group, css: '.grouplink.tail')
+ button(:translate_mode_button, class: 'translate-mode-button')
+ button(:proofread_mode_button, class: 'tux-proofread-button')
+end
--
To view, visit https://gerrit.wikimedia.org/r/86175
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5545d284a59acaac9cdd81bfee7797e940c4f09b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwnMainPage
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits