-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support assertions with two values (#112)
* feat: support assertions with two values * bump upload artifact action * update v11 code * store screenshots and videos on failure * updated the tests * debugging * fix the last else branch
- Loading branch information
Showing
9 changed files
with
143 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/// <reference types="cypress" /> | ||
// @ts-check | ||
|
||
import '../../src' | ||
|
||
describe('has attribute assertion', () => { | ||
beforeEach(() => { | ||
cy.visit('cypress/terms.html') | ||
}) | ||
|
||
it('has attribute present', () => { | ||
cy.get('#submit') | ||
.if('have.attr', 'id') | ||
.log('button has an id') | ||
.else() | ||
.raise(new Error('button should have an id')) | ||
}) | ||
|
||
it( | ||
'has attribute present after delay', | ||
{ defaultCommandTimeout: 2000 }, | ||
() => { | ||
cy.get('#submit').should('have.attr', 'data-x') | ||
cy.get('#submit') | ||
.if('have.attr', 'data-x') | ||
.invoke('attr', 'data-x') | ||
.should('equal', '123') | ||
.else() | ||
.raise(new Error('data-x not found')) | ||
}, | ||
) | ||
|
||
it( | ||
'has attribute with matching value present after delay', | ||
{ defaultCommandTimeout: 2000 }, | ||
() => { | ||
cy.get('#submit').should('have.attr', 'data-x') | ||
cy.get('#submit') | ||
.if('have.attr', 'data-x', '123') | ||
.log('data-X found') | ||
.else() | ||
.raise(new Error('data-x not found')) | ||
}, | ||
) | ||
|
||
it( | ||
'has attribute with a different value', | ||
{ defaultCommandTimeout: 2000 }, | ||
() => { | ||
cy.get('#submit').should('have.attr', 'data-x') | ||
cy.get('#submit') | ||
// the attribute is present, but has a different value | ||
.if('have.attr', 'data-x', '99') | ||
.raise(new Error('data-x has wrong value')) | ||
.else('data-x value is correct') | ||
}, | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters