2021-11-08 15:10:26 +01:00
|
|
|
describe('Page /blog', () => {
|
|
|
|
it('should displays the blog posts sorted from newest to oldest', () => {
|
|
|
|
cy.visit('/blog')
|
2021-11-09 15:14:31 +01:00
|
|
|
cy.get('[data-cy=blog-posts] [data-cy=blog-post-title]')
|
|
|
|
.last()
|
2021-12-04 15:52:51 +01:00
|
|
|
.should('have.text', '👋 Hello, world!')
|
2021-11-09 15:14:31 +01:00
|
|
|
cy.get('[data-cy=blog-posts] [data-cy=blog-post-description]')
|
|
|
|
.last()
|
|
|
|
.should(
|
|
|
|
'have.text',
|
|
|
|
'First post of the blog, introduction and explanation of how this blog is made.'
|
|
|
|
)
|
|
|
|
cy.get('[data-cy=blog-posts] [data-cy=blog-post-date]')
|
|
|
|
.last()
|
2021-12-04 15:52:51 +01:00
|
|
|
.should('have.text', '06/10/2021')
|
2021-11-08 15:10:26 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should redirect the user to the right blog post', () => {
|
|
|
|
cy.visit('/blog')
|
2021-11-09 15:14:31 +01:00
|
|
|
cy.get('[data-cy=blog-posts]')
|
|
|
|
.last()
|
2021-11-08 15:10:26 +01:00
|
|
|
.click()
|
|
|
|
.location('pathname')
|
|
|
|
.should('eq', '/blog/hello-world')
|
|
|
|
})
|
|
|
|
})
|