E2E: Perform first time onboarding via UI if presented for E2E tests

What does this MR do and why?

When a brand new self managed instance is deployed, and no groups exist a workflow is presented which invites the user to create their first group/project.

We have an E2E suite workaround to preseed a group, but this is not available in all environments if there is no admin access token available. In these cases, we should ensure to complete the workflow via the UI.

This exact scenario is something we encountered during the monthly release pipelines where new instances are deployed, which do not have a group, nor have a default admin token seeded.

With this change, we will have fallbacks to address this flow via the UI for environments that need this fallback.

References

Screenshots or screen recordings

How to set up and validate locally

# The workflow only happens on new instances, delete data to simulate this state
$ bundle exec rails console 
Project.delete_all; Group.delete_all; PersonalAccessToken.delete_all;  

# NB: To recreate the default testing personal access token if needed later
$ bundle exec rails runner db/fixtures/development/25_api_personal_access_token.rb

# 1) New, empty instance with no admin token.
#    Expect: the registration (onboarding) flow is completed via the UI, then a PAT is
#    created via the UI — the suite proceeds and the spec passes.
WEBDRIVER_HEADLESS=false bundle exec rspec qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb:67

# 2) Rerun without resetting. A group now exists, so the onboarding flow is no longer
#    presented, but the PAT is still created via the UI (still no admin token).
WEBDRIVER_HEADLESS=false bundle exec rspec qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb:67

# 3) Provide a valid admin token. 
#    Expect: the test bypasses both the onboarding flow and PAT creation.
WEBDRIVER_HEADLESS=false GITLAB_QA_ADMIN_ACCESS_TOKEN=VALID_TOKEN bundle exec rspec qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb:67

# 4) Provide an INVALID admin token (reset data first to also exercise onboarding):
#    Expect: "Failure/Error: raise InvalidTokenError, "API client validation failed! Code: #{resp.code}, Err: '#{resp.body}'""
WEBDRIVER_HEADLESS=false GITLAB_QA_ADMIN_ACCESS_TOKEN=not-a-real-token bundle exec rspec qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb:67

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by John McDonnell

Merge request reports

Loading