diff --git a/packages/cypress/src/integration/research/list.spec.ts b/packages/cypress/src/integration/research/list.spec.ts new file mode 100644 index 0000000000..096767faba --- /dev/null +++ b/packages/cypress/src/integration/research/list.spec.ts @@ -0,0 +1,41 @@ +describe('[Research - List Articles]', () => { + const researchPageUrl = '/research' + + beforeEach(() => { + cy.visit(researchPageUrl) + }) + + it('[By Everyone - Lists all research articles]', () => { + cy.step('Verify page loads with research articles') + cy.get('[data-cy=ResearchList]').should('be.visible') + cy.get('[data-cy=ResearchListItem]').should('have.length.greaterThan', 0) + }) + + it('[Search Functionality - Filters articles]', () => { + const searchTerm = 'test' + + cy.step('Type a keyword into the search bar') + cy.get('[data-cy=research-search-box]').clear().type(searchTerm) + + cy.step('Verify filtered results are displayed') + cy.get('[data-cy=ResearchListItem]').should('have.length.at.least', 1) + }) + + it('[Pagination - Displays additional articles]', () => { + cy.step('Verify pagination is visible') + let itemCount + cy.get('[data-cy=ResearchListItem]').then((items) => { + itemCount = items.length + }) + cy.get('[data-cy=loadMoreButton]').should('be.visible') + cy.get('[data-cy=loadMoreButton]').click() + + cy.step('Verify additional articles are loaded') + cy.then(() => { + cy.get('[data-cy=ResearchListItem]').should( + 'have.length.greaterThan', + itemCount, + ) + }) + }) +}) diff --git a/src/pages/Research/Content/ResearchList.tsx b/src/pages/Research/Content/ResearchList.tsx index 6fa937f67c..e57fc42289 100644 --- a/src/pages/Research/Content/ResearchList.tsx +++ b/src/pages/Research/Content/ResearchList.tsx @@ -91,7 +91,10 @@ const ResearchList = observer(() => { /> {showDrafts ? ( -