Nikerabbit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88952


Change subject: WIP: browser tests for translation stash
......................................................................

WIP: browser tests for translation stash

Change-Id: I1cb655aa70044e6627d47556b9ea8af240db418e
---
A tests/browser/features/step_definitions/common_steps.rb
A tests/browser/features/step_definitions/translation_stash_steps.rb
A tests/browser/features/support/pages/login_page.rb
A tests/browser/features/support/pages/stash_page.rb
A tests/browser/features/translation_stash.feature
5 files changed, 167 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/52/88952/1

diff --git a/tests/browser/features/step_definitions/common_steps.rb 
b/tests/browser/features/step_definitions/common_steps.rb
new file mode 100644
index 0000000..d6add03
--- /dev/null
+++ b/tests/browser/features/step_definitions/common_steps.rb
@@ -0,0 +1,14 @@
+Given(/^I am logged in$/) do
+       visit(LoginPage).login_with(ENV['MEDIAWIKI_USER'], 
ENV['MEDIAWIKI_PASSWORD'])
+end
+
+Given(/^I am a sandboxed user$/) do
+       # todo
+       #@browser.cookies.add('key', 'value')
+end
+
+
+Given(/^I am on the stash page$/) do
+       visit(StashPage)
+end
+
diff --git a/tests/browser/features/step_definitions/translation_stash_steps.rb 
b/tests/browser/features/step_definitions/translation_stash_steps.rb
new file mode 100644
index 0000000..6a0cc12
--- /dev/null
+++ b/tests/browser/features/step_definitions/translation_stash_steps.rb
@@ -0,0 +1,15 @@
+Then(/^I should see a language selector$/) do
+       on(StashPage).language_selector_element.should be_visible
+end
+
+Then(/^I should be able to select a language$/) do
+       on(StashPage).select_language('fi')
+end
+
+When(/^I click on the edit link next to a message$/) do
+       on(StashPage).edit_message_element.when_present.click
+end
+
+Then(/^I should see the editing area for that message$/) do
+       on(StashPage).edit_message_element.should_not be_visible
+end
diff --git a/tests/browser/features/support/pages/login_page.rb 
b/tests/browser/features/support/pages/login_page.rb
new file mode 100644
index 0000000..a65b1ba
--- /dev/null
+++ b/tests/browser/features/support/pages/login_page.rb
@@ -0,0 +1,17 @@
+class LoginPage
+       include PageObject
+
+       include URL
+       page_url URL.url('Special:UserLogin')
+
+       text_field(:username, id: 'wpName1')
+       text_field(:password, id: 'wpPassword1')
+       button(:login, id: 'wpLoginAttempt')
+
+       def login_with(username, password)
+               self.username = username
+               self.password = password
+               login
+       end
+end
+
diff --git a/tests/browser/features/support/pages/stash_page.rb 
b/tests/browser/features/support/pages/stash_page.rb
new file mode 100644
index 0000000..03b3cdc
--- /dev/null
+++ b/tests/browser/features/support/pages/stash_page.rb
@@ -0,0 +1,18 @@
+class StashPage
+       include PageObject
+
+       include URL
+       page_url URL.url('Special:TranslationStash')
+
+       span(:language_selector, :class => 'uls')
+       text_field(:language_filter, :id => 'languagefilter')
+
+       a(:edit_message, :text => 'Edit', :index => 2)
+
+       def select_language(language)
+               self.language_selector_element.click
+               self.language_filter = language
+               self.language_filter_element.send_keys :enter
+       end
+end
+
diff --git a/tests/browser/features/translation_stash.feature 
b/tests/browser/features/translation_stash.feature
new file mode 100644
index 0000000..7047542
--- /dev/null
+++ b/tests/browser/features/translation_stash.feature
@@ -0,0 +1,103 @@
+Feature: Translation stash
+
+  As a new translator, I can make translations in sandbox mode so that 
translation administrator
+  can judge those and give me translator rights, so that I do not have to 
register and wait for
+  approval before contributing translation for the site.
+
+  Design:
+   - http://commons.wikimedia.org/wiki/File:Translate_UX_Onboarding_designs.pdf
+
+  These scenarios test the Special:TranslationStash page. User needs to be 
inside sandbox to access
+  this page.
+
+  Background:
+    Given I am logged in
+      And I am a sandboxed user
+      And I am on the stash page
+
+
+  Scenario: Can select a language to translate into
+
+    Then I should see a language selector
+     And I should be able to select a language
+
+  Scenario: Can make a translation
+
+    When I click on the edit link next to a message
+      And I write "pupu" as the translation
+    Then What
+
+
+  Scenario: Translation edit area is enabled for sandboxed users
+    Given I am on the sandbox translation page of translatewiki.net
+    And I am logged-in
+    And I have clicked the 'edit' link next to a message to display the editor
+    When I click on the input area
+    Then I should see it enabled
+
+  Scenario: Sandboxed User can see translation suggestions for the string 
being translated
+    Given I am on the sandbox translation page of translatewiki.net
+    And I am logged-in
+    When I click on a message to translate
+    Then I should see translation suggestions being displayed
+
+  Scenario: Sandboxed user can select translation suggestions
+    Given I am on the sandbox translation page of translatewiki.net
+    And I am logged-in
+    And translating a message in the sandbox
+    When I click on the 'Use this translation' link
+    Then I should see translation suggestion copied into the edit area
+
+  Scenario: Sandboxed User can save a translation and move to the next 
translation
+  Given I am on the sandbox translation page of translatewiki.net
+  And I am logged-in
+  And translating a message in the sandbox
+  When I click on the 'Save translation' button
+  Then I should see the translation being saved
+  And I am taken to the next string (assumption: the string being translated 
was not the 5th message in the sandbox)
+
+  Scenario: Sandboxed User can save  a translation and move to the next 
translation with the shortcut keys
+  Given I am on the sandbox translation page of translatewiki.net
+  And I am logged-in
+  And translating a message in the sandbox
+  When I press the 'Ctrl+S' keys
+  Then I should see the translation being saved
+  And I am taken to the next string (assumption: the string being translated 
was not the 5th message in the sandbox)
+
+  Scenario: Sandboxed User can cancel and move to the next translation
+  Given I am on the sandbox translation page of translatewiki.net
+  And I am logged-in
+  And translating a message in the sandbox
+  When I click on the 'Try Another' button
+  Then I am taken to the next string without saving the current string 
(assumption: the string being translated was not the 5th message in the sandbox)
+
+  Scenario: Sandboxed User can cancel and move to the next translation with 
the shortcut keys
+  Given I am on the sandbox translation page of translatewiki.net
+  And I am logged-in
+  And translating a message in the sandbox
+  When I press the 'Ctrl+D' keys
+  Then I am taken to the next string without saving the current string 
(assumption: the string being translated was not the 5th message in the sandbox)
+
+  Scenario: Sandboxed User is displayed the number of translated messages
+  Given I am on the sandbox translation page of translatewiki.net
+  And I am logged-in
+  When I save the translation
+  Then I can see a message indicating the number of completed translations
+
+  #Completed Messages
+
+  Scenario: Sandboxed User is displayed a translation completion message when 
all messages have been translated
+  Given I am on the sandbox translation page of translatewiki.net
+  And I am logged-in
+  When I translate all the messages in the sandbox
+  Then I can see a message inside the sandbox page and on my homepage 
indicating that all messages have been translated
+
+
+  # Editing Completed Messages
+
+  Scenario: Sandboxed User can edit already translated messages
+  Given I am on the sandbox translation page of translatewiki.net
+  And I am logged-in
+  And I have translated messages in the sandbox
+  When I click on the 'Edit' link next to a translated message
+  Then I can edit the message in the editor

-- 
To view, visit https://gerrit.wikimedia.org/r/88952
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cb655aa70044e6627d47556b9ea8af240db418e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to