<body>
<style>/* Hey, I’m a style tag */</style>
<script>// Hello, I’m a script</script>
</body>cy.contains('Hey, I’m a style tag'); // will not select <style> in v9
cy.contains('Hello, I’m a script'); // will not select <body>
<style>/* Hey, I’m a style tag */</style>
<script>// Hello, I’m a script</script>
</body>cy.contains('Hey, I’m a style tag'); // will not select <style> in v9
cy.contains('Hello, I’m a script'); // will not select | // selects any element with the text "Dashboard" | |
| cy.contains('Dashboard') | |
| // selects a h1 element with the text "Dashboard" | |
| cy.contains('h1', 'Dashboard') |
| it('changing user agent', () => { | |
| cy.visit('/', { | |
| onBeforeLoad: (win) => { | |
| Object.defineProperty(win.navigator, 'userAgent', { | |
| value: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', | |
| }); | |
| } | |
| }) | |
| }) |
| { | |
| "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" | |
| } |
| it('touch device', () => { | |
| cy.visit('/', { | |
| onBeforeLoad: (win) => { | |
| win.ontouchstart = true | |
| } | |
| }) | |
| }) |
| it('viewport test', () => { | |
| cy.visit('/') | |
| cy.viewport(320, 480) | |
| cy.viewport('iphone-5') | |
| }); |
| const app = new Vue({ | |
| // ... | |
| }).$mount('#trello-app'); | |
| window.app = app; |
| beforeEach( function() { | |
| window.logCalls = 1; | |
| window.testFlow = []; | |
| }); | |
| Cypress.Commands.overwrite('log', (originalFn, message) => { | |
| Cypress.log({ | |
| displayName: `--- ${window.logCalls}. ${message} ---`, | |
| name: `--- ${window.logCalls}. ${message} ---`, |
| beforeEach( function() { | |
| window.logCalls = 1; | |
| }); | |
| Cypress.Commands.overwrite('log', (originalFn, message) => { | |
| Cypress.log({ | |
| displayName: `--- ${window.logCalls}. ${message} ---`, | |
| name: `--- ${window.logCalls}. ${message} ---`, | |
| message: '' |