Skip to content

Commit 0b6b85c

Browse files
authored
Cypress console logs (#6579)
* added new cypress plugin that prints out console logs to the cypress output logs. currently configured to only do so on failing tests Signed-off-by: Amndeep Singh Mann <[email protected]> * installed the dep Signed-off-by: Amndeep Singh Mann <[email protected]> * revert this commit - just used to generate a failing cypress test Signed-off-by: Amndeep Singh Mann <[email protected]> * linter Signed-off-by: Amndeep Singh Mann <[email protected]> * unsure why this is async Signed-off-by: Amndeep Singh Mann <[email protected]> * revert change Signed-off-by: Amndeep Singh Mann <[email protected]> --------- Signed-off-by: Amndeep Singh Mann <[email protected]>
1 parent 5194b43 commit 0b6b85c

File tree

6 files changed

+28
-5
lines changed

6 files changed

+28
-5
lines changed

apps/frontend/public/static/export/style.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cypress.config.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {defineConfig} from 'cypress';
2+
import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter';
23

34
export default defineConfig({
45
fixturesFolder: false,
@@ -7,7 +8,9 @@ export default defineConfig({
78
video: true,
89
chromeWebSecurity: false,
910
e2e: {
10-
setupNodeEvents(on, config) {},
11+
setupNodeEvents(on, config) {
12+
installLogsPrinter(on)
13+
},
1114
baseUrl: 'http://127.0.0.1:3000',
1215
supportFile: 'test/support/index.ts',
1316
specPattern: 'test/integration/**/*.cy.{js,jsx,ts,tsx}'

test/integration/registration.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ context('Registration', () => {
2828
);
2929
});
3030

31-
it('rejects emails that already exist', async () => {
31+
it('rejects emails that already exist', () => {
3232
registrationPage.register(CREATE_USER_DTO_TEST_OBJ);
3333
registrationPage.register(CREATE_USER_DTO_TEST_OBJ);
3434
toastVerifier.toastTextContains('Email must be unique');

test/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"cypress": "14.0.1"
1414
},
1515
"dependencies": {
16+
"cypress-terminal-report": "^7.1.0",
1617
"cypress-wait-until": "^3.0.2",
1718
"eslint-plugin-cypress": "^3.0.0",
1819
"json-server": "^0.17.0",

test/support/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/// <reference types="cypress" />
22

3+
import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector';
34
import 'cypress-wait-until';
45
import RegistrationPage from '../support/pages/RegistrationPage';
56
import DatabaseHelper from './helpers/DatabaseHelper';
67

8+
installLogsCollector();
9+
710
const databaseHelper = new DatabaseHelper();
811

912
beforeEach(function () {

yarn.lock

+18-2
Original file line numberDiff line numberDiff line change
@@ -7981,7 +7981,7 @@ compare-func@^2.0.0:
79817981
array-ify "^1.0.0"
79827982
dot-prop "^5.1.0"
79837983

7984-
compare-versions@^6.0.0:
7984+
compare-versions@^6.0.0, compare-versions@^6.1.1:
79857985
version "6.1.1"
79867986
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-6.1.1.tgz#7af3cc1099ba37d244b3145a9af5201b629148a9"
79877987
integrity sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==
@@ -8624,6 +8624,17 @@ custom-event-polyfill@^1.0.7:
86248624
resolved "https://registry.npmjs.org/custom-event-polyfill/-/custom-event-polyfill-1.0.7.tgz#9bc993ddda937c1a30ccd335614c6c58c4f87aee"
86258625
integrity sha512-TDDkd5DkaZxZFM8p+1I3yAlvM3rSr1wbrOliG4yJiwinMZN8z/iGL7BTlDkrJcYTmgUSb4ywVCc3ZaUtOtC76w==
86268626

8627+
cypress-terminal-report@^7.1.0:
8628+
version "7.1.0"
8629+
resolved "https://registry.npmjs.org/cypress-terminal-report/-/cypress-terminal-report-7.1.0.tgz#77f2f0f4380eaba43f8c88914defd8f638708988"
8630+
integrity sha512-CBXxY19HNX2VFcZ0uifomzs0kuYKCTb2pPgJmluiHI5XHvvbHPFufHAAacM8z/pSOtHoovo/WU+fxE5KcZ8C4Q==
8631+
dependencies:
8632+
chalk "^4.0.0"
8633+
compare-versions "^6.1.1"
8634+
fs-extra "^10.1.0"
8635+
process "^0.11.10"
8636+
superstruct "0.14.2"
8637+
86278638
cypress-wait-until@^3.0.2:
86288639
version "3.0.2"
86298640
resolved "https://registry.yarnpkg.com/cypress-wait-until/-/cypress-wait-until-3.0.2.tgz#c90dddfa4c46a2c422f5b91d486531c560bae46e"
@@ -11065,7 +11076,7 @@ fs-constants@^1.0.0:
1106511076
resolved "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
1106611077
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
1106711078

11068-
fs-extra@^10.0.0:
11079+
fs-extra@^10.0.0, fs-extra@^10.1.0:
1106911080
version "10.1.0"
1107011081
resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
1107111082
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
@@ -19158,6 +19169,11 @@ superagent@^9.0.1:
1915819169
qs "^6.11.0"
1915919170
semver "^7.3.8"
1916019171

19172+
19173+
version "0.14.2"
19174+
resolved "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz#0dbcdf3d83676588828f1cf5ed35cda02f59025b"
19175+
integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==
19176+
1916119177
supertest@^7.0.0:
1916219178
version "7.0.0"
1916319179
resolved "https://registry.yarnpkg.com/supertest/-/supertest-7.0.0.tgz#cac53b3d6872a0b317980b2b0cfa820f09cd7634"

0 commit comments

Comments
 (0)