Skip to content

Commit

Permalink
Adapt watchlist feature beta tests
Browse files Browse the repository at this point in the history
Co-authored-by: David Kang <dkang@suse.com>
  • Loading branch information
eduardoj and David Kang committed May 11, 2020
1 parent 3b446e1 commit 779899a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/api/spec/features/beta/webui/watchlists_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@
visit project_show_path(user.home_project)

click_on('Watchlist')
expect(page).to have_content('List of projects you are watching')
expect(page).to have_css('a.dropdown-item.project-link', count: 0)
expect(page).to have_content('Projects you are watching')
expect(page).to have_css('.list-group .list-group-item', count: 0)

expect(page).to have_css('#toggle-watch', text: 'Add this project to Watchlist')
expect(page).to have_css('#toggle-watch', text: 'Watch this project')
find('#toggle-watch').click

click_on('Watchlist')
expect(page).to have_css('a.dropdown-item.project-link', text: user.home_project_name)
expect(page).to have_css('a.dropdown-item.project-link', count: 1)
expect(page).to have_css('.list-group .list-group-item a', text: user.home_project_name)
expect(page).to have_css('.list-group .list-group-item', count: 1)

visit project_show_path(project: project.name)
click_on('Watchlist')
expect(page).to have_css('#toggle-watch', text: 'Add this project to Watchlist')
expect(page).to have_css('#toggle-watch', text: 'Watch this project')
find('#toggle-watch').click

click_on('Watchlist')
expect(page).to have_css('a.dropdown-item.project-link', text: user.home_project_name)
expect(page).to have_css('a.dropdown-item.project-link', text: project.name)
expect(page).to have_css('a.dropdown-item.project-link', count: 2)
expect(page).to have_css('.list-group .list-group-item a', text: user.home_project_name)
expect(page).to have_css('.list-group .list-group-item a', text: project.name)
expect(page).to have_css('.list-group .list-group-item', count: 2)
end

scenario 'remove projects from watchlist' do
login user_with_watched_project
visit project_show_path(project: 'brian_s_watched_project')

click_on('Watchlist')
expect(page).to have_content('List of projects you are watching')
expect(page).to have_css('a.dropdown-item.project-link', text: 'brian_s_watched_project')
expect(page).to have_css('a.dropdown-item.project-link', count: 1)
expect(page).to have_content('Projects you are watching')
expect(page).to have_css('.list-group .list-group-item a', text: 'brian_s_watched_project')
expect(page).to have_css('.list-group .list-group-item', count: 1)
expect(page).to have_css('#toggle-watch', text: 'Remove this project from Watchlist')

find('#toggle-watch').click

visit project_show_path(project: 'brian_s_watched_project')
click_on('Watchlist')
expect(page).to have_css('a.dropdown-item.project-link', count: 0)
expect(page).to have_css('#toggle-watch', text: 'Add this project to Watchlist')
expect(page).to have_css('.list-group .list-group-item', count: 0)
expect(page).to have_css('#toggle-watch', text: 'Watch this project')
end
end

0 comments on commit 779899a

Please sign in to comment.