ksocha / cypress-circleci-reporter Goto Github PK
View Code? Open in Web Editor NEWCypress test reporter for CircleCI
License: MIT License
Cypress test reporter for CircleCI
License: MIT License
Hi there,
First of all, thanks for this reporter - sure makes life easier.
Just a quick question. We run cypress twice in our circleci job. The first time with:
--config 'viewportWidth=375,viewportHeight=667'
and then again with
--config 'viewportWidth=1024,viewportHeight=800'
the tests should not really change too much in timings, but will this setup cause problems with this reporter? E.g. should I keep the results of each run in a different directory so they dont conflict with one another?
Hi,
I'm using this reporter with my CircleCI config and getting an error that is triggered by your line at
cypress-circleci-reporter/src/index.ts
Line 108 in 99b1b93
I don't understand why it tries to create resultsDir, even when I provide it with a path, and when I do, it says it already exists, because it still tries to create it. As you can see, I have my steps for storing Cypress tests and no need a plugin to try and create more paths, I could make a PR, but not sure if forcing mkdir in your code has a purpose, so just raising an issue for now.
Example errors:
Nothing is provided as resultsDir:
here
Full path provided:
here
My config:
version: 2.1
aliases:
- &persist_to_workspace
persist_to_workspace:
root: /home/circleci/join-test
paths: ["cypress_tests"]
- &attach_workspace
attach_workspace:
at: /home/circleci/join-test
executors:
browsers:
docker:
- image: circleci/node:12.6-browsers
working_directory: /home/circleci/join-test
commands:
auth_cypress_with_registry:
steps:
- run:
name: Authenticate with registry
command: cd cypress_tests && echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > .npmrc
npm_ci:
steps:
- run:
name: Install dependencies (npm ci)
command: cd cypress_tests && npm ci
save_cypress_cache:
steps:
- save_cache:
key: dep2-{{ .Branch }}-cache-{{ checksum "cypress_tests/package-lock.json" }}
paths:
- ~/.npm
- ~/.cache/Cypress
restore_cypress_cache:
steps:
- restore_cache:
key: dep2-{{ .Branch }}-cache-{{ checksum "cypress_tests/package-lock.json" }}
run_cypress_all:
steps:
- restore_cypress_cache
- run:
name: Run all cypress tests in parallel
no_output_timeout: 5m
command: |
cd cypress_tests && npx cypress run --spec "$(circleci tests glob "./cypress/integration/**/*.feature" | circleci tests split --split-by=timings --timings-type=filename | paste -sd "," -)" --reporter cypress-circleci-reporter --reporter-options resultsDir=results resultsFileName=cypress-$CIRCLE_BUILD_NUM
store_cypress_test_results:
steps:
- store_test_results:
path: cypress_tests/reports
- store_artifacts:
path: cypress_tests/reports
destination: cypress/reports
- store_artifacts:
path: cypress_tests/cypress/videos
destination: cypress/videos
- store_artifacts:
path: cypress_tests/cypress/screenshots
destination: cypress/screenshots
jobs:
build_cypress:
executor: browsers
steps:
- checkout
- restore_cypress_cache
- auth_cypress_with_registry
- npm_ci
- run:
name: cypress install
command: cd cypress_tests && npx cypress install
- save_cypress_cache
- *persist_to_workspace
pr_all:
executor: browsers
parallelism: 20
steps:
- *attach_workspace
- run_cypress_all
- store_cypress_test_results
lint:
working_directory: /home/circleci/join-test
docker:
- image: circleci/node:12.6
steps:
- checkout
- restore_cypress_cache
- auth_cypress_with_registry
- npm_ci
- run:
name: lint cypress
command: cd cypress_tests && npm run lint
- run:
name: check types cypress
command: cd cypress_tests && npm run ts:check
- run:
name: lint tags
command: cd cypress_tests && node scripts/validate_tags.js
workflows:
version: 2
build_test:
jobs:
- lint
- build_cypress
- pr_all:
requires:
- build_cypress
Hi!
I cannot figure out if I'm just missing some configuration or if I've encountered a bug.
I've added the reporter to my Cypress command on CircleCI and it is generating .xml-files in the test results folder.
However the report files are not including the file name of the spec, instead "file" is just empty.
Example below:
# test_results/cypress/cypress-5e9a03c5479c2136b2f0f8b114050eb8.xml
<testsuite name="cypress" timestamp="2020-11-02T13:14:06" time="11.3070" tests="4" failures="0" skipped="0">
...
<testcase name="guest cannot see assignments" file="" time="0.8800" classname="Learning > Assignments.signed out"/>
...
</testsuite>
This leads CircleCI to output the following on the next run:
...
Autodetect no matching filename or classname. If file names are used, double check paths for absolute vs relative.
Example input file: "cypress/integration/admin/course_versions_spec.js"
Example file from timings: ""
I tried switching to --timings-type=classname
for circleci tests split
but that didn't work either since the classnames stated in the reports file are not really class names.
Is this something you've encountered before?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.