Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSR-791] cypress-cloud is not compatible with cypress 13.x #179

Open
3 tasks done
anlambert opened this issue Sep 1, 2023 · 94 comments
Open
3 tasks done

[CSR-791] cypress-cloud is not compatible with cypress 13.x #179

anlambert opened this issue Sep 1, 2023 · 94 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@anlambert
Copy link

Before opening, please confirm:

  • I have searched for duplicate or closed issues and discussions.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I acknowledge that I will attach a full debug log, otherwise the issue will be closed with no response.

Environment information

# Put output below this line

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (8) x64 Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
    Memory: 18.94 GB / 31.16 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 18.16.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.5.1 - /usr/bin/npm
  Browsers:
    Chrome: 114.0.5735.90
    Chromium: 116.0.5845.140
  npmPackages:
    eslint-config-custom: latest => 0.0.0 
    prettier: latest => 3.0.2 
    turbo: ^1.10.13 => 1.10.13 
  npmGlobalPackages:
    azurite: 3.23.0
    corepack: 0.17.0
    gulp-cli: 2.3.0
    npm: 9.5.1
    samfirm: 0.2.0

Describe the bug

Due to this cypress commit that introduces some breaking API changes in cypress 13.x, I noticed two issues when using cypress-cloud with it:

  1. Executed cypress tests are always reported as failing whatever their real statuses are.

See sample cypress-cloud output put below:

$ yarn run cypress-cloud run --parallel --record --key somekey --cloud-debug true --ci-build-id hello-cypress36
yarn run v1.22.19
$ /home/anlambert/swh/swh-environment/swh-web/node_modules/.bin/cypress-cloud run --parallel --record --key somekey --cloud-debug true --ci-build-id hello-cypress36
 WARNING  Failed to load config file, falling back to the default config. Attempted locations: [
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.js',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.cjs',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.mjs'
]

Copyright (C) 2023 Currents Software Inc https://currents.dev
This is free software, and you are welcome to redistribute it under certain
conditions. This program comes with no warranty. Parts of this program are MIT
licensed. Refer to the license for details
https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md

Discovered 1 spec files
Tags: false; Group: false; Parallel: true; Batch Size: 3
Connecting to cloud orchestration service...
🎥 Run URL: http://localhost:8080/run/aff6e1ec70f400b22c4deeb5b83332e7

====================================================================================================

