Skip to content

Instantly share code, notes, and snippets.

@fgnass
Created July 20, 2017 20:50
Show Gist options
  • Save fgnass/a3ec174bcd5cbeb00c29c7418e6adeb5 to your computer and use it in GitHub Desktop.
Save fgnass/a3ec174bcd5cbeb00c29c7418e6adeb5 to your computer and use it in GitHub Desktop.
React E2E testing in Headless Chrome with unexpected.js and retractor
import webdriver from 'friendly-webdriver';
import unexpected from 'unexpected';
import unexpectedWebdriver from 'unexpected-webdriver';
import retractor from 'retractor';
const expect = unexpected.clone();
expect.use(unexpectedWebdriver());
/* @jsx retractor */
import TodoItem from './TodoItem';
var wd = webdriver({
base: 'http://localhost:5000',
browser: 'chrome',
capabilities: {
chromeOptions: {
args: ['headless', 'disable-gpu', 'window-size=1200x600']
}
}
});
test('mousetrap is to be built', async () => {
wd.goto('/todos');
const item = wd.find(<TodoItem title="Build a better mousetrap" completed={false} />);
return expect(item, 'to exist');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment