From 241df0ba0aff2babee0555b93f0ee62749d1db03 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:03:33 +0100 Subject: [PATCH] Cypress: write logs to file (#11712) ... in an attempt to make the github actions output easier to grok --- .github/workflows/cypress.yaml | 3 ++- .gitignore | 2 ++ cypress-ci-reporter-config.json | 2 +- cypress/plugins/index.ts | 11 ++++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 67eb4edb80..20645118a8 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -224,13 +224,14 @@ jobs: matrix-react-sdk/cypress/screenshots matrix-react-sdk/cypress/videos matrix-react-sdk/cypress/synapselogs + matrix-react-sdk/cypress/results/cypresslogs - name: Upload reports if: always() uses: actions/upload-artifact@v3 with: name: cypress-junit - path: matrix-react-sdk/cypress/results + path: matrix-react-sdk/cypress/results/junit report: name: Report results diff --git a/.gitignore b/.gitignore index 489b5ccb39..ecab8be95f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ package-lock.json /cypress/screenshots /cypress/synapselogs /cypress/dendritelogs +/cypress/results + # These could have files in them but don't currently # Cypress will still auto-create them though... /cypress/performance diff --git a/cypress-ci-reporter-config.json b/cypress-ci-reporter-config.json index f43509ea30..e9f1330a6f 100644 --- a/cypress-ci-reporter-config.json +++ b/cypress-ci-reporter-config.json @@ -1,7 +1,7 @@ { "reporterEnabled": "spec, mocha-junit-reporter", "mochaJunitReporterReporterOptions": { - "mochaFile": "cypress/results/results-[hash].xml", + "mochaFile": "cypress/results/junit/results-[hash].xml", "useFullSuiteTitle": true } } diff --git a/cypress/plugins/index.ts b/cypress/plugins/index.ts index 2a8fed6cca..b0d2316a3a 100644 --- a/cypress/plugins/index.ts +++ b/cypress/plugins/index.ts @@ -50,6 +50,15 @@ export default function (on: PluginEvents, config: PluginConfigOptions) { config, ); installLogsPrinter(on, { - // printLogsToConsole: "always", + printLogsToConsole: "never", + + // write logs to cypress/results/cypresslogs/.txt + outputRoot: "cypress/results", + outputTarget: { + "cypresslogs|txt": "txt", + }, + + // strip 'cypress/e2e' from log filenames + specRoot: "cypress/e2e", }); }