summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 15:09:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 15:09:30 +0000
commitc6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (patch)
tree967afee9a510ff9dd503ebd83706dc760ec2e3ed /qa
parent903ccf7c93eb9490c76857bffe744249cc07de09 (diff)
downloadgitlab-ce-c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/profile/personal_access_tokens.rb10
-rw-r--r--qa/qa/resource/personal_access_token.rb4
2 files changed, 14 insertions, 0 deletions
diff --git a/qa/qa/page/profile/personal_access_tokens.rb b/qa/qa/page/profile/personal_access_tokens.rb
index 6108fb4d93b..7069e7d3e4f 100644
--- a/qa/qa/page/profile/personal_access_tokens.rb
+++ b/qa/qa/page/profile/personal_access_tokens.rb
@@ -1,10 +1,13 @@
# frozen_string_literal: true
+require 'date'
+
module QA
module Page
module Profile
class PersonalAccessTokens < Page::Base
view 'app/views/shared/_personal_access_tokens_form.html.haml' do
+ element :expiry_date_field
element :personal_access_token_name_field
element :create_token_button
end
@@ -36,6 +39,13 @@ module QA
find_element(:created_personal_access_token, wait: 30).value
end
+ def fill_expiry_date(date)
+ date = date.to_s if date.is_a?(Date)
+ Date.strptime(date, '%Y-%m-%d') rescue ArgumentError raise "Expiry date must be in YYYY-MM-DD format"
+
+ fill_element(:expiry_date_field, date)
+ end
+
def has_token_row_for_name?(token_name)
page.has_css?('tr', text: token_name, wait: 1.0)
end
diff --git a/qa/qa/resource/personal_access_token.rb b/qa/qa/resource/personal_access_token.rb
index 3b61b3f337c..488138326df 100644
--- a/qa/qa/resource/personal_access_token.rb
+++ b/qa/qa/resource/personal_access_token.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require 'date'
+
module QA
module Resource
##
@@ -19,6 +21,8 @@ module QA
Page::Profile::PersonalAccessTokens.perform do |token_page|
token_page.fill_token_name(name || 'api-test-token')
token_page.check_api
+ # Expire in 2 days just in case the token is created just before midnight
+ token_page.fill_expiry_date(Date.today + 2)
token_page.click_create_token_button
end
end