Skip to content

Commit

Permalink
[ci-visibility] Test skipping logic for cypress (#3167)
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-fernandez authored Jun 1, 2023
1 parent bf2d95d commit 40740ae
Show file tree
Hide file tree
Showing 9 changed files with 415 additions and 151 deletions.
7 changes: 4 additions & 3 deletions integration-tests/ci-visibility-intake.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ class FakeCiVisIntake extends FakeAgent {
})
}

async stop () {
await super.stop()
stop () {
settings = DEFAULT_SETTINGS
suitesToSkip = DEFAULT_SUITES_TO_SKIP
gitUploadStatus = DEFAULT_GIT_UPLOAD_STATUS
infoResponse = DEFAULT_INFO_RESPONSE
this.removeAllListeners()
return super.stop()
}

// Similar to gatherPayloads but resolves if enough payloads have been gathered
Expand Down Expand Up @@ -230,7 +231,7 @@ class FakeCiVisIntake extends FakeAgent {
}, timeout || 15000)
const messageHandler = (message) => {
if (!payloadMatch || payloadMatch(message)) {
clearInterval(timeoutId)
clearTimeout(timeoutId)
resolve(message)
this.off('message', messageHandler)
}
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/ci-visibility.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ testFrameworks.forEach(({
receiver.assertPayloadReceived(() => {
const error = new Error('it should not report code coverage')
done(error)
}, ({ url }) => url === '/api/v2/citestcov')
}, ({ url }) => url === '/api/v2/citestcov').catch(() => {})

receiver.assertPayloadReceived(({ headers, payload }) => {
assert.propertyVal(headers, 'dd-api-key', '1')
Expand Down Expand Up @@ -774,7 +774,7 @@ testFrameworks.forEach(({
receiver.assertPayloadReceived(() => {
const error = new Error('it should not report code coverage')
done(error)
}, ({ url }) => url === '/evp_proxy/v2/api/v2/citestcov')
}, ({ url }) => url === '/evp_proxy/v2/api/v2/citestcov').catch(() => {})

receiver.assertPayloadReceived(({ headers, payload }) => {
assert.notProperty(headers, 'dd-api-key')
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/cucumber/cucumber.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ versions.forEach(version => {
receiver.assertPayloadReceived(() => {
const error = new Error('it should not report code coverage')
done(error)
}, ({ url }) => url.endsWith('/api/v2/citestcov'))
}, ({ url }) => url.endsWith('/api/v2/citestcov')).catch(() => {})

receiver.assertPayloadReceived(({ payload }) => {
const eventTypes = payload.events.map(event => event.type)
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/cypress-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"screenshotOnRunFailure": false,
"pluginsFile": "cypress/plugins-old/index.js",
"supportFile": "cypress/support/e2e.js",
"integrationFolder": "cypress/e2e"
"integrationFolder": "cypress/e2e",
"defaultCommandTimeout": 100
}
1 change: 1 addition & 0 deletions integration-tests/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
defaultCommandTimeout: 100,
e2e: {
setupNodeEvents (on, config) {
require('dd-trace/ci/cypress/plugin')(on, config)
Expand Down
Loading

0 comments on commit 40740ae

Please sign in to comment.