Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
To be done:
  - adjust test titles
  - fix lint warnings
  • Loading branch information
wlsf82 committed Apr 11, 2023
1 parent b0b092d commit e734836
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions cypress/e2e/cyESLintPluginSample.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,39 @@ describe('eslint-plugin-cypress ruless', () => {
})

it('lint error when assigning a cy command to a variable', () => {
const heading = cy.get('h1')
cy.get('h1')
})

it('lint error when waiting for an arbitrary number in ms', () => {
cy.wait(1000)
/**
* Instead, use a combination of `cy.intercetp()` with an alias (e.g., `.as`)
* Then, use `cy.wait('@alias')`
* For an example, visit the following URL shorturl.at/cgkoO
*/
})

it('fails when using `async` and `await`', async function() {
const heading = await cy.get('h1')
it('fails when using `async` and `await`', function() {
cy.get('h1')
})

it('lint error when chaining unsafe to chain commands', () => {
cy.get('input[type="text"]')
.as('textField')
.clear()
cy.get('@textField')
.type('Walmyr')
})

it('lint error when using { force: true }', () => {
cy.get('input[type="text"]').focus()
cy.get('button').click({ force: true })
cy.get('button').click()
})

it('lint error when taking a screenshot before an assertion', () => {
cy.get('h1').should('be.visible')
cy.contains('label', 'Nome:').should('be.visible')
cy.get('input[type="text"]').should('be.visible')
cy.contains('button', 'Enviar').should('be.visible')
cy.screenshot('test')
})

Expand All @@ -35,6 +45,6 @@ describe('eslint-plugin-cypress ruless', () => {
})

it('lint error when leaving a cy.pause() command', () => {
cy.pause()
// Does something that does not pause the test.
})
})

0 comments on commit e734836

Please sign in to comment.