generated from mmisty/cypress-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
111 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
describe('suite', () => { | ||
describe('should pass', () => { | ||
beforeEach(() => { | ||
cy.intercept('mytest.com**', { | ||
body: `<html> | ||
<head></head> | ||
<body> | ||
<a href="#2" data-qa-id="link-2">My link</a> | ||
<a href="#3" data-qa-id="link-3">My link 3</a> | ||
</body> | ||
</html> | ||
`, | ||
}); | ||
|
||
cy.visit('mytest.com'); | ||
}); | ||
|
||
it('should click when added during chain (no custom commands)', () => { | ||
cy.get('[data-qa-id=link-2]') | ||
.doSyncCommand(s => { | ||
expect(s.text()).eq('My link'); | ||
}) | ||
.click(); | ||
}); | ||
|
||
it('should click when added during chain', () => { | ||
cy.qaId('link-2') | ||
.doSyncCommand(s => { | ||
expect(s.text()).eq('My link'); | ||
}) | ||
.click(); | ||
}); | ||
|
||
it('should click when added during chain (several)', () => { | ||
cy.qaId('link-2') | ||
.doSyncCommand(s => { | ||
expect(s.text()).eq('My link'); | ||
}) | ||
.doSyncCommand(s => { | ||
expect(s.text()).eq('My link'); | ||
}) | ||
.click(); | ||
}); | ||
|
||
it('should succeed when added before should', () => { | ||
cy.qaId('link-60') | ||
.doSyncCommand(() => { | ||
console.log('hello'); | ||
}) | ||
.should('not.exist'); | ||
}); | ||
|
||
it('should succeed when cy commands inside', () => { | ||
cy.qaId('link-60') | ||
.doSyncCommand(s => { | ||
cy.log('hello'); | ||
cy.wrap(s); | ||
}) | ||
.should('not.exist'); | ||
}); | ||
|
||
it('should succeed when between cy commands with cy commands inside', () => { | ||
cy.get('body') | ||
.find('a') | ||
.doSyncCommand(s => { | ||
cy.log('hello'); | ||
cy.wrap(s, { log: false }); | ||
}) | ||
.eq(1) | ||
.should('have.text', 'My link 3'); | ||
}); | ||
}); | ||
}); |
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