From 4b7bfc1cc1d0fc59447334852d3fd60437708aa9 Mon Sep 17 00:00:00 2001 From: Abhishek Rawat <47311875+AbePlays@users.noreply.github.com> Date: Tue, 15 Nov 2022 23:11:10 +0530 Subject: [PATCH 1/8] fix: fixed typo in findAllBy docs (#211) --- types/index.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index dd0bfd6..6360b9a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -30,7 +30,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -44,7 +44,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -58,7 +58,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -72,7 +72,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -86,7 +86,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -100,7 +100,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -114,7 +114,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -125,7 +125,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -136,7 +136,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -147,7 +147,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -158,7 +158,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -169,7 +169,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -180,7 +180,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -194,7 +194,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -208,7 +208,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents @@ -219,7 +219,7 @@ declare global { * dom-testing-library helpers for Cypress * * `findBy*` APIs search for an element and throw an error if nothing found - * `findAllBy*` APIs search for all elements and an error if nothing found + * `findAllBy*` APIs search for all elements and throw an error if nothing found * * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents From 7926ae6ee4e3a7c111f2ba0f973f707c504d0a53 Mon Sep 17 00:00:00 2001 From: Ren Adachi <49895682+moeyashi@users.noreply.github.com> Date: Wed, 16 Nov 2022 02:42:56 +0900 Subject: [PATCH 2/8] docs(README): update examples link (#228) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 885d7b6..99d23e7 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ cy.configureCypressTestingLibrary(config) ``` To show some simple examples (from -[cypress/integration/find.spec.js](cypress/integration/find.spec.js)): +[cypress/e2e/find.cy.js](cypress/e2e/find.cy.js)): ```javascript cy.findAllByText('Button Text').should('exist') From ee3451914df44da3021b072614fa3d5452f8bca1 Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Tue, 15 Nov 2022 10:55:59 -0700 Subject: [PATCH 3/8] chore: update Cypress configuration --- cypress.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cypress.config.js b/cypress.config.js index d759e85..39ba054 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -2,4 +2,6 @@ const {defineConfig} = require('cypress') module.exports = defineConfig({ video: false, + + e2e: {}, }) From dcfa412a0bbee2d7a40e79eeb50adb32ab180913 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 15 Nov 2022 19:12:23 +0100 Subject: [PATCH 4/8] fix: allow Cypress v11 in peer deps (#234) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 934e4da..2c2f772 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "typescript": "^4.3.5" }, "peerDependencies": { - "cypress": "^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0" + "cypress": "^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0" }, "eslintConfig": { "extends": "./node_modules/kcd-scripts/eslint.js", From 8882e411fecde4de8f969e509c021cf503121c8c Mon Sep 17 00:00:00 2001 From: Michal Kulinski Date: Tue, 15 Nov 2022 19:26:43 +0100 Subject: [PATCH 5/8] Add forward compatibility with Cypress 10 (#233) --- src/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 649e11d..ae8a20f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -6,7 +6,10 @@ function getFirstElement(jqueryOrElement) { } function getContainer(container) { - const subject = cy.state('subject') + // Cypress 10 deprecated cy.state('subject') usage and suggest to use new cy.currentSubject. + // https://docs.cypress.io/guides/references/changelog#10-5-0 + // Below change ensures we do not get spam of warnings and are backward compatible with older cypress versions. + const subject = cy.currentSubject ? cy.currentSubject() : cy.state('subject'); const withinContainer = cy.state('withinSubject') if (!subject && withinContainer) { From 1d62d1b115c35f09c1d7307f252630c77328f9dd Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 15 Nov 2022 19:35:32 +0100 Subject: [PATCH 6/8] chore: run CI on Node 18 (#235) --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7e07dc0..cb5a223 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -16,7 +16,7 @@ jobs: if: ${{ !contains(github.head_ref, 'all-contributors') }} strategy: matrix: - node: [12, 14, 16] + node: [12, 14, 16, 18] runs-on: ubuntu-latest steps: - name: 🛑 Cancel Previous Runs From e9fdfae6e6b0ec4fc277b22f947e6aeb21f07669 Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Tue, 15 Nov 2022 12:27:35 -0700 Subject: [PATCH 7/8] fix: update error stack traces for Cypress (#239) Fixes #232 Update the Cypress error message rather than the entire error object. This merges the useful message of DOM Testing Library with the useful context of the Cypress error. This allows Cypress to find the line number of the failure in spec files instead of deep inside DOM Testing Library. --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 1275213..ee5f303 100644 --- a/src/index.js +++ b/src/index.js @@ -109,7 +109,7 @@ function createCommand(queryName, implementationName) { onFail: () => { // We want to override Cypress's normal non-existence message with @testing-library/dom's more helpful ones if (error) { - options.error = error + options.error.message = error.message } }, }) From 8d66009f1dc2a41743c20114fe94c6bfc4c53b50 Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Tue, 15 Nov 2022 13:15:47 -0700 Subject: [PATCH 8/8] fix: update Cypress' log bar with timeout information (#240) Fixes #217 --- src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.js b/src/index.js index ee5f303..54710d2 100644 --- a/src/index.js +++ b/src/index.js @@ -51,6 +51,7 @@ function createCommand(queryName, implementationName) { type: prevSubject ? 'child' : 'parent', name: queryName, message: inputArr, + timeout: options.timeout, consoleProps: () => consoleProps, }) }