summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/features
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/features')
-rw-r--r--spec/support/shared_examples/features/code_highlight_shared_examples.rb13
-rw-r--r--spec/support/shared_examples/features/content_editor_shared_examples.rb3
-rw-r--r--spec/support/shared_examples/features/dashboard/sidebar_shared_examples.rb21
-rw-r--r--spec/support/shared_examples/features/reportable_note_shared_examples.rb2
4 files changed, 37 insertions, 2 deletions
diff --git a/spec/support/shared_examples/features/code_highlight_shared_examples.rb b/spec/support/shared_examples/features/code_highlight_shared_examples.rb
new file mode 100644
index 00000000000..3917ac9b489
--- /dev/null
+++ b/spec/support/shared_examples/features/code_highlight_shared_examples.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'code highlight' do
+ include PreferencesHelper
+
+ let_it_be(:current_user) { user }
+ let_it_be(:scheme_class) { user_color_scheme }
+
+ it 'has highlighted code', :js do
+ wait_for_requests
+ expect(subject).to have_selector(".js-syntax-highlight.#{scheme_class}")
+ end
+end
diff --git a/spec/support/shared_examples/features/content_editor_shared_examples.rb b/spec/support/shared_examples/features/content_editor_shared_examples.rb
index efdf7513b2d..6cd9c4ce1c4 100644
--- a/spec/support/shared_examples/features/content_editor_shared_examples.rb
+++ b/spec/support/shared_examples/features/content_editor_shared_examples.rb
@@ -4,7 +4,8 @@ RSpec.shared_examples 'edits content using the content editor' do
let(:content_editor_testid) { '[data-testid="content-editor"] [contenteditable].ProseMirror' }
def switch_to_content_editor
- find('[data-testid="toggle-editing-mode-button"] label', text: 'Rich text').click
+ click_button _('View rich text')
+ click_button _('Rich text')
end
def type_in_content_editor(keys)
diff --git a/spec/support/shared_examples/features/dashboard/sidebar_shared_examples.rb b/spec/support/shared_examples/features/dashboard/sidebar_shared_examples.rb
new file mode 100644
index 00000000000..efbd735c451
--- /dev/null
+++ b/spec/support/shared_examples/features/dashboard/sidebar_shared_examples.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples "a dashboard page with sidebar" do |page_path, menu_label|
+ before do
+ sign_in(user)
+ visit send(page_path)
+ end
+
+ let(:sidebar_css) { "aside.nav-sidebar[aria-label=\"Your work\"]" }
+ let(:active_menu_item_css) { "li.active[data-track-label=\"#{menu_label}_menu\"]" }
+
+ it "shows the \"Your work\" sidebar" do
+ expect(page).to have_css(sidebar_css)
+ end
+
+ it "shows the correct sidebar menu item as active" do
+ within(sidebar_css) do
+ expect(page).to have_css(active_menu_item_css)
+ end
+ end
+end
diff --git a/spec/support/shared_examples/features/reportable_note_shared_examples.rb b/spec/support/shared_examples/features/reportable_note_shared_examples.rb
index c35f711111b..9d859403465 100644
--- a/spec/support/shared_examples/features/reportable_note_shared_examples.rb
+++ b/spec/support/shared_examples/features/reportable_note_shared_examples.rb
@@ -36,7 +36,7 @@ RSpec.shared_examples 'reportable note' do |type|
dropdown.click_link('Report abuse to administrator')
expect(find('#user_name')['value']).to match(note.author.username)
- expect(find('#abuse_report_message')['value']).to match(noteable_note_url(note))
+ expect(find('#abuse_report_reported_from_url')['value']).to match(noteable_note_url(note))
end
def open_dropdown(dropdown)