Skip to content

Commit

Permalink
test case
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-bs committed Jun 12, 2023
1 parent 25cfec8 commit 76b6920
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion test/src/runner/testEventReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('testNightwatchEventReporter', function() {
});
});

it.only('Check reporter output on real time event', async function () {
it('Check reporter output on real time event', async function () {
let possibleError = null;
const testsPath = [path.join(__dirname, '../../sampletests/before-after/sampleWithBeforeAndAfterNoCallback.js')];

Expand Down
27 changes: 9 additions & 18 deletions test/src/runner/testRunnerScreenshotsOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ describe('testRunnerScreenshotsOutput', function () {
path.join(__dirname, '../../sampletests/withfailures')
];

let screenshotEventExecuted = false;

MockServer.addMock({
url: '/wd/hub/session/1352110219202/screenshot',
method: 'GET',
Expand All @@ -256,24 +258,11 @@ describe('testRunnerScreenshotsOutput', function () {
retryAssertionTimeout: 1,
reporter: function () {
},
onEvent: function({eventName, ...args}) {
assert.ok(['GlobalHookRunStarted',
'GlobalHookRunFinished',
'TestSuiteStarted',
'TestSuiteFinished',
'HookRunStarted',
'HookRunFinished',
'TestRunStarted',
'TestRunFinished',
'LogCreated',
'ScreenshotCreated'
].includes(eventName));

switch (eventName) {
case 'ScreenshotCreated':
assert.deepStrictEqual(Object.keys(args), ['path']);
break;
}
registerEventHandlers: function(eventBroadcaster) {
eventBroadcaster.on('ScreenshotCreated', (args) => {
assert.deepStrictEqual(Object.keys(args), ['path']);
screenshotEventExecuted = true;
});
}
},
screenshots: {
Expand All @@ -284,6 +273,8 @@ describe('testRunnerScreenshotsOutput', function () {
}
}))
.then(_ => {
assert.strictEqual(screenshotEventExecuted, true);

return readDirPromise(`${screenshotFilePath}/${moduleName}`);
})
.then(files => {
Expand Down

0 comments on commit 76b6920

Please sign in to comment.