-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: removing uneeded config from existing tests * test: generate report local * feat: exit code 1 if fs fails
- Loading branch information
1 parent
8c251bc
commit 35a4893
Showing
7 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
File renamed without changes.
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,13 @@ | ||
{ | ||
"gridUrl": "http://selenium.com:4444/wd/hub", | ||
"baseline": "./e2eTests/generateHtmlReport/baseline", | ||
"latest": "./e2eTests/generateHtmlReport/mockImages", | ||
"generatedDiffs": "./e2eTests/generateHtmlReport/generatedDiffs", | ||
"report": "./e2eTests/generateHtmlReport/reports", | ||
"scenarios": [ | ||
{ | ||
"url": "http:/google.com/", | ||
"label": "homepage" | ||
}] | ||
} | ||
|
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,37 @@ | ||
/* globals expect */ | ||
|
||
import path from 'path'; | ||
import fs from 'fs'; | ||
import { execSync } from 'child_process'; | ||
import config from './generateReportConfig'; | ||
|
||
describe('e2e Tests for generating html report locally', () => { | ||
let dirPath; | ||
|
||
beforeEach(() => { | ||
dirPath = path.resolve(config.report); | ||
|
||
if (fs.existsSync(dirPath)) { | ||
const files = fs.readdirSync(dirPath); | ||
files.forEach(file => fs.unlinkSync(`${dirPath}/${file}`)); | ||
fs.rmdirSync(dirPath); | ||
} | ||
}); | ||
it('generates the report', () => { | ||
let exitCode = 0; | ||
|
||
try { | ||
const stdout = execSync( | ||
'node ./lib/bin/run.js generate-report --browser chrome --config e2eTests/generateHtmlReport/generateReportConfig.json' | ||
).toString(); | ||
//pipe stdout to Jest console | ||
console.log(stdout); | ||
} catch (error) { | ||
exitCode = error.status; | ||
} | ||
|
||
expect(exitCode).toEqual(0); | ||
const latestDirFiles = fs.readdirSync(dirPath); | ||
expect(latestDirFiles).toEqual(['index.html']); | ||
}); | ||
}); |
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
File renamed without changes.
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