diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:08:57 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:08:57 +0000 |
commit | d8121cb00b8bbd281d7362902590b110639bdeba (patch) | |
tree | 0a0f71b247b232773a46732d9f74aa3cfed0ef1a /spec/support/shared_examples/features/navbar_shared_examples.rb | |
parent | 536aa3a1f4b96abc4ca34489bf2cbe503afcded7 (diff) | |
download | gitlab-ce-d8121cb00b8bbd281d7362902590b110639bdeba.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/features/navbar_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/features/navbar_shared_examples.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/spec/support/shared_examples/features/navbar_shared_examples.rb b/spec/support/shared_examples/features/navbar_shared_examples.rb index a963739878e..91a4048fa7c 100644 --- a/spec/support/shared_examples/features/navbar_shared_examples.rb +++ b/spec/support/shared_examples/features/navbar_shared_examples.rb @@ -1,20 +1,23 @@ # frozen_string_literal: true RSpec.shared_examples 'verified navigation bar' do + let(:expected_structure) do + structure.compact! + structure.each { |s| s[:nav_sub_items].compact! } + structure + end + it 'renders correctly' do - current_structure = page.find_all('.sidebar-top-level-items > li', class: ['!hidden']).map do |item| + current_structure = page.all('.sidebar-top-level-items > li', class: ['!hidden']).map do |item| nav_item = item.find_all('a').first.text.gsub(/\s+\d+$/, '') # remove counts at the end - nav_sub_items = item - .find_all('.sidebar-sub-level-items a') - .map(&:text) - .drop(1) # remove the first hidden item + nav_sub_items = item.all('.sidebar-sub-level-items > li', class: ['!fly-out-top-item']).map do |list_item| + list_item.all('a').first.text + end { nav_item: nav_item, nav_sub_items: nav_sub_items } end - structure.each { |s| s[:nav_sub_items].compact! } - - expect(current_structure).to eq(structure) + expect(current_structure).to eq(expected_structure) end end |