Running: cypress/e2e/home.cy.js (1/1)

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        13.1.0                                                                         │
  │ Browser:        Electron 106 (headless)                                                        │
  │ Node Version:   v18.16.0 (/usr/bin/node)                                                       │
  │ Specs:          1 found (home.cy.js)                                                           │
  │ Searched:       cypress/e2e/home.cy.js                                                         │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  home.cy.js                                                                      (1 of 1)


  Home Page Tests
    ✓ should have focus on search form after page load
    ✓ should display positive stats for each category
    ✓ should display null counters and hide history graphs when storage is empty
    ✓ should hide counters when data is missing
    ✓ should redirect to search page when submitting search form


  5 passing (6s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        5                                                                                │
  │ Passing:      5                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     6 seconds                                                                        │
  │ Spec Ran:     home.cy.js                                                                       │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


====================================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  home.cy.js                               00:06        5        5        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        00:06        5        5        -        -        -  


  Reporting results and artifacts in background...  


====================================================================================================


  Cloud Run Finished  

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │     Spec                                         Tests   Passing   Failing   Pending   Skipped │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✖   cypress/e2e/home.cy.js               0ms         1         -         1         -         - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✖   1 of 1 failed                        0ms         1         -         1         -         - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

🏁 Recorded Run: http://localhost:8080/run/aff6e1ec70f400b22c4deeb5b83332e7

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

After reading cypress-cloud code, it seems that issue can be fixed using the following diff:

diff --git a/packages/cypress-cloud/lib/results/results.ts b/packages/cypress-cloud/lib/results/results.ts
index f9380de..635f0b4 100644
--- a/packages/cypress-cloud/lib/results/results.ts
+++ b/packages/cypress-cloud/lib/results/results.ts
@@ -12,11 +12,6 @@ import { ConfigState } from "../state";
 
 const debug = Debug("currents:results");
 
-export const isSuccessResult = (
-  result: CypressResult
-): result is CypressCommandLine.CypressRunResult => {
-  return result.status === "finished";
-};
 
 export const getScreenshotsSummary = (
   tests: CypressCommandLine.TestResult[] = []
@@ -282,9 +277,6 @@ export function getCypressRunResultForSpec(
   spec: string,
   cypressResult: CypressResult
 ): CypressCommandLine.CypressRunResult | undefined {
-  if (!isSuccessResult(cypressResult)) {
-    return;
-  }
 
   const run = cypressResult.runs.find((r) => r.spec.relative === spec);
   if (!run) {
  1. Screenshots fail to be processed.

Once the fix above applied, there is an error when cypress-cloud attempts to process test screenshots, see output below:

$ yarn run cypress-cloud run --parallel --record --key somekey --cloud-debug true --ci-build-id hello-cypress38
yarn run v1.22.19
$ /home/anlambert/swh/swh-environment/swh-web/node_modules/.bin/cypress-cloud run --parallel --record --key somekey --cloud-debug true --ci-build-id hello-cypress38
 WARNING  Failed to load config file, falling back to the default config. Attempted locations: [
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.js',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.cjs',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.mjs'
]

Copyright (C) 2023 Currents Software Inc https://currents.dev
This is free software, and you are welcome to redistribute it under certain
conditions. This program comes with no warranty. Parts of this program are MIT
licensed. Refer to the license for details
https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md

Discovered 1 spec files
Tags: false; Group: false; Parallel: true; Batch Size: 3
Connecting to cloud orchestration service...
🎥 Run URL: http://localhost:8080/run/8daacfecbd761c3d663e7e4bd2646eae

====================================================================================================

Running: cypress/e2e/home.cy.js (1/1)

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        13.1.0                                                                         │
  │ Browser:        Electron 106 (headless)                                                        │
  │ Node Version:   v18.16.0 (/usr/bin/node)                                                       │
  │ Specs:          1 found (home.cy.js)                                                           │
  │ Searched:       cypress/e2e/home.cy.js                                                         │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  home.cy.js                                                                      (1 of 1)


  Home Page Tests
    ✓ should have focus on search form after page load
    ✓ should display positive stats for each category
    ✓ should display null counters and hide history graphs when storage is empty
    ✓ should hide counters when data is missing
    ✓ should redirect to search page when submitting search form


  5 passing (6s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        5                                                                                │
  │ Passing:      5                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     6 seconds                                                                        │
  │ Spec Ran:     home.cy.js                                                                       │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


====================================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  home.cy.js                               00:06        5        5        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        00:06        5        5        -        -        -  


  Reporting results and artifacts in background...  

 ERROR  TypeError: Cannot read properties of undefined (reading 'flatMap')
    at /home/anlambert/swh/swh-environment/swh-web/node_modules/lib/results/results.ts:26:21
    at Array.flatMap (<anonymous>)
    at /home/anlambert/swh/swh-environment/swh-web/node_modules/lib/results/results.ts:25:19
    at Array.flatMap (<anonymous>)
    at getScreenshotsSummary (/home/anlambert/swh/swh-environment/swh-web/node_modules/lib/results/results.ts:24:16)
    at getInstanceResultPayload (/home/anlambert/swh/swh-environment/swh-web/node_modules/lib/results/results.ts:62:18)
    at getReportResultsTask (/home/anlambert/swh/swh-environment/swh-web/node_modules/lib/results/uploadResults.ts:22:13)
    at createReportTask (/home/anlambert/swh/swh-environment/swh-web/node_modules/lib/runner/reportTask.ts:26:3)
    at /home/anlambert/swh/swh-environment/swh-web/node_modules/lib/runner/runner.ts:55:7
    at Array.forEach (<anonymous>)
    at runTillDone (/home/anlambert/swh/swh-environment/swh-web/node_modules/lib/runner/runner.ts:54:7)


====================================================================================================


  Cloud Run Finished  

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │     Spec                                         Tests   Passing   Failing   Pending   Skipped │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔   undefined                           6.2s         5         5         -         -         - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔   All specs passed!                   6.2s         5         5         -         -         - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

🏁 Recorded Run: http://localhost:8080/run/8daacfecbd761c3d663e7e4bd2646eae

Done in 13.82s.

The fix for this one is not straightforward to me.

Expected behavior

cypress 13.x should be supported.

Command and Setup

Just run any cypress-cloud session with cypress 13.x and the reported errors will show up.

Full log and debug output

cypress_cloud_debug_logs.txt

@anlambert anlambert added the bug Something isn't working label Sep 1, 2023
@agoldis
Copy link
Contributor

agoldis commented Sep 1, 2023

The fix is in progress

@Roemer
Copy link

Roemer commented Sep 7, 2023

Is this also related to the issue that viewing a run in Sorry Cypress is not possible and shows the following error:
image

@agoldis
Copy link
Contributor

agoldis commented Sep 7, 2023

Please check out the upgrade guide: https://currents.dev/readme/integration-with-cypress/cypress-cloud/migration-to-cypress-13

@anlambert
Copy link
Author

I just tested the upgrade to cypress-cloud beta and tests are no longer reported as failing, see https://jenkins.softwareheritage.org/blue/organizations/jenkins/DWAPPS%2Fgitlab-builds/detail/gitlab-builds/302/pipeline/89/.

There is still the error about screenshots that appears after each test suite though but if you do not use that cypress feature it is not critical for running the tests.

@richardmward
Copy link

richardmward commented Sep 7, 2023

I too am having issues with the latest build 1.10.0-beta.2, but not the same as above.

file:///C:/dev/src/my-project/node_modules/cypress-cloud/index.mjs:2273
    ..._11.cloneDeep(specResults),
           ^

TypeError: _11.cloneDeep is not a function

Hacking in a bit of debugging, it seems that _11 contains default, which contains cloneDeep - which seems to me to be imported as a commonjs module rather than esm (which is how all my project is configured).

EDIT:

In v1.9.4, the imports in index.mjs are in the format import _11 from "lodash";, whereas in same file in v1.10.0-beta.2, the imports are now import * as _11 from "lodash";

@agoldis
Copy link
Contributor

agoldis commented Sep 7, 2023

Thanks @anlambert and @richardmward, working on the fixes for those issues

@agoldis agoldis changed the title cypress-cloud is not compatible with cypress 13.x [CSR-791] cypress-cloud is not compatible with cypress 13.x Sep 7, 2023
@estefafdez
Copy link

For us, after updating everything to the latest version we got the following error, and the specs are not executed:

11:47:24  Copyright (C) 2023 Currents Software Inc https://currents.dev
11:47:24  This is free software, and you are welcome to redistribute it under certain
11:47:24  conditions. This program comes with no warranty. Parts of this program are MIT
11:47:24  licensed. Refer to the license for details
11:47:24  https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md
11:47:24  
11:47:26  
11:47:26  
11:47:26    (Attempt 1 of 2) An uncaught error was detected outside of a test
11:47:26    1) An uncaught error was detected outside of a test
11:47:26  
11:47:26    0 passing (910ms)
11:47:26    1 failing
11:47:26  
11:47:26    1) An uncaught error was detected outside of a test:
11:47:26       Error: The following error originated from your test code, not from Cypress.
11:47:26  
11:47:26    > Dynamic require of "@neuralegion/cypress-har-generator/commands" is not supported
11:47:26  
11:47:26  When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
11:47:26  
11:47:26  Cypress could not associate this error to any specific test.
11:47:26  

Versions:

  • "cypress": "13.1.0",
  • "cypress-cloud": "1.9.4",
  • "cypress-debugger": "^1.0.9",

@estefafdez
Copy link

The tests are working with

 "cypress": "13.1.0",
    "cypress-cloud": "1.10.0-beta.2",
    "cypress-debugger": "1.0.7",`

and you can see the logs on the command line that the tests passed ok:

12:45:25    (Run Starting)
12:45:25  
12:45:25    ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
12:45:25    │ Cypress:        13.1.0                                                                         │
12:45:25    │ Browser:        Electron 106 (headless)                                                        │
12:45:25    │ Node Version:   v16.16.0 (/usr/bin/node)                                                       │
12:45:25    │ Specs:          1 found (admin_auth.spec.ts)                                                   │
12:45:25    │ Searched:       cypress/test/genially/admin/admin_auth.spec.ts                                 │
12:45:25    │ Experiments:    experimentalRunAllSpecs=true,experimentalMemoryManagement=true,experimentalWe… │
12:45:25    └────────────────────────────────────────────────────────────────────────────────────────────────┘
12:45:25  
12:45:25  
12:45:25  ────────────────────────────────────────────────────────────────────────────────────────────────────
12:45:25                                                                                                      
12:45:25    Running:  admin_auth.spec.ts                                                              (1 of 1)
12:45:32  
12:45:32  
12:45:32    Admin/Auth/AdminUser
12:45:37      ✓ should login as authorized master user (5497ms)
12:45:40      ✓ should logout as authorized master user (2265ms)
12:45:40  
12:45:40  
12:45:40    2 passing (9s)
12:45:40  
12:45:40  
12:45:40    (Results)
12:45:40  
12:45:40    ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
12:45:40    │ Tests:        2                                                                                │
12:45:40    │ Passing:      2                                                                                │
12:45:40    │ Failing:      0                                                                                │
12:45:40    │ Pending:      0                                                                                │
12:45:40    │ Skipped:      0                                                                                │
12:45:40    │ Screenshots:  0                                                                                │
12:45:40    │ Video:        false                                                                            │
12:45:40    │ Duration:     8 seconds                                                                        │
12:45:40    │ Spec Ran:     admin_auth.spec.ts                                                               │
12:45:40    └────────────────────────────────────────────────────────────────────────────────────────────────┘
12:45:40  
12:45:40  
12:45:40  resize:  can't open terminal /dev/tty
12:45:40  ====================================================================================================
12:45:40  
12:45:40    (Run Finished)
12:45:40  
12:45:40  
12:45:40         Spec                                              Tests  Passing  Failing  Pending  Skipped  
12:45:40    ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
12:45:40    │ ✔  admin_auth.spec.ts                       00:08        2        2        -        -        - │
12:45:40    └────────────────────────────────────────────────────────────────────────────────────────────────┘
12:45:40      ✔  All specs passed!                        00:08        2        2        -        -        -  
12:45:40  
12:45:40  
12:45:40    Reporting results and artifacts in background...  
12:45:40  
12:45:40   ERROR  TypeError: Cannot read properties of undefined (reading 'flatMap')
12:45:40      at /home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/results/results.ts:27:21
12:45:40      at Array.flatMap (<anonymous>)
12:45:40      at /home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/results/results.ts:26:19
12:45:40      at Array.flatMap (<anonymous>)
12:45:40      at getRunScreenshots (/home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/results/results.ts:25:16)
12:45:40      at getInstanceResultPayload (/home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/results/results.ts:66:18)
12:45:40      at getReportResultsTask (/home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/results/uploadResults.ts:26:27)
12:45:40      at createReportTask (/home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/runner/reportTask.ts:30:5)
12:45:40      at /home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/runner/runner.ts:58:7
12:45:40      at Array.forEach (<anonymous>)
12:45:40      at runTillDone (/home/ubuntu/workspace/workspace/ressED_qa_PD-13026_cy13_recorder/mono-genially/qa/e2e/node_modules/lib/runner/runner.ts:57:14)
12:45:40  
12:45:40  
12:45:40  ====================================================================================================
12:45:40  
12:45:40  
12:45:40    Cloud Run Finished  
12:45:40  
12:45:40    ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
12:45:40    │     Spec                                         Tests   Passing   Failing   Pending   Skipped │
12:45:40    ├────────────────────────────────────────────────────────────────────────────────────────────────┤
12:45:40    │ ✔   cypress/test/genially/admin/ad      8.6s         2         2         -         -         - │
12:45:40    │     min_auth.spec.ts                                                                           │
12:45:40    ├────────────────────────────────────────────────────────────────────────────────────────────────┤
12:45:40    │ ✔   All specs passed!                   8.6s         2         2         -         -         - │
12:45:40    └────────────────────────────────────────────────────────────────────────────────────────────────┘
12:45:40  
12:45:40  🏁 Recorded Run: https://dashboard-sorrycypress.genially.com/run/4acaa09f2aa7f36f26d5acbec86c675e

The problem is, that the results do not appears on sorry cypress (or the mongodb) and you get 0 tests executed (and the specs runs indefinitely)

image image

@agoldis
Copy link
Contributor

agoldis commented Sep 8, 2023

@estefafdez thanks for reporting - will keep cypress-debugger issue separated

@Roemer, @anlambert and @richardmward please check out 1.10.0-beta.3 also, please submit the debug logs when you face issues - would be much easier for us, and thanks for helping with polishing the integration!

@richardmward
Copy link

That has sorted my issue. Thank you.

@estefafdez
Copy link

@agoldis the debugger issue is already reported there currents-dev/cypress-debugger#59 The problem is that you can run the tests in Cy13 but you can't see the results in sorry cypress, Something seems to be missing as well.

@andreiho
Copy link

Anyone else experiencing tests just getting stuck and never finishing? I'm using [email protected] with [email protected], having followed the migration guide, and the tests start, but it just hangs after the first one. This happens both in open and run mode, and if I remove the cypress-cloud/support and cypress-cloud/plugin parts, the tests work. Any idea what is going on?

@anlambert
Copy link
Author

@agoldis I just upgraded to beta 3 and executed the cypress tests of the project I am working on, all good from my side and it indeed fixes the screenshots processing bug, see https://jenkins.softwareheritage.org/blue/organizations/jenkins/DWAPPS%2Fgitlab-builds/detail/gitlab-builds/306/pipeline/88.

Nevertheless, I only use sorry-cypress as tests orchestrator and do not use its reporting dashboards so I might miss other issues.

@estefafdez
Copy link

@anlambert what did you see on the cypress dashboard when the run is finished? did you see the results there?

@agoldis
Copy link
Contributor

agoldis commented Sep 11, 2023

@estefafdez @richardmward Please check out 1.10.0-beta.4 - it has a few additional fixes.

Also, the corrupted runs could have incompatible data, they should be removed from the DB.

@agoldis
Copy link
Contributor

agoldis commented Sep 11, 2023

@andreiho we need more data to explore the case - the debug logs would help

@anlambert
Copy link
Author

@estefafdez regarding the sorry-cypress dashboard feature, I bumped cypress-cloud to 1.10.0-beta.4 and tested it locally using that docker-compose.yml file to run the sorry-cypress kit. Everything seems to work as expected, see screenshots below:

image

image

@bilarallen
Copy link

bilarallen commented Sep 12, 2023

Anyone else experiencing tests just getting stuck and never finishing? I'm using [email protected] with [email protected], having followed the migration guide, and the tests start, but it just hangs after the first one. This happens both in open and run mode, and if I remove the cypress-cloud/support and cypress-cloud/plugin parts, the tests work. Any idea what is going on?

@andreiho I also experience this with npx cypress open The test hangs whenever I put import "cypress-cloud/support" in my e2e.js file but if I remove it there will be no problem with cypress runner.
image

One thing I also noticed is that whenever I check the cypress-cloud/support its index.d.ts file contains an empty export
image

here's additional info:
cypress version: 13.1.0
cypress-cloud version: 1.10.0-beta.4
node version: 20.5.0

@agoldis
Copy link
Contributor

agoldis commented Sep 12, 2023

@bilarallen thanks for elaborating on the issue. If that is reproducible, please share a standalone example or and debug logs (https://currents.dev/readme/integration-with-cypress/troubleshooting)

@bilarallen
Copy link

@bilarallen thanks for elaborating on the issue. If that is reproducible, please share a standalone example or and debug logs (https://currents.dev/readme/integration-with-cypress/troubleshooting)

Hi @agoldis This can only be replicated when running a test via cypress runner through npx cypress open command, here's my envinfo and I'll also include steps to replicate since this only be replicated when using cypress runner

System:
    OS: Linux 5.10 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5800U with Radeon Graphics
    Memory: 4.06 GB / 6.71 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.5.0 - ~/.nvm/versions/node/v20.5.0/bin/node
    npm: 9.8.0 - ~/.nvm/versions/node/v20.5.0/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
  npmPackages:
    @babel/eslint-parser: ^7.21.8 => 7.21.8 
    @currents/cli: ^4.0.3 => 4.0.3 
    @cypress/angular:  0.0.0-development 
    @cypress/mount-utils:  0.0.0-development 
    @cypress/react:  0.0.0-development 
    @cypress/react18:  0.0.0-development 
    @cypress/svelte:  0.0.0-development 
    @cypress/vue:  0.0.0-development 
    @cypress/vue2:  0.0.0-development 
    @cypress/webpack-batteries-included-preprocessor: ^3.0.2 => 3.0.2 
    @cypress/webpack-preprocessor: ^5.17.0 => 5.17.0 
    @faker-js/faker: ^7.6.0 => 7.6.0 
    babel-eslint: ^10.1.0 => 10.1.0 
    cy-verify-downloads: ^0.1.16 => 0.1.16 
    cypress: ^13.1.0 => 13.1.0 
    cypress-cloud: ^1.10.0-beta.4 => 1.10.0-beta.4 
    cypress-delete-downloads-folder: 0.0.3 => 0.0.3 
    cypress-network-idle: ^1.14.2 => 1.14.2 
    cypress-real-events: ^1.10.1 => 1.10.1 
    cypress-recurse: ^1.27.0 => 1.27.0 
    eslint: ^8.39.0 => 8.39.0 
    moment: ^2.29.4 => 2.29.4 
    moment-timezone: ^0.5.43 => 0.5.43 
    numeral: ^2.0.6 => 2.0.6 
    swagger-client: ^3.18.5 => 3.18.5 
    uuid: ^9.0.0 => 9.0.0 (8.3.2)
    xvfb: ^0.4.0 => 0.4.0 
  npmGlobalPackages:
    corepack: 0.19.0
    npm: 9.8.0

Steps to replicate when using cypress runner and importing cypress-cloud/support in e2e.js file:

1. Install and use cypress version 12.3.1
2. Install and use cypress-cloud version 1.10.0-beta.4
3. Go to cypress > support > e2e.js file
4. import `cypress-cloud/support` in e2e.js file
5. Run a test using cypress runner via `npx cypress open` command and select electron browser
6. Wait for test execution to finish and observe if it hang
7. Remove import `cypress-cloud/support` in e2e.js file and repeat steps 5 to 6

@henrikvolmer
Copy link

@agoldis @bilarallen : I'm experiencing the same issue with cypress open. Is there any solution yet?

@estefafdez
Copy link

Ok, for me is finally working with:

 "cypress": "13.1.0",
    "cypress-cloud": "1.10.0-beta.4",
    "cypress-debugger": "1.0.7",

image
image

@agoldis thanks!

@andreiho
Copy link

andreiho commented Sep 12, 2023

@agoldis @bilarallen I've been trying to create a reproducible example, but can't manage to. It appears to be related to some of the custom behaviour we have implemented to deal with some technicalities in our application. But I can't quite explain how importing the cypress-cloud code results in the tests hanging and cypress freezing completely. I'll try to give a bit more context into our situation.

We have a few custom commands which we run on most tests, in order to perform certain actions before proceeding with the test. In this case, the navigateTo command will wait for the page to finish loading, then wait for an element #alerts-holder to be present and attempt to clear any notifications using the clickNotificationButton command in order to prevent notifications covering up content which might need to be clicked in the test.

Now I've tried changing different things in these commands in an attempt to maybe fix some issues, but I can't quite get to the bottom of it, particularly why importing cypress-cloud ends up manifesting this way. It does however work if I simply just never call the clickNotificationButton command, even with cypress-cloud imported. The way the issue manifests is that the tests just freeze, along with the cypress browser, requiring a force quit of the process. It freezes so badly, that it makes the CPU on my M1 Pro go crazy.

This could of course be sub-optimal code on our part, but why would it only manifest itself this way while cypress-cloud is imported? I've tried looking at your plugin and support code, and with my limited knowledge I can't quite tell what could be causing issues there.

Our custom commands
export const navigateTo = (
  routePath = '/',
  options: { isLoggedIn?: boolean; force?: boolean } = {},
): void => {
  const url = new URL(`${Cypress.env('BASE_URL')}${routePath}`);
  const { force = false, isLoggedIn = true } = options;

  cy.url().then((href) => {
    if (force || href !== url.href) {
      cy.visit(url.href);
      cy.get('body').should('not.have.class', 'loading');

      if (isLoggedIn) {
        cy.get('#alerts-holder', { timeout: 20000 }).should('exist');
        cy.clickNotificationButton();
      }
    }
  });
};

export const clickNotificationButton = (
  buttonText?: string,
): Cypress.Chainable<JQuery<HTMLElement>> => {
  return cy
    .get('#alerts-holder')
    .as('alerts')
    .then(($aw) => {
      if (buttonText) {
        cy.get('@alerts')
          .contains(button, buttonText)
          .as('button')
          .then(() => {
            cy.get('@button').click();
          });
      } else if ($aw.find('[aria-label="close"]').length) {
        cy.safeClick(
          () => cy.get('#alerts-holder button[aria-label="close"]'),
          {
            multiple: true,
          },
        );
      }
    });
};

export const safeClick = (
  cySelectorFn: () => Cypress.Chainable<JQuery<HTMLElement>>,
  clickOpts?: Partial<Cypress.ClickOptions>,
): Cypress.Chainable<JQuery<HTMLElement>> => {
  return cy
    .waitUntil(
      () => {
        return cySelectorFn()
          .as('clickable')
          .wait(10) // https://github.com/cypress-io/cypress/issues/7306
          .then(($el) => Cypress.dom.isAttached($el));
      },
      { timeout: 1000, interval: 10 },
    )
    .get('@clickable')
    .click(clickOpts);
};

@andreiho
Copy link

andreiho commented Sep 12, 2023

Okay after poking around a bit more, I think I may have found the culprit. You can probably disregard most of what I said in my previous message, although I still think there's some relation between the how tests are written, and what happens further down.

The cypress-cloud/support file which you can see here has this piece of code attempting to stringify the entire test object using fast-safe-stringify. Without this safeStringify call, the tests run perfectly. I haven't looked deeper into what exactly happens, but the full test object looks like a fairly complex thing with circular references, which the lib might struggle with (even though it's designed for that), possibly resulting in a recursive loop of sorts and blocking everything else from executing.

cy.task(
  `currents:test:after:run`,
  safeStringify({
    ...test,
    fullTitle: test.fullTitle()
  }),
  {
    log: false
  }
);
Screenshot of the `test` object in my case Screenshot 2023-09-12 at 14 50 37

@agoldis
Copy link
Contributor

agoldis commented Sep 12, 2023

@andreiho thanks a lot for the detailed response. Any chance you can share the test / sample with me somehow? Another approach would be to put a breakpoint right before stringifying the result and make sure that the function returns.

@andreiho
Copy link

@agoldis I did try a breakpoint and calling the stringify function in the console, and it never returns, it just hangs indefinitely and the browser becomes virtually unusable, requiring force quit.

Haven't been able to put something useful together to share, as it seems somewhat related to some of the more complex orchestration of our application, with large number of requests made on load and various mocks and intercepts. The test itself is as simple as it gets, I tried running it on a dummy HTML webpage and everything works fine, which makes me think it's something else in the background that is part of the test object which the stringifier doesn't like. I might try manually inspecting that test object before/after commenting out some of the code I previously mentioned which seems to unblock the tests, and see what the differences are.

@agoldis
Copy link
Contributor

agoldis commented Sep 12, 2023

@andreiho would you be able to join a quick support call?

@andreiho
Copy link

@andreiho would you be able to join a quick support call?

@agoldis I'm not able right now, it's late here in Europe, but I'll try to do a bit more digging tomorrow at work and maybe see if I can somehow give you access to something reproducible.

@bilarallen
Copy link

bilarallen commented Sep 27, 2023

@bilarallen Thanks, that was helpful!

I can see that the log file has some missing some event that should have been emitted by cypress. Please try installing cypress-on-fix plugin as described here: https://github.com/currents-dev/cypress-cloud#event-callbacks-for-multiple-plugins and tell me if it fixed the issue.

Hi, @agoldis I tried to use the cypress-on-fix plugin and it worked! The screenshot in the failed/flaky run is now included, but it seems it spawned another issue wherein the screenshot didn't capture the error or the moment the test failed also there's some issue with the video timestamp this occurred in all test retries.

image

image

Also, there's one thing I noticed in terminal when running the test in cypress GUI (e2e) see my cypress config file particularly lines 43 and 46
image
image

@estefafdez
Copy link

Cypress 13 got us this error tonight:

20:08:25  [AWS CodeBuild Plugin] We've detected that you're using a 3rd party library that is not supported by Cypress: cli.js
20:08:25  [AWS CodeBuild Plugin] To continue running Cypress, please remove this library or reach out for help migrating.

it's working with cypress 12.17.4 but not working again with cypress 13 :(

@dangenendt
Copy link

@estefafdez
Same here... i guess, cypress now checks the dependencies and throw this error when they see "cypress-cloud" package.
Can we patch this? 🧐^^

@gmerwan
Copy link

gmerwan commented Sep 28, 2023

Same as @estefafdez
Has anyone found a solution for this ?

@estefafdez
Copy link

Right now, downgrade to cypress 12 (latest version) and wait until the currents teams think about a solution :(

@dangenendt
Copy link

dangenendt commented Sep 28, 2023

This will be hard one, i guess...
Seems like this check happens partially remote. If so, its an interesting point that cypress seems to call home with some repo infos 🤡
Our Pipeline already worked with cypress 13.2 since some days... so last night this check "has been activated" in some way

@estefafdez
Copy link

This will be hard one, i guess... Seems like this check happens partially remote. If so, its an interesting point that cypress seems to call home with some repo infos 🤡 Our Pipeline already worked with cypress 13.2 since some days... so last night this check "has been activated" in some way

Same on our side...

@anlambert
Copy link
Author

This will be hard one, i guess...
Seems like this check happens partially remote. If so, its an interesting point that cypress seems to call home with some repo infos 🤡
Our Pipeline already worked with cypress 13.2 since some days... so last night this check "has been activated" in some way

Same issue from my side, regardless cypress-cloud version used (tested with 1.10.0-beta.4 and 2.0.0-beta.1): https://jenkins.softwareheritage.org/blue/organizations/jenkins/DWAPPS%2Fgitlab-builds/detail/gitlab-builds/320/pipeline.

Curiously, I can run the tests locally without any issue:

$ CURRENTS_API_URL=http://localhost:1234 CURRENTS_PROJECT_ID=swh-web yarn run cypress-cloud run --record --key swh-web --parallel --ci-build-id build-2
yarn run v1.22.19
$ /home/anlambert/swh/swh-environment/swh-web/node_modules/.bin/cypress-cloud run --record --key swh-web --parallel --ci-build-id build-2
 WARNING  Failed to load config file, falling back to the default config. Attempted locations: [
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.js',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.cjs',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.mjs'
]

Copyright (C) 2023 Currents Software Inc https://currents.dev
This is free software, and you are welcome to redistribute it under certain
conditions. This program comes with no warranty. Parts of this program are MIT
licensed. Refer to the license for details
https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md

Cypress-cloud version: 2.0.0-beta.1
Cypress version: 13.3.0
Discovered 25 spec files
Tags: false; Group: false; Parallel: true; Batch Size: 3
Connecting to cloud orchestration service...
🎥 Run URL: http://localhost:8080/run/e455e0bdc0d3226e99bc24547f2ea7ab

====================================================================================================

Running: cypress/e2e/add-forge-now-request-dashboard.cy.js (2/25)

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        13.3.0                                                                         │
  │ Browser:        Electron 114 (headless)                                                        │
  │ Node Version:   v18.16.0 (/usr/bin/node)                                                       │
  │ Specs:          1 found (add-forge-now-request-dashboard.cy.js)                                │
  │ Searched:       cypress/e2e/add-forge-now-request-dashboard.cy.js                              │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  add-forge-now-request-dashboard.cy.js                                           (1 of 1)


  Test add forge now request dashboard load
    ✓ should load add forge request details
    ✓ should show send message link

...

@romankhomitskyi
Copy link

[cypress-cloud] Could not get cypress attempt error details
so that is the latest error?

@romankhomitskyi
Copy link

"cypress": "13.2.0",
"cypress-cloud": "2.0.0-beta.0",
Screenshot 2023-09-28 at 18 20 22
it does not upload screenshots when before all hook is failed

@jiangzhuo
Copy link

This will be hard one, i guess...
Seems like this check happens partially remote. If so, its an interesting point that cypress seems to call home with some repo infos 🤡
Our Pipeline already worked with cypress 13.2 since some days... so last night this check "has been activated" in some way

Same issue from my side, regardless cypress-cloud version used (tested with 1.10.0-beta.4 and 2.0.0-beta.1): https://jenkins.softwareheritage.org/blue/organizations/jenkins/DWAPPS%2Fgitlab-builds/detail/gitlab-builds/320/pipeline.

Curiously, I can run the tests locally without any issue:

$ CURRENTS_API_URL=http://localhost:1234 CURRENTS_PROJECT_ID=swh-web yarn run cypress-cloud run --record --key swh-web --parallel --ci-build-id build-2
yarn run v1.22.19
$ /home/anlambert/swh/swh-environment/swh-web/node_modules/.bin/cypress-cloud run --record --key swh-web --parallel --ci-build-id build-2
 WARNING  Failed to load config file, falling back to the default config. Attempted locations: [
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.js',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.cjs',
  'file:///home/anlambert/swh/swh-environment/swh-web/currents.config.mjs'
]

Copyright (C) 2023 Currents Software Inc https://currents.dev
This is free software, and you are welcome to redistribute it under certain
conditions. This program comes with no warranty. Parts of this program are MIT
licensed. Refer to the license for details
https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md

Cypress-cloud version: 2.0.0-beta.1
Cypress version: 13.3.0
Discovered 25 spec files
Tags: false; Group: false; Parallel: true; Batch Size: 3
Connecting to cloud orchestration service...
🎥 Run URL: http://localhost:8080/run/e455e0bdc0d3226e99bc24547f2ea7ab

====================================================================================================

Running: cypress/e2e/add-forge-now-request-dashboard.cy.js (2/25)

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        13.3.0                                                                         │
  │ Browser:        Electron 114 (headless)                                                        │
  │ Node Version:   v18.16.0 (/usr/bin/node)                                                       │
  │ Specs:          1 found (add-forge-now-request-dashboard.cy.js)                                │
  │ Searched:       cypress/e2e/add-forge-now-request-dashboard.cy.js                              │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  add-forge-now-request-dashboard.cy.js                                           (1 of 1)


  Test add forge now request dashboard load
    ✓ should load add forge request details
    ✓ should show send message link

...

same here, I can run in my local successfully, but in lambda environment(Lambda function from a container image) got the 3rd party error. I also tried to run the docker image in my local with docker run, also got the 3rd party error.

@jiangzhuo
Copy link

Based on my experimental guesses, the logic for detection is in the cypress binary and does not require an internet connection, and there may be two points of detection:

  1. Is there cypress-cloud in node_modules
  2. is there currents.config.js in project root

@mix4242
Copy link

mix4242 commented Sep 29, 2023

https://www.cypress.io/blog/2023/09/25/defense-intellectual-property

@Roemer
Copy link

Roemer commented Sep 29, 2023

I am a bit confused. Cypress launched the Cypress Gateway Connector License, (costing around 5k$/y) so that a 3rd party recording solution can be used. And now that does not work? I could not test with the latest version of Sorry Cypress but I will get in touch with Cypress to check, if that should work with this license or not.

Edit: According to Cypress, it should work with a valid Cypress Connector Gateway license, I will give it a try next week.

@ssurendra549
Copy link

We are getting this error while running cypress in Jenkins pipeline -

"We've detected that you're using a 3rd party library that is not supported by Cypress: cypress-cloud
To continue running Cypress, please remove this library or reach out for help migrating."

below is my configuration:

"cypress": "^13.3.0",
"cypress-cloud": "^2.0.0-beta.1"

followed the migration document and made the changes accordingly - https://currents.dev/readme/integration-with-cypress/cypress-cloud/migration-to-cypress-13

@bilarallen
Copy link

The Cypress team is already investigating and working on a fix cypress-io/cypress#27924 it seems other libraries that do not make test recordings were also affected. 🤞 that this will solve the issue with currents, if not where do we go from here? 🥲

@tiehfood
Copy link

tiehfood commented Oct 5, 2023

Seems like cypress is not going to fix this. Ticket ist closed and I still get the error message after clearing the runner cache like described in the ticket

@agoldis
Copy link
Contributor

agoldis commented Oct 5, 2023

Hey everyone, we published the response with more details about the recent blocking, including the technical analysis. We need to change our approach because they will keep implementing new blockings. It requires careful planning and more time. Thanks for your patience and support!

@Roemer
Copy link

Roemer commented Oct 5, 2023

According to Cypress, they want to get this working for paying customers (like we are with the Cypress Gateway Connector) because they themselves do not have an on-premise dashboard. @agoldis did you ever have contact with Cypress directly? I am in contact with them and they need more details in order to fix it.

@agoldis
Copy link
Contributor

agoldis commented Oct 5, 2023

@Roemer

@papermana
Copy link

Would forking Cypress be a viable solution to this?

@Krivega
Copy link

Krivega commented Oct 12, 2023

Would forking Cypress be a viable solution to this?

I made a fork of cypress-cloud and renamed everything possible. And it worked for.version 13.3.0.
I also had to rename all environment variables, for example CURRENTS_API_URL

@estefafdez
Copy link

Would forking Cypress be a viable solution to this?

I made a fork of cypress-cloud and renamed everything possible. And it worked for.version 13.3.0. I also had to rename all environment variables, for example CURRENTS_API_URL

Could you share how to do it please?

@Krivega
Copy link

Krivega commented Oct 21, 2023

Would forking Cypress be a viable solution to this?

I made a fork of cypress-cloud and renamed everything possible. And it worked for.version 13.3.0. I also had to rename all environment variables, for example CURRENTS_API_URL

Could you share how to do it please?

https://www.npmjs.com/package/@krivega/cc

This is a temporary solution, now I am afraid that they will block it too)

@GeuntaBuwono
Copy link

so it's dead end of 3rd party self hosted cypress monitor ? 😭

@agoldis
Copy link
Contributor

agoldis commented Feb 2, 2024

@agoldis agoldis added wontfix This will not be worked on and removed bug Something isn't working labels Oct 25, 2024
@tomasjanicek
Copy link

cypress has already released stable version 14.0.0.. so isn't it time to support the latest version cypress 13 stably?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests