diff --git a/system-tests/__snapshots__/reporters_spec.js b/system-tests/__snapshots__/reporters_spec.js index e2968728988c..dbb8308724fe 100644 --- a/system-tests/__snapshots__/reporters_spec.js +++ b/system-tests/__snapshots__/reporters_spec.js @@ -9,6 +9,8 @@ We searched for the reporter in these paths: Learn more at https://on.cypress.io/reporters Error: Cannot find module '/foo/bar/.projects/e2e/node_modules/module-does-not-exist' +Require stack: +- lib/reporter.js [stack trace lines] ` @@ -21,14 +23,14 @@ exports['e2e reporters supports junit reporter and reporter options 1'] = ` ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Cypress: 1.2.3 │ │ Browser: FooBrowser 88 │ - │ Specs: 1 found (simple_passing.cy.js) │ - │ Searched: cypress/e2e/simple_passing.cy.js │ + │ Specs: 2 found (simple_passing.cy.js, simple_failing.cy.js) │ + │ Searched: cypress/e2e/simple_passing.cy.js, cypress/e2e/simple_failing.cy.js │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ ──────────────────────────────────────────────────────────────────────────────────────────────────── - Running: simple_passing.cy.js (1 of 1) + Running: simple_passing.cy.js (1 of 2) (Results) @@ -51,6 +53,39 @@ exports['e2e reporters supports junit reporter and reporter options 1'] = ` - Finished processing: /XXX/XXX/XXX/cypress/videos/simple_passing.cy.js.mp4 (X second) +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: simple_failing.cy.js (2 of 2) + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 2 │ + │ Passing: 0 │ + │ Failing: 2 │ + │ Pending: 0 │ + │ Skipped: 0 │ + │ Screenshots: 2 │ + │ Video: true │ + │ Duration: X seconds │ + │ Spec Ran: simple_failing.cy.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Screenshots) + + - /XXX/XXX/XXX/cypress/screenshots/simple_failing.cy.js/simple failing spec -- fai (1280x720) + ls1 (failed).png + - /XXX/XXX/XXX/cypress/screenshots/simple_failing.cy.js/simple failing spec -- fai (1280x720) + ls2 (failed).png + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/simple_failing.cy.js.mp4 (X second) + + ==================================================================================================== (Run Finished) @@ -59,8 +94,10 @@ exports['e2e reporters supports junit reporter and reporter options 1'] = ` Spec Tests Passing Failing Pending Skipped ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ ✔ simple_passing.cy.js XX:XX 1 1 - - - │ + ├────────────────────────────────────────────────────────────────────────────────────────────────┤ + │ ✖ simple_failing.cy.js XX:XX 2 - 2 - - │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 1 1 - - - + ✖ 1 of 2 failed (50%) XX:XX 3 1 2 - - ` diff --git a/system-tests/test/reporters_spec.js b/system-tests/test/reporters_spec.js index 5add439b90d8..4941778b1916 100644 --- a/system-tests/test/reporters_spec.js +++ b/system-tests/test/reporters_spec.js @@ -36,22 +36,30 @@ describe('e2e reporters', () => { it('supports junit reporter and reporter options', function () { return systemTests.exec(this, { - spec: 'simple_passing.cy.js', + spec: 'simple_passing.cy.js,simple_failing.cy.js', snapshot: true, reporter: 'junit', reporterOptions: 'mochaFile=junit-output/result.[hash].xml,testCaseSwitchClassnameAndName=true', + expectedExitCode: 2, }) .then(() => { return glob(path.join(e2ePath, 'junit-output', 'result.*.xml')) .then((paths) => { - expect(paths.length).to.eq(1) + expect(paths.length).to.eq(2) + + return Promise.all([fs.readFileAsync(paths[0], 'utf8'), fs.readFileAsync(paths[1], 'utf8')]) + .then((results) => { + const str = results.join('') - return fs.readFileAsync(paths[0], 'utf8') - .then((str) => { expect(str).to.include('