Skip to content

Instantly share code, notes, and snippets.

@nofanto
Created June 28, 2020 13:07
Show Gist options
  • Save nofanto/3e50471fa8e8b7461c90d1deba05d409 to your computer and use it in GitHub Desktop.
Save nofanto/3e50471fa8e8b7461c90d1deba05d409 to your computer and use it in GitHub Desktop.
const { Helper } = codeceptjs;
class Profiler extends Helper {
// before/after hooks
/**
* @protected
*/
_before() {
// remove if not used
}
/**
* @protected
*/
_after() {
// remove if not used
}
// add custom methods here
// If you need to access other helpers
// use: this.helpers['helperName']
async startProfiling() {
const page = this.helpers['Puppeteer'].page;
//start profiler
await page.tracing.start({
path: `output/profile-${new Date().getTime()}.json.json`
});
}
async stopProfiling() {
const page = this.helpers['Puppeteer'].page;
//stop profiler
await page.tracing.stop();
}
}
module.exports = Profiler;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment