Commit 2023bd3b authored by Sanad Liaquat's avatar Sanad Liaquat

Remove duplication and update instance saml test

parent 1e1cc1bb
...@@ -23,7 +23,7 @@ module QA ...@@ -23,7 +23,7 @@ module QA
EE::Page::Group::SamlSSOSignIn.act { click_signin } EE::Page::Group::SamlSSOSignIn.act { click_signin }
Vendor::SAMLIdp::Page::Login.act { login } if page.has_text?('Enter your username and password') Vendor::SAMLIdp::Page::Login.act { login_if_required }
expect(page).to have_content("Signed in with SAML for #{Runtime::Env.sandbox_name}") expect(page).to have_content("Signed in with SAML for #{Runtime::Env.sandbox_name}")
...@@ -47,7 +47,7 @@ module QA ...@@ -47,7 +47,7 @@ module QA
click_test_button click_test_button
end end
Vendor::SAMLIdp::Page::Login.act { login } if page.has_text?('Enter your username and password') Vendor::SAMLIdp::Page::Login.act { login_if_required }
expect(page).to have_content("Test SAML SSO") expect(page).to have_content("Test SAML SSO")
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 } Vendor::SAMLIdp::Page::Login.act { login_if_required }
expect(page).to have_content('Welcome to GitLab') expect(page).to have_content('Welcome to GitLab')
end end
......
...@@ -7,7 +7,8 @@ module QA ...@@ -7,7 +7,8 @@ module QA
module SAMLIdp module SAMLIdp
module Page module Page
class Login < Page::Base class Login < Page::Base
def login def login_if_required
if page.has_text?('Enter your username and password')
fill_in 'username', with: 'user1' fill_in 'username', with: 'user1'
fill_in 'password', with: 'user1pass' fill_in 'password', with: 'user1pass'
click_on 'Login' click_on 'Login'
...@@ -16,4 +17,5 @@ module QA ...@@ -16,4 +17,5 @@ module QA
end end
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