Skip to content

Commit

Permalink
Change dep of mocha-teamcity-reporter to be official release in… (#4643)
Browse files Browse the repository at this point in the history
* Change dep of mocha-teamcity-reporter to be official release instead of cypress branch

* Add regex replacement logic for 'duration='1234'' in teamcity reporter output

* Add snapshot test for teamcity reporter

* Add more reporteroptions to ensure no failures in tests
  • Loading branch information
jennifer-shehane authored and flotwig committed Jul 11, 2019
1 parent 941ee7f commit 42a2780
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 3 deletions.
59 changes: 59 additions & 0 deletions packages/server/__snapshots__/8_reporters_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,3 +697,62 @@ Error: this reporter threw an error
Learn more at https://on.cypress.io/reporters
`

exports['e2e reporters supports teamcity reporter and reporter options 1'] = `
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 1.2.3 │
│ Browser: FooBrowser 88 │
│ Specs: 1 found (simple_passing_spec.coffee) │
│ Searched: cypress/integration/simple_passing_spec.coffee │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: simple_passing_spec.coffee... (1 of 1)
##teamcity[testSuiteStarted name='top suite' flowId='12345']
##teamcity[testSuiteStarted name='simple passing spec' flowId='12345']
##teamcity[testStarted name='passes' captureStandardOutput='true' flowId='12345']
##teamcity[testFinished name='passes' duration='XXXX' flowId='12345']
##teamcity[testSuiteFinished name='simple passing spec' duration='XXXX' flowId='12345']
##teamcity[testSuiteFinished name='top suite' duration='XXXX' flowId='12345']
(Results)
┌──────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: X seconds │
│ Spec Ran: simple_passing_spec.coffee │
└──────────────────────────────────────────┘
(Video)
- Started processing: Compressing to 32 CRF
- Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ simple_passing_spec.coffee XX:XX 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
All specs passed! XX:XX 1 1 - - -
`
2 changes: 1 addition & 1 deletion packages/server/lib/reporter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ events = {
}

reporters = {
teamcity: "@cypress/mocha-teamcity-reporter"
teamcity: "mocha-teamcity-reporter"
junit: "mocha-junit-reporter"
}

Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"@cypress/commit-info": "2.1.4",
"@cypress/get-windows-proxy": "1.5.4",
"@cypress/icons": "0.7.0",
"@cypress/mocha-teamcity-reporter": "1.0.0",
"@ffmpeg-installer/ffmpeg": "1.0.17",
"ansi_up": "1.3.0",
"bluebird": "3.4.7",
Expand Down Expand Up @@ -156,6 +155,7 @@
"minimist": "1.2.0",
"mocha": "2.4.5",
"mocha-junit-reporter": "1.23.0",
"mocha-teamcity-reporter": "3.0.0",
"moment": "2.24.0",
"morgan": "1.9.1",
"node-machine-id": "1.1.10",
Expand Down
9 changes: 9 additions & 0 deletions packages/server/test/e2e/8_reporters_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,12 @@ describe "e2e reporters", ->
expect(json.stats).to.be.an('object')
expect(json.stats.failures).to.eq(0)
expect(json.stats.other).to.eq(3)

it "supports teamcity reporter and reporter options", ->
e2e.exec(@, {
spec: "simple_passing_spec.coffee"
expectedExitCode: 0
snapshot: true
reporter: "teamcity"
reporterOptions: "topLevelSuite=top suite,flowId=12345,useStdError='true',useStdError='true',recordHookFailures='true',actualVsExpected='true'"
})
6 changes: 6 additions & 0 deletions packages/server/test/support/helpers/e2e.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ replaceDurationSeconds = (str, p1, p2, p3, p4) ->

p1 + _.padEnd("X seconds", lengthOfExistingDuration)

replaceDurationFromReporter = (str, p1, p2, p3) ->
## duration='1589'

p1 + _.padEnd("X", p2.length, "X") + p3

replaceDurationInTables = (str, p1, p2) ->
## when swapping out the duration, ensure we pad the
## full length of the duration so it doesn't shift content
Expand Down Expand Up @@ -82,6 +87,7 @@ normalizeStdout = (str) ->
.replace(/(.+)(\/.+\.mp4)/g, "$1/abc123.mp4") ## replace dynamic video names
.replace(/(Cypress\:\s+)(\d\.\d\.\d)/g, "$1" + "1.2.3") ## replace Cypress: 2.1.0
.replace(/(Duration\:\s+)(\d+\sminutes?,\s+)?(\d+\sseconds?)(\s+)/g, replaceDurationSeconds)
.replace(/(duration\=\')(\d+)(\')/g, replaceDurationFromReporter) ## replace duration='1589'
.replace(/\((\d+ minutes?,\s+)?\d+ seconds?\)/g, "(X seconds)")
.replace(/\r/g, "")
.replace(/(Uploading Results.*?\n\n)((.*-.*[\s\S\r]){2,}?)(\n\n)/g, replaceUploadingResults) ## replaces multiple lines of uploading results (since order not guaranteed)
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/unit/reporter_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe "lib/reporter", ->
context ".create", ->
it "can create mocha-teamcity-reporter", ->
teamCityFn = sinon.stub()
mockery.registerMock("@cypress/mocha-teamcity-reporter", teamCityFn)
mockery.registerMock("mocha-teamcity-reporter", teamCityFn)

reporter = Reporter.create("teamcity")
reporter.setRunnables(@root)
Expand Down

4 comments on commit 42a2780

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 42a2780 Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.4.1/linux-x64/circle-develop-42a278084f36f32f2240873e24a84af4f204ab5f-132558/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.4.1/circle-develop-42a278084f36f32f2240873e24a84af4f204ab5f-132564/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 42a2780 Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.4.1/win32-x64/appveyor-develop-42a278084f36f32f2240873e24a84af4f204ab5f-25915940/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.4.1/win32-x64/appveyor-develop-42a278084f36f32f2240873e24a84af4f204ab5f-25915940/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 42a2780 Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.4.1/win32-ia32/appveyor-develop-42a278084f36f32f2240873e24a84af4f204ab5f-25915940/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.4.1/win32-ia32/appveyor-develop-42a278084f36f32f2240873e24a84af4f204ab5f-25915940/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 42a2780 Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.4.1/darwin-x64/circle-develop-42a278084f36f32f2240873e24a84af4f204ab5f-132575/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.4.1/circle-develop-42a278084f36f32f2240873e24a84af4f204ab5f-132574/cypress.tgz

Please sign in to comment.