diff --git a/cypress/e2e/blogSpec.cy.js b/cypress/e2e/blogSpec.cy.js new file mode 100644 index 0000000..777a610 --- /dev/null +++ b/cypress/e2e/blogSpec.cy.js @@ -0,0 +1,23 @@ +describe('Blogs', () => { + it('index route loads and shows blog card components', () => { + cy.visit('http://localhost:3000/blog'); + cy.get('.post-list-item'); + }); + + it('post route loads and displays a post', () => { + cy.visit('http://localhost:3000/blog'); + cy.get('.post-list-item a').first().click(); + cy.wait(5000); + cy.get('main'); + }); + + it('index next and prev buttons work', () => { + cy.visit('http://localhost:3000/blog'); + cy.get('.post-list-item a').first().click(); + cy.wait(5000); + cy.get('a').contains('next post', {matchCase: false}).click(); + cy.wait(5000); + cy.get('a').contains('previous post', {matchCase: false}).click(); + cy.get('main'); + }); +});