Last active
February 12, 2018 22:06
-
-
Save reubenmiller/aa7d58a937cc0758e4b6146b6163df84 to your computer and use it in GitHub Desktop.
[CodeceptJS] Using asserts in a custom Helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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