diff options
Diffstat (limited to 'qa/qa/tools/initialize_gitlab_auth.rb')
-rw-r--r-- | qa/qa/tools/initialize_gitlab_auth.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qa/qa/tools/initialize_gitlab_auth.rb b/qa/qa/tools/initialize_gitlab_auth.rb new file mode 100644 index 00000000000..b06ddcab040 --- /dev/null +++ b/qa/qa/tools/initialize_gitlab_auth.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require_relative '../../qa' + +module QA + module Tools + # Task to set default password from Runtime::Env.default_password if not set already + # Also creates a personal access token + # @example + # $ bundle exec rake 'initialize_gitlab_auth[http://gitlab.test]' + class InitializeGitLabAuth + attr_reader :address + + def initialize(address:) + @address = address + end + + def run + Runtime::Scenario.define(:gitlab_address, address) + + puts "Signing in and creating the default password for the root user if it's not set already..." + QA::Runtime::Browser.visit(:gitlab, QA::Page::Main::Login) + Flow::Login.sign_in + + puts "Creating an API scoped access token for the root user..." + puts "Token: #{Resource::PersonalAccessToken.fabricate!.access_token}" + end + end + end +end |