Skip to content

Commit b929fd5

Browse files
committed
ci(tests): report cypress smoke tests in junit format for better test analytics
Also dont report the pytest that runis the cypress tests
1 parent 7e749ff commit b929fd5

File tree

5 files changed

+93
-1
lines changed

5 files changed

+93
-1
lines changed

smoke-test/smoke.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ if [[ "${TEST_STRATEGY}" == "pytests" ]]; then
4949
elif [[ "${TEST_STRATEGY}" == "cypress" ]]; then
5050
# run only cypress tests. The test inspects BATCH_COUNT and BATCH_NUMBER and runs only a subset of tests in that batch.
5151
# github workflow test matrix will invoke this in multiple runners for each batch.
52-
pytest -rP --durations=20 -vv --continue-on-collection-errors --junit-xml=junit.smoke-cypress${BATCH_NUMBER}.xml tests/cypress/integration_test.py
52+
# Skipping the junit at the pytest level since cypress itself generates junits on a per-test basis. The pytest is a single test for all cypress
53+
# tests and isnt very helpful.
54+
pytest -rP --durations=20 -vv --continue-on-collection-errors tests/cypress/integration_test.py
5355
else
5456
pytest -rP --durations=20 -vv --continue-on-collection-errors --junit-xml=junit.smoke-all.xml
5557
fi

smoke-test/tests/cypress/cypress.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ module.exports = defineConfig({
2323
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
2424
experimentalStudio: true,
2525
},
26+
reporter: "cypress-junit-reporter",
27+
reporterOptions: {
28+
mochaFile: "build/smoke-test-results/cypress-test-[hash].xml",
29+
toConsole: true,
30+
testCaseSwitchClassnameAndName: true,
31+
suiteNameTemplate: "{dirpath}",
32+
classNameTemplate: "{filepath}",
33+
},
2634
});

smoke-test/tests/cypress/cypress/support/e2e.js

+10
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ require("cypress-timestamps/support")({
2525
error: true,
2626
commandLog: true,
2727
});
28+
29+
// Add file name to test titles for better JUnit reporting
30+
beforeEach(function () {
31+
if (this.currentTest) {
32+
const testPath = this.currentTest.invocationDetails?.relativeFile;
33+
if (testPath) {
34+
this.currentTest.title = `${testPath}`;
35+
}
36+
}
37+
});

smoke-test/tests/cypress/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"dayjs": "^1.11.7"
1616
},
1717
"devDependencies": {
18+
"cypress-junit-reporter": "^1.3.1",
1819
"eslint": "^7.32.0 || ^8.2.0",
1920
"eslint-config-airbnb-base": "^15.0.0",
2021
"eslint-config-prettier": "^9.1.0",

smoke-test/tests/cypress/yarn.lock

+71
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ ansi-escapes@^4.3.0:
188188
dependencies:
189189
type-fest "^0.21.3"
190190

191+
ansi-regex@^3.0.0:
192+
version "3.0.1"
193+
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1"
194+
integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==
195+
191196
ansi-regex@^5.0.1:
192197
version "5.0.1"
193198
resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz"
@@ -416,6 +421,11 @@ chalk@^4.0.0, chalk@^4.1.0:
416421
ansi-styles "^4.1.0"
417422
supports-color "^7.1.0"
418423

424+
425+
version "0.0.2"
426+
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
427+
integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==
428+
419429
check-more-types@^2.24.0:
420430
version "2.24.0"
421431
resolved "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz"
@@ -518,6 +528,22 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2:
518528
shebang-command "^2.0.0"
519529
which "^2.0.1"
520530

531+
532+
version "0.0.2"
533+
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
534+
integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==
535+
536+
cypress-junit-reporter@^1.3.1:
537+
version "1.3.1"
538+
resolved "https://registry.yarnpkg.com/cypress-junit-reporter/-/cypress-junit-reporter-1.3.1.tgz#b7cbf2b592bf07522377c0b95d54fabbd0ed296e"
539+
integrity sha512-7agvD+Dpsdhk1FyX9GeIGQiICCmUcQFdetA1WF+ldY3pY2TQuznrThEXVem3ov+f7nyOaJNfyj0yX9e5lsoCVg==
540+
dependencies:
541+
debug "^2.2.0"
542+
md5 "^2.1.0"
543+
mkdirp "~0.5.1"
544+
strip-ansi "^4.0.0"
545+
xml "^1.0.0"
546+
521547
cypress-timestamps@^1.2.0:
522548
version "1.2.0"
523549
resolved "https://registry.npmjs.org/cypress-timestamps/-/cypress-timestamps-1.2.0.tgz"
@@ -590,6 +616,13 @@ dayjs@^1.11.7:
590616
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2"
591617
integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==
592618

619+
debug@^2.2.0:
620+
version "2.6.9"
621+
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
622+
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
623+
dependencies:
624+
ms "2.0.0"
625+
593626
debug@^3.1.0, debug@^3.2.7:
594627
version "3.2.7"
595628
resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz"
@@ -1340,6 +1373,11 @@ is-boolean-object@^1.1.0:
13401373
call-bind "^1.0.2"
13411374
has-tostringtag "^1.0.0"
13421375

1376+
is-buffer@~1.1.6:
1377+
version "1.1.6"
1378+
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
1379+
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
1380+
13431381
is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7:
13441382
version "1.2.7"
13451383
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
@@ -1625,6 +1663,15 @@ lru-cache@^6.0.0:
16251663
dependencies:
16261664
yallist "^4.0.0"
16271665

1666+
md5@^2.1.0:
1667+
version "2.3.0"
1668+
resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f"
1669+
integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==
1670+
dependencies:
1671+
charenc "0.0.2"
1672+
crypt "0.0.2"
1673+
is-buffer "~1.1.6"
1674+
16281675
merge-stream@^2.0.0:
16291676
version "2.0.0"
16301677
resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz"
@@ -1664,6 +1711,18 @@ minimist@^1.2.6:
16641711
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz"
16651712
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
16661713

1714+
mkdirp@~0.5.1:
1715+
version "0.5.6"
1716+
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
1717+
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==
1718+
dependencies:
1719+
minimist "^1.2.6"
1720+
1721+
1722+
version "2.0.0"
1723+
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
1724+
integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==
1725+
16671726
16681727
version "2.1.2"
16691728
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
@@ -2125,6 +2184,13 @@ string.prototype.trimstart@^1.0.7:
21252184
define-properties "^1.2.0"
21262185
es-abstract "^1.22.1"
21272186

2187+
strip-ansi@^4.0.0:
2188+
version "4.0.0"
2189+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
2190+
integrity sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==
2191+
dependencies:
2192+
ansi-regex "^3.0.0"
2193+
21282194
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
21292195
version "6.0.1"
21302196
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
@@ -2377,6 +2443,11 @@ wrappy@1:
23772443
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
23782444
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
23792445

2446+
xml@^1.0.0:
2447+
version "1.0.1"
2448+
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
2449+
integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==
2450+
23802451
yallist@^4.0.0:
23812452
version "4.0.0"
23822453
resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz"

0 commit comments

Comments
 (0)