docbrown/spec/system/dashboards/user_scrolls_down_dashboard_follows_spec.rb
Ridhwana 5266dd1afb
Showing and hiding tags in the Following and Hidden Tags Pages (#19954)
* feat: remove updated weights

* feat: click on following on the following tags page

* feat: add and listen for the following button click

* fix: dropdowns

* feat: handle hide button click

* feat: update the nav link for following tags

* feat: handel the 'unhide button' on the hidden tags page

* feat: add the styling for the buttons

* feat: add localization

* feat: remove the brand from the card

* feat: add some styling to the page

* feat: init scrolling

* chore: update the name of the file

* feat: abstract out the comment fetch code

* fix: close the attribute

* feta: make some adjustments to where the tag adn the follow show up

* rename class from plural to singular

* feat: updae the comment

* feat: add a mutation observer to initialize the dropdown

* test: follow_craete

* chore: remove irrelevant test

* feat: update the cypress seeds

* feat: update the cypress seeds

* spec: write soem initial tests for the following tags page

* spec: update the unfollow cypress spec

* spec: update the hide cypress spec

* spec: update the posts published spec

* note to add test for pagination

* spec: hidden tags page

* feat: remove aria pressed attributes

* fix: ordering by explicit points gets the page params confused and returns the incorrect and not all results on pagination

* fix: use explicit points

* feat: remove the message at the top of the following and hidden tags page

* chore: remove comment and rather add it to the PR itself

* refactor: do all the actions on success

* feat: refactor the dashboard tag file

* refactor: only show the tagId and followId dataset attributes on the dashboard__tag__container

* feat: disconnect the observer

* chore: add some documentation

* feat: add fr localization

* chore: empty line

* fix: update the dashboardTags page to first declare the observer"
"
"

* fix: update the rails test

* Empty commit

* fix: because I added more tags, the dropdown was longre and covering the body of the editor hence it could not find the text, so I've escaped after selecting my tags
2023-08-25 14:49:39 +02:00

96 lines
2.7 KiB
Ruby

require "rails_helper"
RSpec.describe "Infinite scroll on dashboard", js: true do
let(:default_per_page) { 3 }
let(:total_records) { default_per_page * 2 }
let(:user) { create(:user) }
let!(:users) { create_list(:user, total_records) }
let!(:tags) { create_list(:tag, total_records) }
let!(:organizations) { create_list(:organization, total_records) }
let!(:podcasts) { create_list(:podcast, total_records) }
before do
sign_in user
end
context "when /dashboard/user_followers is visited" do
before do
users.each do |u|
create(:follow, follower: u, followable: user)
end
visit "/dashboard/user_followers?per_page=#{default_per_page}"
end
it "scrolls through all users" do
page.execute_script("window.scrollTo(0, 100000)")
page.assert_selector('div[id^="follows"]', count: total_records)
end
end
context "when /dashboard/following_tags is visited" do
before do
tags.each do |tag|
create(:follow, follower: user, followable: tag)
end
visit dashboard_following_tags_path(per_page: default_per_page)
page.execute_script("window.scrollTo(0, 100000)")
end
it "scrolls through all tags" do
page.assert_selector('div[id^="follows"]', count: total_records)
end
end
context "when /dashboard/following_users is visited" do
before do
users.each do |u|
create(:follow, follower: user, followable: u)
end
visit dashboard_following_users_path(per_page: default_per_page)
end
it "scrolls through all users" do
page.execute_script("window.scrollTo(0, 100000)")
page.assert_selector('div[id^="follows"]', count: total_records)
end
end
context "when /dashboard/following_organizations is visited" do
before do
organizations.each do |organization|
create(:follow, follower: user, followable: organization)
end
visit dashboard_following_organizations_path(per_page: default_per_page)
end
it "scrolls through all users" do
page.execute_script("window.scrollTo(0, 100000)")
page.assert_selector('div[id^="follows"]', count: total_records)
end
end
context "when /dashboard/following_podcasts is visited" do
before do
podcasts.each do |podcast|
create(:follow, follower: user, followable: podcast)
end
visit dashboard_following_podcasts_path(per_page: default_per_page)
page.execute_script("window.scrollTo(0, 100000)")
end
it "scrolls through all podcasts" do
page.assert_selector('div[id^="follows"]', count: total_records)
end
it "shows working links" do
podcasts.each do |podcast|
expect(page).to have_link(nil, href: "/#{podcast.path}")
end
end
end
end