diff options
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/project/settings/deploy_tokens.rb | 64 | ||||
-rw-r--r-- | qa/qa/page/project/settings/repository.rb | 6 |
2 files changed, 70 insertions, 0 deletions
diff --git a/qa/qa/page/project/settings/deploy_tokens.rb b/qa/qa/page/project/settings/deploy_tokens.rb new file mode 100644 index 00000000000..2d42372cbc5 --- /dev/null +++ b/qa/qa/page/project/settings/deploy_tokens.rb @@ -0,0 +1,64 @@ +module QA + module Page + module Project + module Settings + class DeployTokens < Page::Base + view 'app/views/projects/deploy_tokens/_form.html.haml' do + element :deploy_token_name + element :deploy_token_expires_at + element :deploy_token_read_repository + element :deploy_token_read_registry + element :create_deploy_token + end + + view 'app/views/projects/deploy_tokens/_new_deploy_token.html.haml' do + element :created_deploy_token_section + element :deploy_token_user + element :deploy_token + end + + def fill_token_name(name) + fill_element :deploy_token_name, name + end + + def fill_token_expires_at(expires_at) + fill_element :deploy_token_expires_at, expires_at.to_s + "\n" + end + + def fill_scopes(read_repository:, read_registry:) + check_element :deploy_token_read_repository if read_repository + check_element :deploy_token_read_registry if read_registry + end + + def add_token + click_element :create_deploy_token + end + + def token_username + within_new_project_deploy_token do + find_element(:deploy_token_user).value + end + end + + def token_password + within_new_project_deploy_token do + find_element(:deploy_token).value + end + end + + private + + def within_new_project_deploy_token + wait(reload: false) do + has_css?(element_selector_css(:created_deploy_token_section)) + end + + within_element(:created_deploy_token_section) do + yield + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 1ed5f455a85..53ebe28970b 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -24,6 +24,12 @@ module QA ProtectedBranches.perform(&block) end end + + def expand_deploy_tokens(&block) + expand_section(:deploy_tokens_settings) do + DeployTokens.perform(&block) + end + end end end end |