Skip to content

Commit

Permalink
Merge pull request #4709 from nextcloud/renovate/stable27-eslint-plug…
Browse files Browse the repository at this point in the history
…in-cypress-2.x

chore(deps): update dependency eslint-plugin-cypress to ^2.14.0 (stable27)
  • Loading branch information
max-nextcloud committed Aug 19, 2023
2 parents 0b90763 + cb86c6d commit fbdcac7
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 55 deletions.
39 changes: 17 additions & 22 deletions cypress/e2e/MenuBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,33 @@ describe('Test the rich text editor menu bar', function() {
}

beforeEach(cy.clearContent)

it('empty file', () => {
cy.getFile(fileName)
.then($el => {
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '0 words, 0 chars')
})
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '0 words, 0 chars')
})

it('single word', () => {
cy.getFile(fileName)
.then($el => {
cy.clearContent()
.type(' Hello ')
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '1 word, 9 chars')
})
cy.getContent()
.type(' Hello ')
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '1 word, 9 chars')
})

it('multiple words', () => {
cy.getFile(fileName)
.then($el => {
cy.clearContent()
.type('Hello \nworld')
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '2 words, 11 chars')
})
cy.getContent()
.type('Hello \nworld')
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '2 words, 11 chars')
})
})
})
37 changes: 18 additions & 19 deletions cypress/e2e/nodes/FrontMatter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,32 @@ describe('Front matter support', function() {
})

it('Open file with front matter', function() {
cy.openFile('frontmatter.md').then(() => {
cy.getContent().find('pre.frontmatter').should(pre => {
expect(pre.length === 1)
expect(pre[0].text === 'some: value\nother: 1.2')
})
cy.openFile('frontmatter.md')
cy.getContent().find('pre.frontmatter').should(pre => {
expect(pre.length === 1)
expect(pre[0].text === 'some: value\nother: 1.2')
})
})

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')
cy.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')
cy.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
6 changes: 3 additions & 3 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 Expand Up @@ -118,7 +121,6 @@ describe('test link marks', function() {
.should('have.been.calledWith', url)
}

beforeEach(cy.clearContent)
it('Link website without selection', () => {
cy.getFile(fileName)
.then($el => {
Expand Down Expand Up @@ -148,8 +150,6 @@ describe('test link marks', function() {
.click({ force: true })
}

beforeEach(() => cy.clearContent())

it('without text', () => {
cy.getFile(fileName)
.then($el => {
Expand Down
1 change: 0 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ Cypress.Commands.add('getTOC', () => {
Cypress.Commands.add('clearContent', () => {
cy.getContent().scrollIntoView()
cy.getContent().type('{selectAll}{backspace}')
return cy.getContent()
})

Cypress.Commands.add('openWorkspace', () => {
Expand Down
62 changes: 53 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"@vue/vue2-jest": "^29.2.5",
"@vueuse/core": "^10.3.0",
"cypress": "^12.17.4",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-cypress": "^2.14.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
Expand Down

0 comments on commit fbdcac7

Please sign in to comment.