Expose a bug: wrong redirect on Post#create

1/2 cucumber tests are green. The reason why the first test does not
succeed reliably is that the frontend redirects to a wrong URL after you
create the post. It's the slug of the first created post. I want to be
redirected to the slug of the created post.

CC @appinteractive please fix
This commit is contained in:
Robert Schäfer 2019-02-15 16:03:21 +01:00
parent ba5159b70c
commit a58861427b
2 changed files with 11 additions and 10 deletions

View File

@ -21,4 +21,4 @@ Feature: Create a post
Scenario: See a post on the landing page
Given I previously created a post
Then the post shows up on the landing page
Then the post shows up on the landing page at position 1

View File

@ -116,19 +116,20 @@ Given('I previously created a post', () => {
})
When('I choose {string} as the title of the post', (title) => {
lastPost.title = title
cy.get('input[name="title"]').type(title)
lastPost.title = title.replace('\n', ' ')
cy.get('input[name="title"]').type(lastPost.title)
})
When('I type in the following text:', (text) => {
lastPost.text = text
cy.get('.ProseMirror').type(text)
lastPost.text = text.replace('\n', ' ')
cy.get('.ProseMirror').type(lastPost.text)
})
Then('the post shows up on the landing page', () => {
Then('the post shows up on the landing page at position {int}', (index) => {
cy.openPage('landing')
cy.get('.ds-container').should('contain', lastPost.title)
cy.get('.ds-container').should('contain', lastPost.text)
const selector = `:nth-child(${index}) > .ds-card > .ds-card-content`
cy.get(selector).should('contain', lastPost.title)
cy.get(selector).should('contain', lastPost.text)
})
Then('I get redirected to {string}', (route) => {
@ -136,6 +137,6 @@ Then('I get redirected to {string}', (route) => {
})
Then('the post was saved successfully', () => {
cy.get('.post-card').should('contain', lastPost.title)
cy.get('.post-card').should('contain', lastPost.text)
cy.get('.ds-card-header > .ds-heading').should('contain', lastPost.title)
cy.get('.content').should('contain', lastPost.text)
})