Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 113b630

Browse files
authored
Use cypress-terminal-report (#11226)
* Use cypress-terminal-report This cypress plugin gives nice console logs about what is happening: I hope it will help us debug mysteriously failing tests. In its default config, it only logs for failing tests. * another anti-morgan hack * Disable collection of `console.debug` * `ctr:info` is not real
1 parent 8bba3bb commit 113b630

File tree

6 files changed

+58
-1
lines changed

6 files changed

+58
-1
lines changed

.github/workflows/cypress.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
record: true
175175
parallel: true
176176
command-prefix: "yarn percy exec --parallel --"
177-
config: '{"reporter":"cypress-multi-reporters", "reporterOptions": { "configFile": "cypress-ci-reporter-config.json" } }'
177+
config: '{"reporter":"cypress-multi-reporters", "reporterOptions": { "configFile": "cypress-ci-reporter-config.json" }, "morgan": false }'
178178
ci-build-id: ${{ needs.prepare.outputs.uuid }}
179179
env:
180180
# pass the Dashboard record key as an environment variable

cypress.config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ export default defineConfig({
3838
runMode: 4,
3939
openMode: 0,
4040
},
41+
42+
// disable logging of HTTP requests made to the Cypress server. They are noisy and not very helpful.
43+
// @ts-ignore https://github.com/cypress-io/cypress/issues/26284
44+
morgan: false,
4145
});

cypress/plugins/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
*/
1616

1717
/// <reference types="cypress" />
18+
import installLogsPrinter from "cypress-terminal-report/src/installLogsPrinter";
1819

1920
import PluginEvents = Cypress.PluginEvents;
2021
import PluginConfigOptions = Cypress.PluginConfigOptions;
@@ -35,4 +36,7 @@ export default function (on: PluginEvents, config: PluginConfigOptions) {
3536
slidingSyncProxyDocker(on, config);
3637
webserver(on, config);
3738
log(on, config);
39+
installLogsPrinter(on, {
40+
// printLogsToConsole: "always",
41+
});
3842
}

cypress/support/e2e.ts

+18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
import "@percy/cypress";
2020
import "cypress-real-events";
2121
import "@testing-library/cypress/add-commands";
22+
import installLogsCollector from "cypress-terminal-report/src/installLogsCollector";
2223

2324
import "./config.json";
2425
import "./homeserver";
@@ -39,3 +40,20 @@ import "./network";
3940
import "./composer";
4041
import "./proxy";
4142
import "./axe";
43+
44+
installLogsCollector({
45+
// specify the types of logs to collect (and report to the node console at the end of the test)
46+
collectTypes: [
47+
"cons:log",
48+
"cons:info",
49+
"cons:warn",
50+
"cons:error",
51+
// "cons:debug",
52+
"cy:log",
53+
"cy:xhr",
54+
"cy:fetch",
55+
"cy:request",
56+
"cy:intercept",
57+
"cy:command",
58+
],
59+
});

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
"cypress-each": "^1.13.3",
185185
"cypress-multi-reporters": "^1.6.1",
186186
"cypress-real-events": "^1.7.1",
187+
"cypress-terminal-report": "^5.3.2",
187188
"eslint": "8.43.0",
188189
"eslint-config-google": "^0.14.0",
189190
"eslint-config-prettier": "^8.5.0",

yarn.lock

+30
Original file line numberDiff line numberDiff line change
@@ -3618,6 +3618,17 @@ cypress-real-events@^1.7.1:
36183618
resolved "https://registry.yarnpkg.com/cypress-real-events/-/cypress-real-events-1.8.1.tgz#d00c7fe93124bbe7c0f27296684838614d24a840"
36193619
integrity sha512-8fFnA8EzS3EVbAmpSEUf3A8yZCmfU3IPOSGUDVFCdE1ke1gYL1A+gvXXV6HKUbTPRuvKKt2vpaMbUwYLpDRswQ==
36203620

3621+
cypress-terminal-report@^5.3.2:
3622+
version "5.3.2"
3623+
resolved "https://registry.yarnpkg.com/cypress-terminal-report/-/cypress-terminal-report-5.3.2.tgz#3a6b1cbda6101498243d17c5a2a646cb69af0336"
3624+
integrity sha512-0Gf/pXjrYpTkf2aR3LAFGoxEM0KulWsMKCu+52YJB6l7GEP2RLAOAr32tcZHZiL2EWnS0vE4ollomMzGvCci0w==
3625+
dependencies:
3626+
chalk "^4.0.0"
3627+
fs-extra "^10.1.0"
3628+
safe-json-stringify "^1.2.0"
3629+
semver "^7.3.5"
3630+
tv4 "^1.3.0"
3631+
36213632
cypress@^12.0.0:
36223633
version "12.16.0"
36233634
resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.16.0.tgz#d0dcd0725a96497f4c60cf54742242259847924c"
@@ -4781,6 +4792,15 @@ form-data@~2.3.2:
47814792
combined-stream "^1.0.6"
47824793
mime-types "^2.1.12"
47834794

4795+
fs-extra@^10.1.0:
4796+
version "10.1.0"
4797+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
4798+
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
4799+
dependencies:
4800+
graceful-fs "^4.2.0"
4801+
jsonfile "^6.0.1"
4802+
universalify "^2.0.0"
4803+
47844804
fs-extra@^11.0.0:
47854805
version "11.1.1"
47864806
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d"
@@ -7829,6 +7849,11 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1:
78297849
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
78307850
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
78317851

7852+
safe-json-stringify@^1.2.0:
7853+
version "1.2.0"
7854+
resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd"
7855+
integrity sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==
7856+
78327857
safe-regex-test@^1.0.0:
78337858
version "1.0.0"
78347859
resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295"
@@ -8581,6 +8606,11 @@ tunnel@^0.0.6:
85818606
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
85828607
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==
85838608

8609+
tv4@^1.3.0:
8610+
version "1.3.0"
8611+
resolved "https://registry.yarnpkg.com/tv4/-/tv4-1.3.0.tgz#d020c846fadd50c855abb25ebaecc68fc10f7963"
8612+
integrity sha512-afizzfpJgvPr+eDkREK4MxJ/+r8nEEHcmitwgnPUqpaP+FpwQyadnxNoSACbgc/b1LsZYtODGoPiFxQrgJgjvw==
8613+
85848614
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
85858615
version "0.14.5"
85868616
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"

0 commit comments

Comments
 (0)