Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/features/dashboard/sidebar_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/features/dashboard/sidebar_shared_examples.rb21
1 files changed, 21 insertions, 0 deletions
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