Skip to content

Commit

Permalink
deduplicate articles in the latest news river
Browse files Browse the repository at this point in the history
  • Loading branch information
walsh9 committed Jan 16, 2025
1 parent 8eb1cf8 commit 891b675
Show file tree
Hide file tree
Showing 6 changed files with 3,051 additions and 25,151 deletions.
29 changes: 19 additions & 10 deletions cypress/e2e/index.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('The home page', () => {
fields: 'ancestry,description,lead_asset,legacy_id,listing_image,publication_date,show_as_feature,sponsored_content,tags,updated_date,url,uuid,listing_title,listing_summary,related_authors',
order: '-publication_date',
show_on_index_listing: 'true',
limit: '6',
limit: '16',
},
}, { fixture: 'aviary/latest.json' }).as('latest')
cy.intercept({
Expand All @@ -20,8 +20,8 @@ describe('The home page', () => {
fields: 'ancestry,description,lead_asset,legacy_id,listing_image,publication_date,show_as_feature,sponsored_content,tags,updated_date,url,uuid,listing_title,listing_summary,related_authors',
order: '-publication_date',
show_on_index_listing: 'true',
limit: '6',
offset: '6',
limit: '10',
offset: '16',
},
}, { fixture: 'aviary/index-more.json' }).as('indexMore')
cy.intercept({
Expand All @@ -36,19 +36,19 @@ describe('The home page', () => {
cy.get('.homepage-topper .gothamist-card:not(.hidden)').should('have.length', 6)
cy.get('.homepage-topper .gothamist-card:not(.hidden)').eq(5).should('have.attr', 'id', 'ntv-latest-1')
cy.get('.newsletter-home').should('exist')
cy.get('.center-feature').should('exist')
cy.get('.center-feature .gothamist-card:not(.hidden)').should('have.length', 6)
// cy.get('.center-feature').should('exist')
// cy.get('.center-feature .gothamist-card:not(.hidden)').should('have.length', 6)
cy.get('.left-feature').should('exist')
cy.get('.left-feature .gothamist-card:not(.hidden)').should('have.length', 4)
cy.get('.left-feature .gothamist-card:not(.hidden)').should('have.length', 5)
cy.get('.boroughs').should('exist')
cy.get('#ntv-stream-2').should('exist')
cy.get('#articleList').should('exist')
cy.get('#articleList .gothamist-card:not(.hidden)').should('have.length', 6)
cy.get('#articleList .gothamist-card:not(.hidden)').should('have.length', 10)
cy.get('#articleList .gothamist-card:not(.hidden)').eq(1).should('have.attr', 'id', 'ntv-stream-3')
})
it('displays cards correctly', () => {
cy.visit('/')
cy.wait('@latest')
cy.wait(['@index', '@latest'])
cy.get('.gothamist-card').first().find('.image-with-caption').should('exist')
cy.get('.gothamist-card').first().find('.card-title .h2').first().should('not.be.empty')
cy.get('.gothamist-card').first().find('.card-slot').first().should('not.be.empty')
Expand All @@ -60,10 +60,10 @@ describe('The home page', () => {
})
it('loads more', () => {
cy.visit('/')
cy.wait('@latest')
cy.wait(['@index', '@latest'])
cy.contains('Load More').trigger('mouseover').click()
cy.wait('@indexMore')
cy.get('#articleList .gothamist-card').should('have.length', 12)
cy.get('#articleList .gothamist-card').should('have.length', 20)
cy.get('#articleList .card-title-link').eq(6).should('have.focus')
})
it('hides and shows the fixed header', () => {
Expand All @@ -76,6 +76,15 @@ describe('The home page', () => {
cy.wait(400)
cy.get('.fixed-header').should('not.exist')
})
it('does not duplicate articles in latest news', () => {
cy.visit('/')
cy.wait(['@index', '@latest'])
cy.get('.homepage-topper .gothamist-card:not(.hidden)').should('have.length', 6)
cy.get('.homepage-topper .gothamist-card:not(.hidden)').eq(5).should('have.attr', 'id', 'ntv-latest-1')
cy.get('#articleList').should('exist')
cy.get('#articleList .gothamist-card:not(.hidden)').should('have.length', 10)
cy.get('#articleList .gothamist-card:not(.hidden)').eq(1).should('have.attr', 'id', 'ntv-stream-3')
})
it('has no detectable a11y violations on load', () => {
cy.visit('/')
cy.wait(['@index', '@latest'])
Expand Down
Loading

0 comments on commit 891b675

Please sign in to comment.