jenkins-bot has submitted this change and it was merged. Change subject: Browser test: fix log in Selenium tests ......................................................................
Browser test: fix log in Selenium tests LoginPage is removed from mediawiki_selenium Ruby gem. This repository is the only repository that needs it, so the file is copied here. Also, user used to be logged in via the API, not really testing if log in via the web site works. It is fixed now. Bug: T127042 Change-Id: Iff85d66a9a6d3343c212fe648c589539e889a313 --- M tests/browser/features/login.feature M tests/browser/features/step_definitions/login_steps.rb A tests/browser/features/support/pages/login_page.rb 3 files changed, 32 insertions(+), 1 deletion(-) Approvals: Hashar: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/browser/features/login.feature b/tests/browser/features/login.feature index 2cb6356..7ed66a0 100644 --- a/tests/browser/features/login.feature +++ b/tests/browser/features/login.feature @@ -27,5 +27,5 @@ @login Scenario: Log in with valid credentials - When I am logged in + When I log in Then error box should not be visible diff --git a/tests/browser/features/step_definitions/login_steps.rb b/tests/browser/features/step_definitions/login_steps.rb index bff5bdd..788bfc4 100644 --- a/tests/browser/features/step_definitions/login_steps.rb +++ b/tests/browser/features/step_definitions/login_steps.rb @@ -13,6 +13,10 @@ visit LoginPage end +When(/^I log in$/) do + on(LoginPage).login_with(user, password, false) +end + When(/^I log in with incorrect password$/) do on(LoginPage).login_with(user, 'incorrect password', false) 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..8ef1e44 --- /dev/null +++ b/tests/browser/features/support/pages/login_page.rb @@ -0,0 +1,27 @@ +require 'page-object' + +class LoginPage + include PageObject + + page_url 'Special:UserLogin' + + div(:feedback, class: 'errorbox') + button(:login, id: 'wpLoginAttempt') + li(:logout, id: 'pt-logout') + text_field(:password, id: 'wpPassword1') + a(:password_strength, text: 'password strength') + a(:phishing, text: 'phishing') + text_field(:username, id: 'wpName1') + a(:username_displayed, title: /Your user page/) + + def logged_in_as_element + @browser.div(id: 'mw-content-text').p.b + end + + def login_with(username, password, wait_for_logout_element = true) + username_element.when_present.send_keys(username) + password_element.when_present.send_keys(password) + login_element.when_present.click + logout_element.when_present(10) if wait_for_logout_element + end +end -- To view, visit https://gerrit.wikimedia.org/r/270932 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iff85d66a9a6d3343c212fe648c589539e889a313 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Zfilipin <zfili...@wikimedia.org> Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org> Gerrit-Reviewer: Hashar <has...@free.fr> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits