I have reporter (mochawesome) set in cypress.json.
The thing is that this reporter is generating report .json and html files only when i run tests with "cypress run" command.
Is there a way to get reports for tests run via Cypress gui app ("cypress open") after clicking each individual test?
I'm on Ubuntu 18 and Cypress 5.5.0
Cypress wont publish results on a file, for tests run by test-runner
Related
We do not use the Component Testing feature in Cypress, which was introduced in version 10.x and above. Its an additional burden to close it every time before we land into the test runner.
You can use the --e2e flag when running Cypress via command line to launch directly to the end-to-end test suite. Assuming you're using npm, that would be:
npx cypress open --e2e
If you have a package.json file where you store your scripts, you can modify that script as well.
...
"cypress:open": "npx cypress open --e2e",
...
npm run cypress:open
We are using Cypress to automate UI test cases. We have recently integrated the cypress framework with test rail. It is able to create test run in test rail.
Issue:
We want all test run should go inside a test plan or any suite or any folder. Currently all test run are created independently(can be seen in screenshot below) in the test rail "Test Run and Results Tab" which pollutes the test rail dashboard.
Is there any one all test run should go inside a plan or any folder?
Solution I have tried:
1)I have tried providing test plan id in the reporter option but didn't work.
2)Have tried #architectnow/cypress-testrail-reporter as it uses Planid but seems some issue with this package. Getting error reporter not found.
Below is the cypress Test rail reporter config:
"domain":"xxxxx.testrail.io",
"username":"email",
"password":"pass",
"projectId":1,
"planId":17,
"suiteId":1,
"runName":"Cypress Automated Test Run"
Appreciate any help in this.
You can actually use this npm package https://www.npmjs.com/package/cypress-testrail-accumulative-reporter.
npm install cypress-testrail-accumulative-reporter --save-dev
It will create one single test run and also will not be closed automatically after all spec fiels will ran.
We have a set of Jasmine tests that run successfully in the local web server. http-server.
We would like to run these tests from the command line during the TeamCity build process without having to start a webserver.
Opening the html file with chrome using --disable-web-security flag results in
Failed to load module script: The server responded with a
non-JavaScript MIME type of "". Strict MIME type checking is enforced
for module scripts per HTML spec.
Probably because script references with type="module" in the SpecRunner.html file
<script src="../src/js/App/app.js" type="module"></script>
Jasmine tests are coupled to DOM/jQuery so that they need to be run in a browser. The SpecRunner html page includes script references with type="module".
How can we run these tests during a TeamCity build and fail the build if there are any test failures?
Thanks.
Here's my solution. We are already using jest for react tests and jest docs say
If you are using Jasmine, or a Jasmine like API (for example Mocha),
Jest should be mostly compatible, which makes it less complicated to
migrate to.
npm install jest puppeteer jest-puppeteer http-server
jest: To run the tests using Jasmine API
puppeteer: To run tests in headless chrome browser
http-server: Local webserver to navigate to the jasmine spec runner page
jest-puppeteer: To configure starting the local server before running the tests and stopping it afterwards
Add jest-puppeteer-config.json to start the server like this
Jest Puppeteer integrates a functionality to start a server when
running your test suite. It automatically closes the server when tests
are done.
Add a jest-puppeteer test to navigate to Jasmine SpecRunner page and assert that there are no failures.
Update your jest configuration docs
Create npm script to a run jest test that in turn runs Jasmine tests in the browser.
At this point, one should be able to run browser Jasmine tests from the command line locally or on the build server.
Here is a screenshot that shows the files and test run results both locally and on TeamCity.
How can we run these tests during a TeamCity build and fail the build
if there are any test failures?
This solution enabled us to restore around hundred legacy browser-coupled Jasmine tests as part of the build with minimum effort (did not have to update the tests).
Feel free to suggest alternatives.
I'm running protractor flake on Jenkins for automation testing using the framework protractor cucumber. Each time the tests run, a json is outputted. Is there a way to delete the old json output or a bash command that can detect if protractor flake is rerun. I have protractor flake set to have 3 attempts. So if protractor flake reruns the 3rd time, I don't want the 1st and 2nd json output from protractor cucumber to be in the folder.
That way the cucumber report won't have flake tests in it.
This is the command I have right now on Jenkins when I do a build:
rm -rf e2e/reports
mkdir e2e/reports
npm install
node flake e2e/staging.protractor.conf.js
There is an onCleanup field/function in the protractor config. I recommend using that to write yourself a function that will delete the files in /e2e/reports. You can use the exitcode to delete the file if the first or second attempt fails. This will be a little tricky as you will need to find a way to keep track of which iteration you are on so that the report doesn't get deleted if the third run fails also.
See the comments in the protractor config for more details.
How can I run my Cypress tests using:
cypress run --headed
but keep the test runner open at the end of the tests, like it is using the Cypress Test Runner in interactive mode (cypress open)?
I prefer cypress run --headed over cypress open, which require user interaction to launch the tests.
(The context in running the Cypress tests in continuous integration, but with xvfb and a vnc server, so the test runner can still be used once the tests are complete).
You should be able to run:
cypress run --headed --no-exit
As of version 3.0.2, the next patch release. See the PR here