Page MenuHomePhabricator

fix Login method for test2
Closed, ResolvedPublic

Description

Selenium_user is now a Global account.

Because of that, login at test2.wikipedia.org redirects to login.wikipedia.org before returning to test2. This is "SUL" I believe.

This breaks our idea of what visit() and on() mean in term of pages for logged-in users, and all of the tests that require @login for test2wiki now fail.

I have disabled the test2 builds until we can resolve how to login both with SUL and without.


Version: wmf-deployment
Severity: major
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=49708
https://bugzilla.wikimedia.org/show_bug.cgi?id=47843

Details

Reference
bz50130

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:00 AM
bzimport set Reference to bz50130.

Related URL: https://gerrit.wikimedia.org/r/70639 (Gerrit Change I6467cd14ce6a193c45a803c6798c176dcc7a444a)

Related URL: https://gerrit.wikimedia.org/r/70651 (Gerrit Change I69d102ad2d70d272e4a33eb5481f707162b7b2c3)

Still need to fix all @login tests for test2, e.g. math.feature

Chris said: "upload_wizard.feature, math.feature, visual_editor.feature never navigate to a testable page after logging in"

Failed tests on my machine:

$ bundle exec cucumber --tags @test2.wikipedia.org
Using the default profile...
---.......F............................................F-----........................................F----............F.F-----------------------------------...F-------

(::) failed steps (::)

expected "No file by this name exists.\nFile usage\nThere are no pages that link to this file." to match "No\\ file\\ by\\ this\\ name\\ exists,\\ but\\ you\\ can\\ upload\\ it\\." (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/page_steps.rb:28:in `/^page text should contain (.+)$/'
features/file.feature:12:in `Then page text should contain No file by this name exists, but you can upload it.'

unable to locate element, using {:text=>"Create source", :tag_name=>"a"} (Watir::Exception::UnknownObjectException)
(eval):1:in `process_watir_call'
./features/step_definitions/page_steps.rb:6:in `/^I click link Create$/'
./features/step_definitions/math_steps.rb:4:in `/^I am editing page that does not exist$/'
features/math_readonly.feature:7:in `And I am editing page that does not exist'

unable to locate element, using {:text=>"Date and time", :tag_name=>"a"} (Watir::Exception::UnknownObjectException)
(eval):1:in `process_watir_call'
./features/step_definitions/preferences_datetime_steps.rb:2:in `/^I click Date and time$/'
features/preferences_datetime_readonly.feature:8:in `And I click Date and time'

unable to locate element, using {:id=>"mwe-upwiz-tutorial", :tag_name=>"div"} (Watir::Exception::UnknownObjectException)
(eval):1:in `process_watir_call'
./features/step_definitions/upload_wizard_steps.rb:32:in `/^I navigate to Upload Wizard$/'
features/upload_wizard.feature:6:in `When I navigate to Upload Wizard'

unable to locate element, using {:text=>"Edit", :tag_name=>"a"} (Watir::Exception::UnknownObjectException)
(eval):1:in `process_watir_call'
./features/step_definitions/visual_editor_steps.rb:36:in `block (2 levels) in <top (required)>'
./features/step_definitions/visual_editor_steps.rb:35:in `/^I edit the page with a string$/'
features/visual_editor.feature:9:in `When I edit the page with a string'

Failing Scenarios:
cucumber features/file.feature:9 # Scenario: Logged-in user goes to file that does not exist
cucumber features/math_readonly.feature:5 # Scenario: Display simple math
cucumber features/preferences_datetime_readonly.feature:5 # Scenario: Preferences Date Time
cucumber features/upload_wizard.feature:8 # Scenario: Navigate to Learn page
cucumber features/visual_editor.feature:7 # Scenario: Basic edit

33 scenarios (5 failed, 4 skipped, 24 passed)
164 steps (5 failed, 51 skipped, 108 passed)
5m30.297s

Looks like the problem is that when the login form is submitted at http://test2.wikipedia.org/wiki/Special:UserLogin user is redirected to a secure page https://test2.wikipedia.org/wiki/Special:CentralLogin/complete

The tests then try to access http://test2.wikipedia.org/wiki/Special:UploadWizard but the user is not logged in via http but via https so "Not logged in" error page appears.

The fix is to set https MEDIAWIKI_URL:

export MEDIAWIKI_URL=https://test2.wikipedia.org/wiki/

Related URL: https://gerrit.wikimedia.org/r/70824 (Gerrit Change I9ca509a2ee549549540abe53e833a4367bf2a27d)

Change 70824 had a related patch set uploaded by Zfilipin:
Fix logging in for upload wizard tests

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

Change 70824 merged by Cmcmahon:
Fix logging in for upload wizard tests

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

I think we still need to fix this in the test2 Jenkins builds though.

Current status:

$ export MEDIAWIKI_URL=http://test2.wikipedia.org/wiki/
$ bundle exec cucumber --tags @test2.wikipedia.org
...
33 scenarios (14 failed, 19 passed)
164 steps (14 failed, 48 skipped, 102 passed)
10m27.891s

$ export MEDIAWIKI_URL=https://test2.wikipedia.org/wiki/
$ bundle exec cucumber --tags @test2.wikipedia.org
...
33 scenarios (7 failed, 26 passed)
164 steps (7 failed, 19 skipped, 138 passed)
11m20.188s

moving to https reduced the number of failed tests significantly

Change 70986 had a related patch set uploaded by Zfilipin:
Fix logging in at test2.wikipedia.org

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

Change 70986 merged by Cmcmahon:
Fix logging in at test2.wikipedia.org

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

Also see bug 49708, bug 47843