From 4ff67c31a3982eb776c7d94ee3b5714d371eddf5 Mon Sep 17 00:00:00 2001 From: Stefanos Anagnostou Date: Thu, 16 May 2024 18:25:34 +0300 Subject: [PATCH 1/4] chore(testing): Add experimental console warning on Cypress setup function --- .changeset/grumpy-plants-think.md | 5 +++++ packages/testing/src/cypress/setup.ts | 3 +++ packages/testing/src/cypress/utils.ts | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 .changeset/grumpy-plants-think.md create mode 100644 packages/testing/src/cypress/utils.ts diff --git a/.changeset/grumpy-plants-think.md b/.changeset/grumpy-plants-think.md new file mode 100644 index 00000000000..62feadee749 --- /dev/null +++ b/.changeset/grumpy-plants-think.md @@ -0,0 +1,5 @@ +--- +'@clerk/testing': patch +--- + +Add experimental console warning on Cypress setup function diff --git a/packages/testing/src/cypress/setup.ts b/packages/testing/src/cypress/setup.ts index 0000160e9ac..3d9a1a962be 100644 --- a/packages/testing/src/cypress/setup.ts +++ b/packages/testing/src/cypress/setup.ts @@ -1,6 +1,7 @@ /// import type { ClerkSetupOptions } from '../common'; import { fetchEnvVars } from '../common'; +import { experimentalConsoleWarning } from './utils'; type ClerkSetupParams = { config: Cypress.PluginConfigOptions; @@ -23,6 +24,8 @@ type ClerkSetupParams = { * @throws An error if the Cypress config object is not provided. */ export const clerkSetup = async ({ config, options }: ClerkSetupParams) => { + experimentalConsoleWarning(); + if (!config) { throw new Error('The Cypress config object is required.'); } diff --git a/packages/testing/src/cypress/utils.ts b/packages/testing/src/cypress/utils.ts new file mode 100644 index 00000000000..17691292787 --- /dev/null +++ b/packages/testing/src/cypress/utils.ts @@ -0,0 +1,4 @@ +export const experimentalConsoleWarning = () => { + const message = '@clerk/testing: Cypress is an experimental project and subject to change in the future.'; + console.log('\x1b[33m%s\x1b[0m', message); +}; From 786e9a4c50e1dca57470b4056e8b5942461fb21b Mon Sep 17 00:00:00 2001 From: Stefanos Anagnostou Date: Fri, 17 May 2024 12:39:27 +0300 Subject: [PATCH 2/4] chore(testing): Add experimental warning in README --- packages/testing/README.md | 2 ++ packages/testing/src/cypress/setup.ts | 6 ++++-- packages/testing/src/cypress/utils.ts | 4 ---- 3 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 packages/testing/src/cypress/utils.ts diff --git a/packages/testing/README.md b/packages/testing/README.md index e00e63d2dfe..293c5d69dab 100644 --- a/packages/testing/README.md +++ b/packages/testing/README.md @@ -89,6 +89,8 @@ test("sign up", async ({ page }) => { ### Cypress +⚠️ **Using Cypress to test Clerk is still in the experimental stage. Please be aware that there may be limitations and potential issues when using this approach.** + Firstly, add your Clerk keys (`CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY`) to your environment variables file (e.g. `.env.local` or `.env.`). You can find these keys in your Clerk Dashboard. diff --git a/packages/testing/src/cypress/setup.ts b/packages/testing/src/cypress/setup.ts index 3d9a1a962be..3f8f4f67537 100644 --- a/packages/testing/src/cypress/setup.ts +++ b/packages/testing/src/cypress/setup.ts @@ -1,7 +1,6 @@ /// import type { ClerkSetupOptions } from '../common'; import { fetchEnvVars } from '../common'; -import { experimentalConsoleWarning } from './utils'; type ClerkSetupParams = { config: Cypress.PluginConfigOptions; @@ -24,7 +23,10 @@ type ClerkSetupParams = { * @throws An error if the Cypress config object is not provided. */ export const clerkSetup = async ({ config, options }: ClerkSetupParams) => { - experimentalConsoleWarning(); + console.log( + '\x1b[33m%s\x1b[0m', + '@clerk/testing: Cypress is an experimental project and subject to change in the future.', + ); if (!config) { throw new Error('The Cypress config object is required.'); diff --git a/packages/testing/src/cypress/utils.ts b/packages/testing/src/cypress/utils.ts deleted file mode 100644 index 17691292787..00000000000 --- a/packages/testing/src/cypress/utils.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const experimentalConsoleWarning = () => { - const message = '@clerk/testing: Cypress is an experimental project and subject to change in the future.'; - console.log('\x1b[33m%s\x1b[0m', message); -}; From a090fcc50a9eaadc7d9540ddb41ffef4f0195ec9 Mon Sep 17 00:00:00 2001 From: Stefanos Anagnostou Date: Fri, 17 May 2024 15:00:19 +0300 Subject: [PATCH 3/4] Update packages/testing/README.md Co-authored-by: Lennart --- packages/testing/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/testing/README.md b/packages/testing/README.md index 293c5d69dab..06d35f24c31 100644 --- a/packages/testing/README.md +++ b/packages/testing/README.md @@ -89,7 +89,7 @@ test("sign up", async ({ page }) => { ### Cypress -⚠️ **Using Cypress to test Clerk is still in the experimental stage. Please be aware that there may be limitations and potential issues when using this approach.** +⚠️ **Please note:** Support for Cypress is still experimental. Be aware that there are limitations and potential issues at this stage. Please open an issue with a minimal reproduction so that these issues can be fixed. Thanks! Firstly, add your Clerk keys (`CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY`) to your environment variables file (e.g. `.env.local` or `.env.`). You can find these keys in your Clerk Dashboard. From b55804d4f09563b595ec6952e468639bb723ac06 Mon Sep 17 00:00:00 2001 From: Stefanos Anagnostou Date: Fri, 17 May 2024 15:00:25 +0300 Subject: [PATCH 4/4] Update packages/testing/src/cypress/setup.ts Co-authored-by: Lennart --- packages/testing/src/cypress/setup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/testing/src/cypress/setup.ts b/packages/testing/src/cypress/setup.ts index 3f8f4f67537..a9da0ae4cf5 100644 --- a/packages/testing/src/cypress/setup.ts +++ b/packages/testing/src/cypress/setup.ts @@ -25,7 +25,7 @@ type ClerkSetupParams = { export const clerkSetup = async ({ config, options }: ClerkSetupParams) => { console.log( '\x1b[33m%s\x1b[0m', - '@clerk/testing: Cypress is an experimental project and subject to change in the future.', + '@clerk/testing: Support for Cypress is experimental and subject to change in the future.', ); if (!config) {