Skip to content

Commit 8e8ef37

Browse files
committed
Add trailing 0 to Happy path tests screencast png's
Signed-off-by: Dmytro Nochevnov <dnochevn@redhat.com>
1 parent bbfae57 commit 8e8ef37

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

e2e/driver/CheReporter.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,6 @@ class CheReporter extends mocha.reporters.Spec {
7979
}
8080
});
8181

82-
runner.on('test end', async function (test: mocha.Test) {
83-
if (!TestConstants.TS_SELENIUM_EXECUTION_SCREENCAST) {
84-
return;
85-
}
86-
87-
const currentMethodIndex: number = methodIndex;
88-
let iterationIndex: number = 10000;
89-
90-
await screenCatcher.catchMethodScreen(test.title, currentMethodIndex, iterationIndex);
91-
});
92-
9382
runner.on('end', async function (test: mocha.Test) {
9483
// ensure that fired events done
9584
await driver.get().sleep(5000);

e2e/utils/ScreenCatcher.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@ export class ScreenCatcher {
3535

3636
const date: Date = new Date();
3737
const timeStamp: string = `(${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}:${date.getMilliseconds()})`;
38-
const screenshotPath: string = `${screenshotDir}/${screenshotIndex}-${methodName}-${timeStamp}.png`;
3938

40-
await this.catcheScreen(screenshotPath);
39+
// add trailing 0 to have screenshots list normally sorted by name, e.g. 00000009, 00000010, ...
40+
const formattedIndex: string = new Intl.NumberFormat('en-us', {minimumIntegerDigits: 8}).format(screenshotIndex).replace(/,/g, "");
41+
const screenshotPath: string = `${screenshotDir}/${formattedIndex}-${methodName}-${timeStamp}.png`;
42+
43+
await this.catchScreen(screenshotPath);
4144
}
4245

43-
async catcheScreen(screenshotPath: string) {
46+
async catchScreen(screenshotPath: string) {
4447
const screenshot: string = await this.driverHelper.getDriver().takeScreenshot();
4548
const screenshotStream = fs.createWriteStream(screenshotPath);
4649
screenshotStream.write(new Buffer(screenshot, 'base64'));

0 commit comments

Comments
 (0)