Commit 2e201c8d authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'nightly-25-fix-broken-saml-test' into 'master'

Fix SAML test failure due to random run order of specs

See merge request gitlab-org/gitlab-ee!7979
parents 21bfce0c 46b2e309
require 'rspec/core' require 'rspec/core'
require 'rspec/expectations'
require 'capybara/rspec' require 'capybara/rspec'
require 'capybara-screenshot/rspec' require 'capybara-screenshot/rspec'
require 'selenium-webdriver' require 'selenium-webdriver'
......
...@@ -23,9 +23,7 @@ module QA ...@@ -23,9 +23,7 @@ module QA
EE::Page::Group::SamlSSOSignIn.act { click_signin } EE::Page::Group::SamlSSOSignIn.act { click_signin }
Vendor::SAMLIdp::Page::Login.act { login } login_to_idp_if_required_and_expect_success
expect(page).to have_content("SAML for #{Runtime::Env.sandbox_name} was added to your connected accounts")
EE::Page::Group::Menu.act { go_to_saml_sso_group_settings } EE::Page::Group::Menu.act { go_to_saml_sso_group_settings }
...@@ -47,10 +45,16 @@ module QA ...@@ -47,10 +45,16 @@ module QA
click_test_button click_test_button
end end
Vendor::SAMLIdp::Page::Login.act { login } login_to_idp_if_required_and_expect_success
expect(page).to have_content("Test SAML SSO") expect(page).to have_content("Test SAML SSO")
end end
end end
def login_to_idp_if_required_and_expect_success
Vendor::SAMLIdp::Page::Login.perform { |login_page| login_page.login_if_required }
expect(page).to have_content("SAML for #{Runtime::Env.sandbox_name} was added to your connected accounts")
.or have_content("Signed in with SAML for #{Runtime::Env.sandbox_name}")
end
end end
end end
require 'rspec/core' require 'rspec/core'
require 'rspec/expectations'
module QA module QA
module Specs module Specs
......
...@@ -12,6 +12,14 @@ module QA ...@@ -12,6 +12,14 @@ module QA
fill_in 'password', with: 'user1pass' fill_in 'password', with: 'user1pass'
click_on 'Login' click_on 'Login'
end end
def login_if_required
login if login_required?
end
def login_required?
page.has_text?('Enter your username and password')
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment