I am trying to launch Cypress testing on my nx monorepo but it won't work.
It gives me this error when entering this command : nx run plate-e2e:e2e (plate beeing a library)
Related
When I run all my component cypress tests locally on a Macbook pro on a react-vite project with around ~10 tests, I get the following error:
An uncaught error was detected outside of a test:
TypeError: The following error originated from your test code, not from Cypress.
> Failed to fetch dynamically imported module: http://localhost:5173/__cypress/src/cypress/support/component.ts
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
the error is not Consistant and doesn't show up on every run. It also throws on a random test every run. How can I solve this?
update: I think a possible lead could be that I import files on my project with the absolute paths pattern.
For example:
import {comp1, comp2} from 'components'
where as components is configured in my tsconfig.ts file
ok so after countless attempts to fix this and also encountering terminal freezes when I execute
cypress run.
I've gave up and created a bash script to run each of the tests in the code base separately:
set -x
#!/bin/bash
for file in $( find . -type f -name '*.spec.cy.tsx' );
do yarn cypress run --component --browser chrome --spec $file || exit 1
done
for now it seems to get the job done. Hope this helps anyone else that encounters this
I'm running into an error in my testing environment for Typescript where jest <file-path> isn't working, but npm tests is. I have a sample file main.test.ts with the following test:
import * as main from './main';
test('is 1 + 1 = 2?', () => {
expect(1 + 1).toBe(2)
})
Running npm test I have no issues running my tests , and all are said to pass. However, running jest main.test.ts (and similar issues for jest ./src/main.test.ts) I am getting the following error:
Test suite failed to run
Jest encountered an unexpected token
To the best of my knowledge, npm is running jest so I don't see why this might be happening. Thanks
Helpppp ! I just want to get my pipeline run successfully T.T Anyone can help me here~
Situation: I am integrating Apollo client in my iOS project and following the instruction provided by official Apollo - https://www.apollographql.com/docs/ios/installation (using SPM way to setup). It works all fine for me in Xcode manual compile and testing. However, when I am using the command to run the unit test, I got stuck while generating Apollo GraphQL API. Below is the error I have received while running
xcodebuild test -scheme ${CI_PROJECT_NAME} -project ${CI_PROJECT_NAME}.xcodeproj -destination "${XCODE_APPLICATION_PLATFORM}" -enableCodeCoverage YES| xcpretty -s
Error: xcodebuild[10347:2192409] NSFileHandle couldn't write. Exception: *** -[_NSStdIOFileHandle writeData:]: Broken pipe
Note: This error occurs while I am running unit test through command line in Gitlab pipeline. Using Xcode 13.2.1.
I've a test cases written in cucumber and cypress. The test case run successfully through cypress Test runner, but fails while running through headless mode using the command.
node_modules\.bin\cypress run --spec **/*.features
CypressError: Timed out retrying: `cy.click()` failed because this element is not visible:
Questions:
what is the possible reason to have this element not visible error?
How can i handle the wait in headless mode?
The fix is :
Fix all your issues displayed on the console w.r.t xpaths, sync or
any such.
While running Cypress scripts, some of the cases are getting failed. I want to run only those failed cases to run again.
How can I run only failed test cases in Cypress?
As long as its not integrated directly in Cypess, you can use a npm package like cypress-run
npm install cypress-run --save
Then edit then run command in the package.json and replace the command
cypress run by for example cypress-run --retries 4, this will retry the failed tests 4 times
Cypress has released version 5.0 which has support for retries, see https://docs.cypress.io/guides/guides/test-retries.html for more information
Just add this line in your cypress.json file.
{
"retries":2
}
It will retry your failed Test case for twice.