Commit 03bc47fc authored by Sanad Liaquat's avatar Sanad Liaquat

Reduce duplication, use .or on assertions

parent 1255b3dd
...@@ -23,14 +23,7 @@ module QA ...@@ -23,14 +23,7 @@ module QA
EE::Page::Group::SamlSSOSignIn.act { click_signin } EE::Page::Group::SamlSSOSignIn.act { click_signin }
Vendor::SAMLIdp::Page::Login.perform do |login_page| login_to_idp_if_required_and_expect_success
if login_page.login_required?
login_page.login
expect(page).to have_content("SAML for #{Runtime::Env.sandbox_name} was added to your connected accounts")
else
expect(page).to have_content("Signed in with SAML for #{Runtime::Env.sandbox_name}")
end
end
EE::Page::Group::Menu.act { go_to_saml_sso_group_settings } EE::Page::Group::Menu.act { go_to_saml_sso_group_settings }
...@@ -52,10 +45,18 @@ module QA ...@@ -52,10 +45,18 @@ module QA
click_test_button click_test_button
end end
Vendor::SAMLIdp::Page::Login.act { login_if_required } 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.act{ 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
...@@ -8,7 +8,7 @@ module QA ...@@ -8,7 +8,7 @@ module QA
Page::Main::Login.act { sign_in_with_saml } Page::Main::Login.act { sign_in_with_saml }
Vendor::SAMLIdp::Page::Login.act { login_if_required } Vendor::SAMLIdp::Page::Login.act { login }
expect(page).to have_content('Welcome to GitLab') expect(page).to have_content('Welcome to GitLab')
end end
......
require 'rspec/core' require 'rspec/core'
require 'rspec/expectations'
module QA module QA
module Specs module Specs
......
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