summaryrefslogtreecommitdiff
path: root/spec/support/helpers/features
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/support/helpers/features
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/support/helpers/features')
-rw-r--r--spec/support/helpers/features/blob_spec_helpers.rb8
-rw-r--r--spec/support/helpers/features/invite_members_modal_helper.rb43
-rw-r--r--spec/support/helpers/features/runners_helpers.rb (renamed from spec/support/helpers/features/runner_helpers.rb)0
-rw-r--r--spec/support/helpers/features/source_editor_spec_helpers.rb5
4 files changed, 45 insertions, 11 deletions
diff --git a/spec/support/helpers/features/blob_spec_helpers.rb b/spec/support/helpers/features/blob_spec_helpers.rb
index 880a7249284..7ccfc9be7e2 100644
--- a/spec/support/helpers/features/blob_spec_helpers.rb
+++ b/spec/support/helpers/features/blob_spec_helpers.rb
@@ -11,12 +11,4 @@ module BlobSpecHelpers
def unset_default_button
set_default_button('')
end
-
- def editor_value
- evaluate_script('monaco.editor.getModels()[0].getValue()')
- end
-
- def set_editor_value(value)
- execute_script("monaco.editor.getModels()[0].setValue('#{value}')")
- end
end
diff --git a/spec/support/helpers/features/invite_members_modal_helper.rb b/spec/support/helpers/features/invite_members_modal_helper.rb
index b56ac5b32c6..d02ec06d886 100644
--- a/spec/support/helpers/features/invite_members_modal_helper.rb
+++ b/spec/support/helpers/features/invite_members_modal_helper.rb
@@ -11,7 +11,7 @@ module Spec
page.within invite_modal_selector do
select_members(names)
choose_options(role, expires_at)
- click_button 'Invite'
+ submit_invites
end
page.refresh if refresh
@@ -42,11 +42,15 @@ module Spec
click_button name
choose_options(role, expires_at)
- click_button 'Invite'
+ submit_invites
page.refresh
end
+ def submit_invites
+ click_button 'Invite'
+ end
+
def choose_options(role, expires_at)
unless role == 'Guest'
click_button 'Guest'
@@ -86,12 +90,47 @@ module Spec
"[data-token-id='#{id}']"
end
+ def more_invite_errors_button_selector
+ "[data-testid='accordion-button']"
+ end
+
+ def limited_invite_error_selector
+ "[data-testid='errors-limited-item']"
+ end
+
+ def expanded_invite_error_selector
+ "[data-testid='errors-expanded-item']"
+ end
+
def remove_token(id)
page.within member_token_selector(id) do
find('[data-testid="close-icon"]').click
end
end
+ def expect_to_have_successful_invite_indicator(page, user)
+ expect(page).to have_selector("#{member_token_selector(user.id)} .gl-bg-green-100")
+ expect(page).not_to have_text("#{user.name}: ")
+ end
+
+ def expect_to_have_invalid_invite_indicator(page, user, message: true)
+ expect(page).to have_selector("#{member_token_selector(user.id)} .gl-bg-red-100")
+ expect(page).to have_selector(member_token_error_selector(user.id))
+ expect(page).to have_text("#{user.name}: Access level should be greater than or equal to") if message
+ end
+
+ def expect_to_have_normal_invite_indicator(page, user)
+ expect(page).to have_selector(member_token_selector(user.id))
+ expect(page).not_to have_selector("#{member_token_selector(user.id)} .gl-bg-red-100")
+ expect(page).not_to have_selector("#{member_token_selector(user.id)} .gl-bg-green-100")
+ expect(page).not_to have_text("#{user.name}: ")
+ end
+
+ def expect_to_have_invite_removed(page, user)
+ expect(page).not_to have_selector(member_token_selector(user.id))
+ expect(page).not_to have_text("#{user.name}: Access level should be greater than or equal to")
+ end
+
def expect_to_have_group(group)
expect(page).to have_selector("[entity-id='#{group.id}']")
end
diff --git a/spec/support/helpers/features/runner_helpers.rb b/spec/support/helpers/features/runners_helpers.rb
index 63fc628358c..63fc628358c 100644
--- a/spec/support/helpers/features/runner_helpers.rb
+++ b/spec/support/helpers/features/runners_helpers.rb
diff --git a/spec/support/helpers/features/source_editor_spec_helpers.rb b/spec/support/helpers/features/source_editor_spec_helpers.rb
index cdc59f9cbe1..f7eb2a52507 100644
--- a/spec/support/helpers/features/source_editor_spec_helpers.rb
+++ b/spec/support/helpers/features/source_editor_spec_helpers.rb
@@ -12,8 +12,11 @@ module Spec
def editor_set_value(value)
editor = find('.monaco-editor')
uri = editor['data-uri']
+ execute_script("localMonaco.getModel('#{uri}').setValue('#{escape_javascript(value)}')")
- execute_script("monaco.editor.getModel('#{uri}').setValue('#{escape_javascript(value)}')")
+ # We only check that the first line is present because when the content is long,
+ # only a part of the text will be rendered in the DOM due to scrolling
+ page.has_selector?('.gl-source-editor .view-lines', text: value.lines.first)
end
end
end