Skip to content

Instantly share code, notes, and snippets.

@reubenmiller
Last active February 12, 2018 22:06
Show Gist options
  • Save reubenmiller/aa7d58a937cc0758e4b6146b6163df84 to your computer and use it in GitHub Desktop.
Save reubenmiller/aa7d58a937cc0758e4b6146b6163df84 to your computer and use it in GitHub Desktop.
[CodeceptJS] Using asserts in a custom Helper
'use strict';
const assert = require('assert');
const axios = require('axios');
let Helper = codecept_helper;
class MyHelper extends Helper {
async runMyAssert(expect) {
assert.equal(true, false);
}
async testLink(link) {
const response = await axios.get(link);
assert.equal(response.status, 400);
}
}
module.exports = MyHelper;
Feature('Assert Helper Tests');
Scenario('Call assert in page object', async (I) => {
await I.amOnPage('/');
I.runMyAssert('test');
});
Scenario('Test link', async (I) => {
await I.amOnPage('/');
I.testLink('https://google.com');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment