Skip to content

Instantly share code, notes, and snippets.

@NiGhTTraX
Last active June 19, 2019 10:25
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 NiGhTTraX/32be6ad38b4220285df65ab73243f544 to your computer and use it in GitHub Desktop.
Save NiGhTTraX/32be6ad38b4220285df65ab73243f544 to your computer and use it in GitHub Desktop.
Simple example of a browser test using Mocha, Chai and WebdriverIO
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