Skip to content

Instantly share code, notes, and snippets.

@mattonem
Last active October 8, 2021 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattonem/816ab5ccccd5e6cfef22bbc5a7331d15 to your computer and use it in GitHub Desktop.
Save mattonem/816ab5ccccd5e6cfef22bbc5a7331d15 to your computer and use it in GitHub Desktop.
browserstack/codeceptjs mark test session status
const event = require('codeceptjs').event;
module.exports = function() {
event.dispatcher.on(event.test.passed, function (test) {
const { I } = inject();
I.executeScript(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'All passed :)'}})}`);
});
event.dispatcher.on(event.test.failed, function (test) {
const { I } = inject();
I.executeScript(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'failed',reason: 'failed'}})}`);
});
event.dispatcher.on(event.test.started, function (test) {
const { I } = inject();
I.executeScript(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionName',arguments: {name: test.title}})}`);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment