Last active
January 2, 2016 12:49
-
-
Save EndangeredMassa/8305915 to your computer and use it in GitHub Desktop.
testium examples
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
{getBrowser} = require 'testium' | |
assert = require 'assertive' | |
describe 'browse', -> | |
before -> | |
@browser = getBrowser() | |
@browser.navigateTo '/browse/chicago' | |
assert.equal 'status code', 200, @browser.getStatusCode() | |
it 'allows a user to search near a different division', -> | |
query = @browser.getElement '#search' | |
query.type 'pizza\n' | |
heading = @browser.getElement '.browse-title-heading' | |
text = heading.get 'text' | |
assert.equal 'pizza', text |
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
Testing against: phantomjs | |
screenshot | |
1) exists | |
0 passing (2s) | |
1 failing | |
1) exists | |
Error: Assertion failed: screenshot exists | |
Expected: true | |
Actually: false | |
[TESTIUM] Saved screenshot {app}/test/integration_log/screenshots/exists.png | |
at error ({app}/node_modules/assertive/lib/assertive.js:365:12) | |
at Object.assert.truthy ({app}/node_modules/assertive/lib/assertive.js:59:15) | |
at Context. ({app}/test/integration/dialog_test.js:29:23) | |
at Test.Runnable.run ({app}/node_modules/mocha/lib/runnable.js:211:32) | |
at Runner.runTest ({app}/node_modules/mocha/lib/runner.js:355:10) | |
at Runner.runTests.next ({app}/node_modules/mocha/lib/runner.js:401:12) | |
at next ({app}/node_modules/mocha/lib/runner.js:281:14) | |
at Runner.hooks ({app}/node_modules/mocha/lib/runner.js:290:7) | |
at next ({app}/node_modules/mocha/lib/runner.js:234:23) | |
at Runner.hook ({app}/node_modules/mocha/lib/runner.js:253:7) |
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
{getBrowser} = require 'testium' | |
assert = require 'assertive' | |
describe 'screenshots', -> | |
before -> | |
@browser = getBrowser() | |
@browser.navigateTo '/' | |
assert.equal 200, @browser.getStatusCode() | |
it 'can be taken', -> | |
data = @browser.getScreenshot() | |
assert.truthy data.length > 0 | |
it 'can be compared', -> | |
screenshot1 = @browser.getScreenshot() | |
screenshot2 = @browser.getScreenshot() | |
@browser.assert.imagesMatch(screenshot1, screenshot2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment