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

TypeError: Cannot read properties of undefined (reading 'tests') #61

Open
MelaAxel opened this issue May 3, 2024 · 7 comments
Open

Comments

@MelaAxel
Copy link
Contributor

MelaAxel commented May 3, 2024

Seeing a new error today, after re-starting our implementation process:

Everything starts out normally:

Will leave all specs to run to filter at run-time
 Starting TestRail Integration v2.10.0
 ....................................................
 Cypress: 13.8.1
 Browser: unknown
 System: win32 (10.0.22631)
 Base URL: null
 TestRail Domain: {domain]
 TestRail Mode: Create Run
 TestRail Project ID: 153
 TestRail Milestone ID:
 TestRail Suite ID:
 TestRail Run Name: Regression PoC __datetime__
 TestRail Include All Cases: false
 Ignore pending tests: true
 Screenshots: true
 Include All Failed Screenshots: false
 TestRun created in TestRail: Regression PoC 5/3/2024, 12:39:03 PM
 New TestRail Run: R12694
GET /__/ 200 7.579 ms - -

All my tests run and pass so I close Cypress and get the following:

An error was thrown in your plugins file while executing the handler for the after:spec event.

The error we received was:

TypeError: Cannot read properties of undefined (reading 'tests')
    at Reporter._afterSpec ({path}\node_modules\cypress-testrail\src\Reporter.js:140:41)
    at Object.handler ({path}\node_modules\cypress-testrail\src\Reporter.js:80:24)
    at invoke ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:185:18)
    at {path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:59:14
    at tryCatcher ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
    at Function.Promise.attempt.Promise.try ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29)
    at Object.wrapChildPromise ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:58:23)
    at RunPlugins.execute ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:164:21)
    at EventEmitter.<anonymous> ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:56:12)
    at EventEmitter.emit (node:events:519:28)
    at EventEmitter.emit (node:domain:488:12)
    at process.<anonymous> {path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
    at process.emit (node:events:519:28)
    at process.emit (node:domain:488:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
    at emit (node:internal/child_process:951:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Error:
      Expected DataContext to already have been set via setCtx. If this is a
      testing context, make sure you are calling "setCtx" in a before hook,
      otherwise check the application flow.

    at c (<embedded>:4315:138737)
    at Object.u (<embedded>:4359:75697)
    at Object.<anonymous> (<embedded>:4392:28989)
    at Object.tryCatcher ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
    at Object.execute ({path}\AppData\Local\Cypress\Cache\13.8.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:15:34)
    at C.close (<embedded>:4450:26869)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@MelaAxel
Copy link
Contributor Author

MelaAxel commented May 6, 2024

Looks like its an issue on my side as I tried reverting to the 2.9 version and I still get the error - Trying to figure it out, since we haven't changed anything since this was working last (except updating all dependencies)

@MelaAxel MelaAxel closed this as completed May 6, 2024
@MelaAxel MelaAxel reopened this May 6, 2024
@MelaAxel
Copy link
Contributor Author

MelaAxel commented May 6, 2024

After additional debugging, I still pretty sure this is on my side but I cannot figure out where or why... So I'm looking for additional help; please and thank you

@MelaAxel
Copy link
Contributor Author

MelaAxel commented May 6, 2024

A little more info/context:

  • I am only seeing this when I run cypress open; this doesn't log or show when I run the spec directly in headless
  • the test results are not being sent to testrail in either case
  • the run in testrail IS being created as intended
  • in either method, I am left with a created_run.json file at root

@MelaAxel
Copy link
Contributor Author

MelaAxel commented May 7, 2024

I pulled the last known good configuration from our repo into a clean directory and still got this error with the old npm i modules - now I'm wondering how I got this to work the one time...

An error was thrown in your plugins file while executing the handler for the after:spec event.

The error we received was:

TypeError: Cannot read properties of undefined (reading 'tests')
    at Reporter._afterSpec (..\GITTMP\WebUIAutomation\node_modules\cypress-testrail\src\Reporter.js:136:41)
    at Object.handler (..\GITTMP\WebUIAutomation\node_modules\cypress-testrail\src\Reporter.js:77:24)
    at invoke (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:185:18)
    at ..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:59:14
    at tryCatcher (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
    at Function.Promise.attempt.Promise.try (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29)
    at Object.wrapChildPromise (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:58:23)
    at RunPlugins.execute (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:164:21)
    at EventEmitter.<anonymous> (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:56:12)
    at EventEmitter.emit (node:events:519:28)
    at EventEmitter.emit (node:domain:488:12)
    at process.<anonymous> (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
    at process.emit (node:events:519:28)
    at process.emit (node:domain:488:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (..\AppData\Local\Cypress\Cache\13.5.1\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
    at emit (node:internal/child_process:951:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
^C^CTerminate batch job (Y/N)?
^C
PS ..\GITTMP\WebUIAutomation> npm list
[email protected] ..\GITTMP\WebUIAutomation
+-- @cypress/[email protected]
+-- @testing-library/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

@MelaAxel
Copy link
Contributor Author

MelaAxel commented May 7, 2024

Based on my various tests, I'm going to see if @boxblinkracer can shed any light (headbashingagainstwall)

@boxblinkracer
Copy link
Owner

hi there
so sorry for the late reply
ill check it out, give me a bit please :)

@MelaAxel
Copy link
Contributor Author

MelaAxel commented Sep 3, 2024

@boxblinkracer just wanted to check-in and see if we can help provide any additional info on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants