summaryrefslogtreecommitdiff
path: root/spec/support/helpers/features
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers/features')
-rw-r--r--spec/support/helpers/features/members_table_helpers.rb37
-rw-r--r--spec/support/helpers/features/releases_helpers.rb4
-rw-r--r--spec/support/helpers/features/web_ide_spec_helpers.rb41
3 files changed, 77 insertions, 5 deletions
diff --git a/spec/support/helpers/features/members_table_helpers.rb b/spec/support/helpers/features/members_table_helpers.rb
new file mode 100644
index 00000000000..5394e370900
--- /dev/null
+++ b/spec/support/helpers/features/members_table_helpers.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+module Spec
+ module Support
+ module Helpers
+ module Features
+ module MembersHelpers
+ def members_table
+ page.find('[data-testid="members-table"]')
+ end
+
+ def all_rows
+ page.within(members_table) do
+ page.all('tbody > tr')
+ end
+ end
+
+ def first_row
+ all_rows[0]
+ end
+
+ def second_row
+ all_rows[1]
+ end
+
+ def third_row
+ all_rows[2]
+ end
+
+ def invite_users_form
+ page.find('[data-testid="invite-users-form"]')
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/support/helpers/features/releases_helpers.rb b/spec/support/helpers/features/releases_helpers.rb
index 0d46918b05c..44087f71cfa 100644
--- a/spec/support/helpers/features/releases_helpers.rb
+++ b/spec/support/helpers/features/releases_helpers.rb
@@ -66,7 +66,7 @@ module Spec
focused_element.send_keys(:enter)
# Wait for the dropdown to be rendered
- page.find('.project-milestone-combobox .dropdown-menu')
+ page.find('.milestone-combobox .dropdown-menu')
# Clear any existing input
focused_element.attribute('value').length.times { focused_element.send_keys(:backspace) }
@@ -75,7 +75,7 @@ module Spec
focused_element.send_keys(milestone_title, :enter)
# Wait for the search to return
- page.find('.project-milestone-combobox .dropdown-item', text: milestone_title, match: :first)
+ page.find('.milestone-combobox .dropdown-item', text: milestone_title, match: :first)
focused_element.send_keys(:arrow_down, :arrow_down, :enter)
diff --git a/spec/support/helpers/features/web_ide_spec_helpers.rb b/spec/support/helpers/features/web_ide_spec_helpers.rb
index 123bd9b5070..12d3cecd052 100644
--- a/spec/support/helpers/features/web_ide_spec_helpers.rb
+++ b/spec/support/helpers/features/web_ide_spec_helpers.rb
@@ -22,6 +22,8 @@ module WebIdeSpecHelpers
click_link('Web IDE')
wait_for_requests
+
+ save_monaco_editor_reference
end
def ide_tree_body
@@ -36,8 +38,8 @@ module WebIdeSpecHelpers
".js-ide-#{mode}-mode"
end
- def ide_file_row_open?(row)
- row.matches_css?('.is-open')
+ def ide_folder_row_open?(row)
+ row.matches_css?('.folder.is-open')
end
# Creates a file in the IDE by expanding directories
@@ -63,6 +65,17 @@ module WebIdeSpecHelpers
ide_set_editor_value(content)
end
+ def ide_rename_file(path, new_path)
+ container = ide_traverse_to_file(path)
+
+ click_file_action(container, 'Rename/Move')
+
+ within '#ide-new-entry' do
+ find('input').fill_in(with: new_path)
+ click_button('Rename file')
+ end
+ end
+
# Deletes a file by traversing to `path`
# then clicking the 'Delete' action.
#
@@ -90,8 +103,22 @@ module WebIdeSpecHelpers
container
end
+ def ide_close_file(name)
+ within page.find('.multi-file-tabs') do
+ click_button("Close #{name}")
+ end
+ end
+
+ def ide_open_file(path)
+ row = ide_traverse_to_file(path)
+
+ ide_open_file_row(row)
+
+ wait_for_requests
+ end
+
def ide_open_file_row(row)
- return if ide_file_row_open?(row)
+ return if ide_folder_row_open?(row)
row.click
end
@@ -103,6 +130,10 @@ module WebIdeSpecHelpers
execute_script("monaco.editor.getModel('#{uri}').setValue('#{escape_javascript(value)}')")
end
+ def ide_set_editor_position(line, col)
+ execute_script("TEST_EDITOR.setPosition(#{{ lineNumber: line, column: col }.to_json})")
+ end
+
def ide_editor_value
editor = find('.monaco-editor')
uri = editor['data-uri']
@@ -149,4 +180,8 @@ module WebIdeSpecHelpers
wait_for_requests
end
end
+
+ def save_monaco_editor_reference
+ evaluate_script("monaco.editor.onDidCreateEditor(editor => { window.TEST_EDITOR = editor; })")
+ end
end