Skip to content

Commit 8a735a9

Browse files
fix(cy): format test with actions in overflow menu
Signed-off-by: Max <[email protected]>
1 parent 7c9517c commit 8a735a9

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

cypress/e2e/workspace.spec.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ describe('Workspace', function() {
8181
]
8282
cy.getContent().click()
8383
buttons.forEach(([button, tag]) => testButtonUnselected(button, tag))
84-
cy.getContent().type('Format me{selectall}')
84+
// format is gone when text is gone
85+
cy.getContent().type('Format me')
86+
cy.getContent().find('s')
87+
.should('not.exist')
88+
cy.getContent()
89+
.should('contain', 'Format me')
90+
cy.getContent().type('{selectall}')
8591
buttons.forEach(([button, tag]) => testButton(button, tag, 'Format me'))
8692
})
8793

@@ -303,13 +309,15 @@ const openSidebar = filename => {
303309
* @param {string} content Content expected in the element.
304310
*/
305311
function testButton(button, tag, content) {
306-
cy.getMenuEntry(button).click()
307-
cy.getMenuEntry(button).should('have.class', 'is-active')
312+
cy.getMenuEntry(button)
313+
.should('not.have.class', 'is-active')
314+
.click()
308315
cy.getContent()
309316
.find(`${tag}`)
310317
.should('contain', content)
311-
cy.getMenuEntry(button).click()
312-
cy.getMenuEntry(button).should('not.have.class', 'is-active')
318+
cy.getMenuEntry(button)
319+
.should('have.class', 'is-active')
320+
.click()
313321
}
314322

315323
/**
@@ -318,16 +326,11 @@ function testButton(button, tag, content) {
318326
* @param {string} tag Html tag expected to be toggled.
319327
*/
320328
function testButtonUnselected(button, tag) {
321-
cy.getMenuEntry(button).click()
322-
cy.getMenuEntry(button).should('have.class', 'is-active')
323-
cy.getContent().type('Format me{selectall}')
329+
cy.getMenuEntry(button)
330+
.should('not.have.class', 'is-active')
331+
.click()
332+
cy.getContent().type('Format me')
324333
cy.getContent().find(`${tag}`)
325-
.should('contain', 'Format me').type('{del}')
326-
cy.getMenuEntry(button).click()
327-
cy.getMenuEntry(button).should('have.class', 'is-active').click()
328-
cy.getMenuEntry(button).should('not.have.class', 'is-active')
329-
cy.getContent().type('Format me{selectall}')
330-
cy.getMenuEntry(button).find(`${tag}`)
331-
.should('not.exist')
332-
cy.getContent().type('{del}')
334+
.should('contain', 'Format me')
335+
cy.getContent().type('{selectall}{del}')
333336
}

0 commit comments

Comments
 (0)