Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Dec 22, 2023
1 parent 821e425 commit d0483bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
25 changes: 12 additions & 13 deletions cypress/e2e/insights.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,31 @@ describe('Insights', () => {
const startingName = randomString('starting-value-')
const editedName = randomString('edited-value-')
createInsight(startingName)
cy.get('[data-attr="insight-name"]').should('contain', startingName)
cy.get('[data-attr="top-bar-name"]').should('contain', startingName)

cy.get('[data-attr="insight-name"] [data-attr="edit-prop-name"]').click()
cy.get('[data-attr="insight-name"] input').type(editedName)
cy.get('[data-attr="insight-name"] [title="Save"]').click()
cy.get('[data-attr="top-bar-name"] button').click()
cy.get('[data-attr="top-bar-name"] input').clear().type(editedName)
cy.get('[data-attr="top-bar-name"] [title="Save"]').click()

cy.get('[data-attr="insight-name"]').should('contain', editedName)
cy.get('[data-attr="top-bar-name"]').should('contain', editedName)

savedInsights.checkInsightIsInListView(editedName)
})

it('Can undo a change of insight name', () => {
createInsight('starting value')
cy.get('[data-attr="insight-name"]').should('contain', 'starting value')
cy.get('[data-attr="top-bar-name"]').should('contain', 'starting value')

cy.get('[data-attr="insight-name"]').scrollIntoView()
cy.get('[data-attr="insight-name"] [data-attr="edit-prop-name"]').click({ force: true })
cy.get('[data-attr="insight-name"] input').type('edited value')
cy.get('[data-attr="insight-name"] [title="Save"]').click()
cy.get('[data-attr="top-bar-name"] button').click({ force: true })
cy.get('[data-attr="top-bar-name"] input').clear().type('edited value')
cy.get('[data-attr="top-bar-name"] [title="Save"]').click()

cy.get('[data-attr="insight-name"]').should('contain', 'edited value')
cy.get('[data-attr="top-bar-name"]').should('contain', 'edited value')

cy.get('[data-attr="edit-insight-undo"]').click()

cy.get('[data-attr="insight-name"]').should('not.contain', 'edited value')
cy.get('[data-attr="insight-name"]').should('contain', 'starting value')
cy.get('[data-attr="top-bar-name"]').should('not.contain', 'edited value')
cy.get('[data-attr="top-bar-name"]').should('contain', 'starting value')

savedInsights.checkInsightIsInListView('starting value')
})
Expand Down
6 changes: 3 additions & 3 deletions cypress/productAnalytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export const insight = {
},
editName: (insightName: string): void => {
if (insightName) {
cy.get('[data-attr="insight-name"] [data-attr="edit-prop-name"]').click()
cy.get('[data-attr="insight-name"] input').type(insightName)
cy.get('[data-attr="insight-name"] [title="Save"]').click()
cy.get('[data-attr="top-bar-name"] button').click()
cy.get('[data-attr="top-bar-name"] input').clear().type(insightName)
cy.get('[data-attr="top-bar-name"] [title="Save"]').click()
}
},
save: (): void => {
Expand Down

0 comments on commit d0483bc

Please sign in to comment.