Last active
June 19, 2019 10:25
-
-
Save NiGhTTraX/32be6ad38b4220285df65ab73243f544 to your computer and use it in GitHub Desktop.
Simple example of a browser test using Mocha, Chai and WebdriverIO
This file contains 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
import { remote } from 'webdriverio'; | |
import { expect } from 'chai'; | |
import { describe, it, before, after } from 'mocha'; | |
describe('Mugshot README', () => { | |
/* BROWSER SETUP */ | |
let browser!: ReturnType<typeof remote>; | |
before(async () => { | |
const options = { | |
hostname: 'localhost', | |
capabilities: { browserName: 'chrome' } | |
}; | |
browser = await remote(options); | |
}); | |
after(async () => { | |
await browser.deleteSession(); | |
}); | |
/* END BROWSER SETUP */ | |
it('should have a logo', async () => { | |
await browser.url('https://github.com/NiGhTTraX/mugshot/blob/master/README.md'); | |
const logo = await browser.$('img[alt=logo]'); | |
expect(await logo.isExisting()).to.be.true; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment