Unable to bypass SSO with Selenium tests
Apologies in advance if I'm posting this in the wrong place and if my post isn't totally making sense.
My issue: gitlab-qa is failing and generating PageValidationError due to Okta SSO.
About me:
I'm new to Gitlab-QA. I'm installed gitlab-qa via the GDK is because I was never able to get the other installation method to work (installing the ruby gem, gem install gitlab-qa
) https://gitlab.com/gitlab-org/gitlab-qa#how-can-you-use-it.
I've read as much of the documentation as I could find on Gitlab-QA orchestrator but still feel like I barely have a clue on how to use it. I would love to receive more detailed guidance on how to set up GDK and gitlab-qa and how to hack through my problem in a more efficient manner.
My setup: I'm running gitlab-qa against a live gitlab instance in a non-prod environment with the following command:
~/projects/gitlab-development-kit/gitlab/qa git:(master)$ bundle exec bin/qa Test::Instance::All "https://mygitlaburl/users/sign_in?auto_sign_in=false"
and environment variables:
export GITLAB_USERNAME=testuser
export GITLAB_PASSWORD=blahpassword
I have the following issues:
- My gitlab environment uses SSO -- so I tried to bypass it by adding
auto_sign_in=false
to my gitlab instance's URL. But that doesn’t seem to be working. Since SSO is enabled, the automated test gets authenticated with my local credentials instead of the environment variables.
So the test session fails with PageValidationError.
gitlab-qa log output
warning: parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.7. Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri. 2022-12-16 15:28:17 / CONF :: ==> Base URL: https://mygitlaburl/users/sign_in?auto_sign_in=false ==> Browser: # ==> Libraries: Chemlab::Vendor [Dec 16 2022 15:28:17 PST (QA Tests)] INFO -- Performing sanity check for environment! [Dec 16 2022 15:31:28 PST (QA Tests)] INFO -- Saving screenshot.. [Dec 16 2022 15:31:29 PST (QA Tests)] ERROR -- Screenshot: ~/projects/gitlab-development-kit/gitlab/qa/tmp/screenshot_2022-12-16-15-31-28.387.png [Dec 16 2022 15:31:29 PST (QA Tests)] ERROR -- HTML capture: ~/projects/gitlab-development-kit/gitlab/qa/tmp/screenshot_2022-12-16-15-31-28.387.html bundler: failed to load command: bin/qa (bin/qa) QA::Page::Validatable::PageValidationError: login_page did not appear on QA::Page::Main::Login as expected ~/projects/gitlab-development-kit/gitlab/qa/qa/page/validatable.rb:15:in `block in validate_elements_present!' ~/projects/gitlab-development-kit/gitlab/qa/qa/page/validatable.rb:13:in `each' ~/projects/gitlab-development-kit/gitlab/qa/qa/page/validatable.rb:13:in `validate_elements_present!' ~/projects/gitlab-development-kit/gitlab/qa/qa/runtime/browser.rb:236:in `perform' ~/projects/gitlab-development-kit/gitlab/qa/qa/runtime/browser.rb:41:in `visit' ~/projects/gitlab-development-kit/gitlab/qa/qa/runtime/browser.rb:45:in `visit' ~/projects/gitlab-development-kit/gitlab/qa/qa/ce/strategy.rb:23:in `block in perform_before_hooks' ~/projects/gitlab-development-kit/gitlab/qa/qa/support/retrier.rb:20:in `block in retry_on_exception' ~/projects/gitlab-development-kit/gitlab/qa/qa/support/repeater.rb:46:in `repeat_until' ~/projects/gitlab-development-kit/gitlab/qa/qa/support/retrier.rb:12:in `retry_on_exception' ~/projects/gitlab-development-kit/gitlab/qa/qa/ce/strategy.rb:22:in `perform_before_hooks' ~/projects/gitlab-development-kit/gitlab/qa/qa/ee/strategy.rb:9:in `perform_before_hooks' ~/projects/gitlab-development-kit/gitlab/qa/qa/runtime/release.rb:25:in `public_send' ~/projects/gitlab-development-kit/gitlab/qa/qa/runtime/release.rb:25:in `method_missing' ~/projects/gitlab-development-kit/gitlab/qa/qa/scenario/template.rb:40:in `perform' ~/projects/gitlab-development-kit/gitlab/qa/qa/scenario/template.rb:10:in `block in perform' ~/projects/gitlab-development-kit/gitlab/qa/qa/scenario/template.rb:8:in `tap' ~/projects/gitlab-development-kit/gitlab/qa/qa/scenario/template.rb:8:in `perform' ~/projects/gitlab-development-kit/gitlab/qa/qa/scenario/bootable.rb:52:in `launch!' bin/qa:22:in `'- I thought I might be able to get around this issue by forcing an incognito session. To do this, I updated the browser.rb file with
capabilities['goog:chromeOptions'] = {
'args' => [
'--incognito',
]
}
But even with the chrome session in incognito mode, it still does the SSO pass-thru with my local credentials.
- Guessing this might be an issue with the behavior of Chrome, I was able to figure out how to get Selenium to launch the test using Firefox instead of Chrome with headless disabled. Although it fails to do the SSO pass-thru, I just paste
https://mygitlaburl/users/sign_in?auto_sign_in=false
into the URL window and the tests actually get initiated. But I'm still a sad panda because the tests immediately fail with the errorSelenium::WebDriver::Error::NoSuchWindowError