-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v5 working updates without screenshots * working refactor * finished writing tests
- Loading branch information
Showing
58 changed files
with
3,215 additions
and
2,920 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
"browser": true | ||
}, | ||
"env": { | ||
"mocha": true | ||
} | ||
"jest": true | ||
} | ||
} |
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ screenshots/ | |
phantom.log | ||
wdio-mochawesome-report/ | ||
mochawesome-report/ | ||
yarn-error.log |
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
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,6 +1,6 @@ | ||
{ | ||
"name": "wdio-mochawesome-reporter", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "A WebdriverIO plugin. Generates json results in Mochawesome format.", | ||
"author": "Jim Davis <[email protected]>", | ||
"homepage": "https://github.com/fijijavis/wdio-mochawesome-reporter.git#readme", | ||
|
@@ -9,21 +9,10 @@ | |
"type": "git", | ||
"url": "git+https://github.com/fijijavis/wdio-mochawesome-reporter.git" | ||
}, | ||
"main": "build/reporter.js", | ||
"directories": { | ||
"lib": "./lib" | ||
}, | ||
"main": "src/index.js", | ||
"scripts": { | ||
"build": "yarn clean && yarn compile", | ||
"clean": "rm -rf ./build && rm -rf ./screenshots", | ||
"compile": "babel src/ -d build/", | ||
"eslint": "eslint ./src test/", | ||
"hub:start": "phantomjs --webdriver=4444 2>&1 > phantom.log &", | ||
"hub:stop": "ps -eaf | grep -i phantomjs | awk {'print $2'} | xargs kill -9", | ||
"test:unit": "mocha ./src/**/*.spec.js --reporter mochawesome", | ||
"test:func:local": "yarn build && mocha ./test/specs/tests.js", | ||
"test:func": "mocha ./test/specs/tests.js", | ||
"buildreport": "marge --reportDir ./wdio-mochawesome-report/mochawesome ./wdio-mochawesome-report/wdiomochawesome.json" | ||
"lint": "eslint ./src test/", | ||
"test": "jest" | ||
}, | ||
"keywords": [ | ||
"mochawesome", | ||
|
@@ -36,33 +25,30 @@ | |
"url": "https://github.com/fijijavis/wdio-mochawesome-reporter/issues" | ||
}, | ||
"dependencies": { | ||
"json-stringify-safe": "^5.0.1", | ||
"mkdirp": "~0.5.1", | ||
"@wdio/reporter": "^5.7.8", | ||
"strip-ansi": "^5.2.0", | ||
"uuid": "~3.0.1" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "~6.24.1", | ||
"babel-core": "~6.25.0", | ||
"babel-eslint": "~7.2.1", | ||
"babel-istanbul": "~0.12.2", | ||
"babel-plugin-add-module-exports": "~0.2.1", | ||
"babel-preset-env": "~1.6.1", | ||
"babel-preset-stage-0": "~6.24.1", | ||
"chai": "~3.5.0", | ||
"del": "~2.2.0", | ||
"eslint": "~4.4.0", | ||
"eslint-config-standard": "~10.2.0", | ||
"eslint-plugin-import": "~2.7.0", | ||
"eslint-plugin-node": "~5.1.0", | ||
"eslint-plugin-promise": "~3.5.0", | ||
"eslint-plugin-standard": "~3.0.1", | ||
"mocha": "~3.4.1", | ||
"mochawesome": "^3.0.3", | ||
"wdio-mocha-framework": "~0.5.12", | ||
"wdio-selenium-standalone-service": "~0.0.8", | ||
"webdriverio": "^4.10.1" | ||
"jest": "^24.8.0", | ||
"jest-matchers": "^20.0.3" | ||
}, | ||
"contributors": [ | ||
"Jim Davis" | ||
] | ||
], | ||
"peerDependencies": { | ||
"@wdio/cli": "^5.8.4", | ||
"mochawesome-report-generator": "^3.1.5" | ||
}, | ||
"jest": { | ||
"testPathIgnorePatterns": [ | ||
"./src" | ||
] | ||
} | ||
} |
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,65 @@ | ||
const WDIOReporter = require('@wdio/reporter').default | ||
const Suite = require('./suite') | ||
const Stats = require('./stats') | ||
const Test = require('./test') | ||
|
||
class WdioMochawesomeReporter extends WDIOReporter { | ||
constructor (options) { | ||
options = Object.assign(options) | ||
super(options) | ||
} | ||
|
||
onRunnerStart (runner) { | ||
this.config = runner.config | ||
this.sanitizedCaps = runner.sanitizedCapabilities | ||
this.sessionId = runner.sessionId | ||
// mochawesome requires this root suite for HTML report generation to work properly | ||
this.results = { | ||
stats: new Stats(runner.start), | ||
suites: new Suite(true, {'title': ''}), | ||
copyrightYear: new Date().getFullYear() | ||
} | ||
} | ||
|
||
onSuiteStart (suite) { | ||
this.currSuite = new Suite(false, suite, this.sanitizedCaps) | ||
this.results.stats.incrementSuites() | ||
} | ||
|
||
onTestStart (test) { | ||
this.currTest = new Test(test, this.currSuite.uuid) | ||
this.currTest.addSessionContext(this.sessionId) | ||
} | ||
|
||
onAfterCommand (cmd) { | ||
const isScreenshotEndpoint = /\/session\/[^/]*\/screenshot/ | ||
if (isScreenshotEndpoint.test(cmd.endpoint) && cmd.result.value) { | ||
this.currTest.addScreenshotContext(cmd.result.value) | ||
} | ||
} | ||
|
||
onTestEnd (test) { | ||
// skipped tests do not emit the TestStart event | ||
if (!this.currTest) { | ||
this.currTest = new Test(test, this.currSuite.uuid) | ||
} | ||
this.currTest.duration = test._duration | ||
this.currTest.updateResult(test) | ||
this.currTest.context = JSON.stringify(this.currTest.context) | ||
this.currSuite.addTest(this.currTest) | ||
this.results.stats.incrementTests(this.currTest) | ||
} | ||
|
||
onSuiteEnd (suite) { | ||
this.currSuite.duration = suite.duration | ||
this.results.suites.addSuite(this.currSuite) | ||
} | ||
|
||
onRunnerEnd (runner) { | ||
this.results.stats.end = runner.end | ||
this.results.stats.duration = runner.duration | ||
this.write(JSON.stringify(this.results)) | ||
} | ||
} | ||
|
||
exports.default = WdioMochawesomeReporter |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.