Cmcmahon has uploaded a new change for review.

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


Change subject: This test only makes sense for enwiki, it runs on beta labs and 
production right now and should fail elsewhere. This is a workaround for not 
being able to change an environment variable from a running script
......................................................................

This test only makes sense for enwiki, it runs on beta labs and production 
right now and should fail elsewhere. This is a workaround for not being able to 
change an environment variable from a running script

Change-Id: I0b32933042ae7d3fa87dcdb1c88e1a635cab38d5
---
A features/login_sul.feature
A features/step_definitions/login_sul_steps.rb
M features/support/pages/main_page.rb
3 files changed, 63 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/qa/browsertests 
refs/changes/85/61285/1

diff --git a/features/login_sul.feature b/features/login_sul.feature
new file mode 100644
index 0000000..0b10576
--- /dev/null
+++ b/features/login_sul.feature
@@ -0,0 +1,19 @@
+Feature: Login SUL
+
+  Scenario: Login on wikis on same project
+    Given I am at enwiki
+    When I log in with my global account as Selenium_user
+    And I visit another wiki commons
+    Then I am logged in on the other wiki
+  
+  Scenario: Login on wikis on different project
+    Given I am at enwiki
+    When I log in with my global account as Selenium_user
+    And I visit another wiki meta
+    Then I am logged in on the other wiki
+
+  Scenario: Logout on one wiki logs out all wikis
+    Given I am at enwiki
+    When I log in with my global account as Selenium_user
+    And I log out
+    Then I am not logged in on commons or meta
diff --git a/features/step_definitions/login_sul_steps.rb 
b/features/step_definitions/login_sul_steps.rb
new file mode 100644
index 0000000..4815f83
--- /dev/null
+++ b/features/step_definitions/login_sul_steps.rb
@@ -0,0 +1,40 @@
+Given(/^I am at enwiki$/) do
+  visit(LoginPage)
+  @browser.url.should match Regexp.escape('//en.wikipedia')
+end
+
+When(/^I log in with my global account as (.+)$/) do |username|
+  on(LoginPage).login_with(username, @mediawiki_password)
+end
+
+When(/^I visit another wiki (.+)$/) do |wikiname|
+  new_wiki_url = @browser.url.sub("en", wikiname)
+  @browser.goto(new_wiki_url)
+end
+
+Then(/^I am logged in on the other wiki$/) do
+  on(MainPage).talk_element.should exist
+  on(MainPage).preferences_element.should exist
+  on(MainPage).logout_element.should exist
+  on(MainPage).login_element.should_not exist
+end
+
+When(/^I log out$/) do
+  on(MainPage).logout
+end
+
+Then(/^I am not logged in on (.+) or (.+)$/) do |wiki1, wiki2|
+  new_wiki_url = @browser.url.sub("en", wiki1)
+  @browser.goto(new_wiki_url)
+  on(MainPage).talk_element.should_not exist
+  on(MainPage).preferences_element.should_not exist
+  on(MainPage).logout_element.should_not exist
+  on(MainPage).login_element.should exist
+  new_wiki_url = @browser.url.sub(wiki1, wiki2)
+  @browser.goto(new_wiki_url)
+    on(MainPage).talk_element.should_not exist
+  on(MainPage).preferences_element.should_not exist
+  on(MainPage).logout_element.should_not exist
+  on(MainPage).login_element.should exist
+end
+
diff --git a/features/support/pages/main_page.rb 
b/features/support/pages/main_page.rb
index 5fc90ed..9f0627b 100644
--- a/features/support/pages/main_page.rb
+++ b/features/support/pages/main_page.rb
@@ -11,5 +11,9 @@
   end
   page_url url
 
+  a(:login, text:"Log in")
+  a(:logout, text:"Log out")
   a(:my_sandbox, text: "My sandbox")
+  a(:preferences, text:"Preferences")
+  a(:talk, text: "Talk")
 end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b32933042ae7d3fa87dcdb1c88e1a635cab38d5
Gerrit-PatchSet: 1
Gerrit-Project: qa/browsertests
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <[email protected]>

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

Reply via email to