Created
July 20, 2017 20:50
-
-
Save fgnass/a3ec174bcd5cbeb00c29c7418e6adeb5 to your computer and use it in GitHub Desktop.
React E2E testing in Headless Chrome with unexpected.js and retractor
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 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