Skip to content

Commit

Permalink
fix: Avoid further cypress command chaining
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Aug 29, 2023
1 parent e01f4cb commit 9d85c56
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
2 changes: 2 additions & 0 deletions cypress/e2e/MenuBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('Test the rich text editor menu bar', function() {
cy.getFile(fileName)
.then($el => {
cy.clearContent()
cy.getContent()
.type(' Hello ')
cy.getActionEntry('remain')
.click()
Expand All @@ -54,6 +55,7 @@ describe('Test the rich text editor menu bar', function() {
cy.getFile(fileName)
.then($el => {
cy.clearContent()
cy.getContent()
.type('Hello \nworld')
cy.getActionEntry('remain')
.click()
Expand Down
26 changes: 12 additions & 14 deletions cypress/e2e/nodes/FrontMatter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,22 @@ describe('Front matter support', function() {
})

it('Add front matter', function() {
cy.openFile('empty.md').clearContent().then(() => {
cy.getContent().type('---')
cy.getContent().type('test')
cy.getContent().find('pre.frontmatter').should(pre => {
expect(pre.length === 1)
expect(pre[0].text === 'test')
})
cy.openFile('empty.md').clearContent()
cy.getContent().type('---')
cy.getContent().type('test')
cy.getContent().find('pre.frontmatter').should(pre => {
expect(pre.length === 1)
expect(pre[0].text === 'test')
})
})

it('Do not add multiple front matter', function() {
cy.openFile('empty.md').clearContent().then(() => {
cy.getContent().type('---test')
cy.getContent().type('{downArrow}')
cy.getContent().type('---test')
cy.getContent().find('pre.frontmatter').should(pre => expect(pre.length === 1))
cy.getContent().find('hr').should(hr => expect(hr.length === 1))
})
cy.openFile('empty.md').clearContent()
cy.getContent().type('---test')
cy.getContent().type('{downArrow}')
cy.getContent().type('---test')
cy.getContent().find('pre.frontmatter').should(pre => expect(pre.length === 1))
cy.getContent().find('hr').should(hr => expect(hr.length === 1))
})

it('Reopen front matter', function() {
Expand Down
3 changes: 3 additions & 0 deletions cypress/e2e/nodes/Links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('test link marks', function() {

const link = `${Cypress.env('baseUrl')}/apps/files/file-name?fileId=${id}`
cy.clearContent()
cy.getContent()
.type(`${link}{enter}`)

cy.getContent()
Expand All @@ -68,6 +69,7 @@ describe('test link marks', function() {

const link = `${Cypress.env('baseUrl')}/file-name?fileId=${id}`
cy.clearContent()
cy.getContent()
.type(`${link}{enter}`)

cy.getContent()
Expand All @@ -82,6 +84,7 @@ describe('test link marks', function() {

it('without protocol', () => {
cy.clearContent()
cy.getContent()
.type('google.com{enter}')
cy.getContent()
.find('a[href*="google.com"]')
Expand Down
3 changes: 2 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ Cypress.Commands.add('getTOC', () => {
Cypress.Commands.add('clearContent', () => {
cy.getContent().scrollIntoView()
cy.getContent().type('{selectAll}{backspace}')
return cy.getContent()

cy.getContent()
})

Cypress.Commands.add('openWorkspace', () => {
Expand Down

0 comments on commit 9d85c56

Please sign in to comment.