-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issues with sending results and completing a test run
- fixed an issue with the reporter completing the test run before all results are sent to Qase - fixed an issue with the reporter not sending all results to Qase Fixes #640 #558
- Loading branch information
Showing
7 changed files
with
171 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# [email protected] | ||
|
||
## What's new | ||
|
||
- fixed an issue with the reporter completing the test run before all results are sent to Qase | ||
- fixed an issue with the reporter not sending all results to Qase | ||
|
||
Need to add the following to the `cypress.config.js` file: | ||
|
||
```diff | ||
... | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
+ require('cypress-qase-reporter/plugin')(on, config); | ||
} | ||
} | ||
... | ||
``` | ||
|
||
# [email protected] | ||
|
||
## What's new | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "cypress-qase-reporter", | ||
"version": "2.0.3", | ||
"version": "2.1.0-beta.1", | ||
"description": "Qase Cypress Reporter", | ||
"homepage": "https://github.com/qase-tms/qase-javascript", | ||
"sideEffects": false, | ||
|
@@ -10,7 +10,8 @@ | |
".": "./dist/index.js", | ||
"./mocha": "./dist/mocha.js", | ||
"./reporter": "./dist/reporter.js", | ||
"./package.json": "./package.json" | ||
"./package.json": "./package.json", | ||
"./plugin": "./dist/plugin.js" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
|
@@ -44,7 +45,7 @@ | |
"author": "Qase Team <[email protected]>", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"qase-javascript-commons": "^2.0.0", | ||
"qase-javascript-commons": "~2.1.0-beta.1", | ||
"uuid": "^9.0.1" | ||
}, | ||
"peerDependencies": { | ||
|
@@ -58,5 +59,8 @@ | |
"jest": "^29.5.0", | ||
"mocha": "^10.2.0", | ||
"ts-jest": "^29.1.0" | ||
} | ||
}, | ||
"files": [ | ||
"plugin.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import { QaseReporter } from 'qase-javascript-commons'; | ||
|
||
|
||
const options = JSON.parse(process.env?.reporterConfig); | ||
const results = JSON.parse(process.env?.results); | ||
|
||
|
||
const runChild = async () => { | ||
setTimeout(() => { | ||
// do nothing | ||
}, 10000); | ||
} | ||
const reporter = QaseReporter.getInstance(options); | ||
reporter.setTestResults(results); | ||
|
||
await reporter.publish(); | ||
}; | ||
|
||
runChild(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/// <reference types="cypress" /> | ||
|
||
import { composeOptions, ConfigLoader, QaseReporter } from 'qase-javascript-commons'; | ||
import { configSchema } from './configSchema'; | ||
import PluginConfigOptions = Cypress.PluginConfigOptions; | ||
|
||
async function beforeRunHook(options: PluginConfigOptions) { | ||
const configLoader = new ConfigLoader(configSchema); | ||
const config = configLoader.load(); | ||
const { reporterOptions } = options; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const { ...composedOptions } = composeOptions(reporterOptions['cypressQaseReporterReporterOptions'], config); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
const reporter = QaseReporter.getInstance({ | ||
...composedOptions, | ||
frameworkPackage: 'cypress', | ||
frameworkName: 'cypress', | ||
reporterName: 'cypress-qase-reporter', | ||
}); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
await reporter.startTestRunAsync(); | ||
} | ||
|
||
async function afterRunHook(options: PluginConfigOptions) { | ||
|
||
const configLoader = new ConfigLoader(configSchema); | ||
const config = configLoader.load(); | ||
const { reporterOptions } = options; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const { ...composedOptions } = composeOptions(reporterOptions['cypressQaseReporterReporterOptions'], config); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
const reporter = QaseReporter.getInstance({ | ||
...composedOptions, | ||
frameworkPackage: 'cypress', | ||
frameworkName: 'cypress', | ||
reporterName: 'cypress-qase-reporter', | ||
}); | ||
|
||
await reporter.complete(); | ||
} | ||
|
||
module.exports = { | ||
beforeRunHook, | ||
afterRunHook, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { afterRunHook, beforeRunHook } from './hooks'; | ||
|
||
module.exports = function (on, config) { | ||
on('before:run', async () => { | ||
await beforeRunHook(config); | ||
}); | ||
|
||
on('after:run', async () => { | ||
await afterRunHook(config); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters