diff --git a/app/javascript/packs/homePage.jsx b/app/javascript/packs/homePage.jsx index cd69fb6c7..0e6d24ee0 100644 --- a/app/javascript/packs/homePage.jsx +++ b/app/javascript/packs/homePage.jsx @@ -47,12 +47,13 @@ function renderTagsFollowed(user = userData()) { function renderSidebar() { const sidebarContainer = document.getElementById('sidebar-wrapper-right'); + const { pathname } = window.location; // If the screen's width is less than 640 we don't need this extra data. if ( sidebarContainer && screen.width >= 640 && - window.location.pathname === '/' + (pathname === '/' || pathname === '/latest' || pathname.includes('/top/')) ) { window .fetch('/sidebars/home') diff --git a/cypress/integration/homeFeedFlows/feedNavigation.spec.js b/cypress/integration/homeFeedFlows/feedNavigation.spec.js index 034a49075..f3c6d833d 100644 --- a/cypress/integration/homeFeedFlows/feedNavigation.spec.js +++ b/cypress/integration/homeFeedFlows/feedNavigation.spec.js @@ -5,6 +5,8 @@ describe('Home Feed Navigation', () => { cy.get('@user').then((user) => { cy.loginUser(user).then(() => { + // Explicitly set the viewport to make sure we're in the full desktop view for these tests + cy.viewport('macbook-15'); cy.visit('/'); }); }); @@ -102,4 +104,40 @@ describe('Home Feed Navigation', () => { ); }); }); + + it('shows the sidebar on all feed views', () => { + // Default Feed view + cy.findByRole('heading', { name: '#tag1' }); + cy.findByRole('heading', { name: 'Listings' }); + + // Week view + cy.findByRole('link', { name: 'Week' }).click(); + cy.url().should('contain', '/top/week'); + cy.findByRole('heading', { name: '#tag1' }); + cy.findByRole('heading', { name: 'Listings' }); + + // Month view + cy.findByRole('link', { name: 'Month' }).click(); + cy.url().should('contain', '/top/month'); + cy.findByRole('heading', { name: '#tag1' }); + cy.findByRole('heading', { name: 'Listings' }); + + // Year view + cy.findByRole('link', { name: 'Year' }).click(); + cy.url().should('contain', '/top/year'); + cy.findByRole('heading', { name: '#tag1' }); + cy.findByRole('heading', { name: 'Listings' }); + + // Infinity view + cy.findByRole('link', { name: 'Infinity' }).click(); + cy.url().should('contain', '/top/infinity'); + cy.findByRole('heading', { name: '#tag1' }); + cy.findByRole('heading', { name: 'Listings' }); + + // Latest view + cy.findByRole('link', { name: 'Latest' }).click(); + cy.url().should('contain', '/latest'); + cy.findByRole('heading', { name: '#tag1' }); + cy.findByRole('heading', { name: 'Listings' }); + }); }); diff --git a/spec/support/seeds/seeds_e2e.rb b/spec/support/seeds/seeds_e2e.rb index 483aee0e4..8afa376f1 100644 --- a/spec/support/seeds/seeds_e2e.rb +++ b/spec/support/seeds/seeds_e2e.rb @@ -214,4 +214,7 @@ seeder.create_if_none(Tag) do moderator.add_role(:tag_moderator, tag) end +# Show the tag in the sidebar +Settings::General.sidebar_tags = %i[tag1] + ##############################################################################