-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(testing): Cypress 12 Support (#14058)
- Loading branch information
1 parent
5970246
commit 0bc93ee
Showing
8 changed files
with
1,096 additions
and
3 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
87 changes: 87 additions & 0 deletions
87
...ages/cypress/src/migrations/update-15-5-0/__snapshots__/update-to-cypress-12.spec.ts.snap
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,87 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Cypress 12 Migration should migrate to cy 12 1`] = ` | ||
"describe('something', () => { | ||
it('should do the thing', () => { | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.session instead. https://docs.cypress.io/guides/references/migration-guide#Command-Cypress-API-Changes | ||
Cypress.Cookies.defaults() | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.session instead. https://docs.cypress.io/guides/references/migration-guide#Command-Cypress-API-Changes | ||
Cypress.Cookies.preserveOnce('seesion_id', 'remember-token'); | ||
Cypress.blah.abc() | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.intercept instead. https://docs.cypress.io/guides/references/migration-guide#cy-server-cy-route-and-Cypress-Server-defaults | ||
Cypress.Server.defaults({ | ||
delay: 500, | ||
method: 'GET', | ||
}) | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.intercept instead. https://docs.cypress.io/guides/references/migration-guide#cy-server-cy-route-and-Cypress-Server-defaults | ||
cy.server() | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.intercept instead. https://docs.cypress.io/guides/references/migration-guide#cy-server-cy-route-and-Cypress-Server-defaults | ||
cy.route(/api/, () => { | ||
return { | ||
'test': 'We’ll', | ||
} | ||
}).as('getApi') | ||
cy.visit('/index.html') | ||
cy.window().then((win) => { | ||
const xhr = new win.XMLHttpRequest | ||
xhr.open('GET', '/api/v1/foo/bar?a=42') | ||
xhr.send() | ||
}) | ||
cy.wait('@getApi') | ||
.its('url').should('include', 'api/v1') | ||
/** | ||
* TODO(@nrwl/cypress): Nesting Cypress commands in a should assertion now throws. | ||
* You should use .then() to chain commands instead. | ||
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should | ||
**/ | ||
cy.should(($s) => { | ||
cy.get('@table').find('tr').should('have.length', 3) | ||
}) | ||
}) | ||
})" | ||
`; | ||
|
||
exports[`Cypress 12 Migration should migrate to cy 12 2`] = ` | ||
"describe('something', () => { | ||
it('should do the thing', () => { | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.session instead. https://docs.cypress.io/guides/references/migration-guide#Command-Cypress-API-Changes | ||
Cypress.Cookies.defaults() | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.session instead. https://docs.cypress.io/guides/references/migration-guide#Command-Cypress-API-Changes | ||
Cypress.Cookies.preserveOnce('seesion_id', 'remember-token'); | ||
Cypress.blah.abc() | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.intercept instead. https://docs.cypress.io/guides/references/migration-guide#cy-server-cy-route-and-Cypress-Server-defaults | ||
Cypress.Server.defaults({ | ||
delay: 500, | ||
method: 'GET', | ||
}) | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.intercept instead. https://docs.cypress.io/guides/references/migration-guide#cy-server-cy-route-and-Cypress-Server-defaults | ||
cy.server() | ||
// TODO(@nrwl/cypress): this command has been removed, use cy.intercept instead. https://docs.cypress.io/guides/references/migration-guide#cy-server-cy-route-and-Cypress-Server-defaults | ||
cy.route(/api/, () => { | ||
return { | ||
'test': 'We’ll', | ||
} | ||
}).as('getApi') | ||
cy.visit('/index.html') | ||
cy.window().then((win) => { | ||
const xhr = new win.XMLHttpRequest | ||
xhr.open('GET', '/api/v1/foo/bar?a=42') | ||
xhr.send() | ||
}) | ||
cy.wait('@getApi') | ||
.its('url').should('include', 'api/v1') | ||
/** | ||
* TODO(@nrwl/cypress): Nesting Cypress commands in a should assertion now throws. | ||
* You should use .then() to chain commands instead. | ||
* More Info: https://docs.cypress.io/guides/references/migration-guide#-should | ||
**/ | ||
cy.should(($s) => { | ||
cy.get('@table').find('tr').should('have.length', 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { Node } from 'typescript'; | ||
|
||
export function isAlreadyCommented(node: Node) { | ||
return node.getFullText().includes('TODO(@nrwl/cypress)'); | ||
} | ||
|
||
export const BANNED_COMMANDS = [ | ||
'as', | ||
'children', | ||
'closest', | ||
'contains', | ||
'debug', | ||
'document', | ||
'eq', | ||
'filter', | ||
'find', | ||
'first', | ||
'focused', | ||
'get', | ||
'hash', | ||
'its', | ||
'last', | ||
'location', | ||
'next', | ||
'nextAll', | ||
'not', | ||
'parent', | ||
'parents', | ||
'parentsUntil', | ||
'prev', | ||
'prevUntil', | ||
'root', | ||
'shadow', | ||
'siblings', | ||
'title', | ||
'url', | ||
'window', | ||
]; |
Oops, something went wrong.