Last active
August 29, 2015 14:01
-
-
Save jcheype/85d7dabc23ca5d43ffe3 to your computer and use it in GitHub Desktop.
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
system = require('system') | |
host = system.env.VULCAIN_PORT_8080_TCP_ADDR | |
port = system.env.VULCAIN_PORT_8080_TCP_PORT | |
screenshot = casper.cli.get('screenshot') || 'error.png'; | |
url = casper.cli.get('host') || 'http://'+host+':'+port; | |
casper.echo("## "+url) | |
casper.userAgent('CASPERJS TEST'); | |
casper.options.onWaitTimeout = -> casper.capture(screenshot) | |
casper.on('remote.message', (message) -> | |
casper.echo("## "+message) | |
) | |
casper.test.begin('Go to vulcain home page, login and logout', 6, (test) => | |
casper.start(url, => | |
casper.viewport(1280, 1024) | |
test.assertTitle("Vulcain", "Vulcain homepage title is the one expected") | |
test.assertExists('#login-button', "login button is found") | |
test.assertNotVisible('#authenticationLogin', "login is not visible") | |
casper.click('#login') | |
) | |
casper.then(=> | |
test.assertVisible('#authenticationLogin', "authenticationLogin field is visible") | |
test.assertVisible('#authenticationPassword', "authenticationPassword field is visible") | |
casper.sendKeys('#authenticationLogin', 'njancot') | |
casper.sendKeys('#authenticationPassword', 'failpassword') | |
casper.click('#login-button') | |
casper.waitForText("Problème d'authentification", (=>) , => test.fail("Error login not shown")) | |
) | |
casper.then(=> | |
casper.sendKeys('#authenticationPassword', 'njancot', {reset: true}) | |
casper.click('#login-button') | |
casper.waitUntilVisible('#logout-button') | |
) | |
casper.then(=> | |
test.assertVisible('#logout-button', "logout button is visible") | |
) | |
casper.run(-> casper.capture(screenshot); test.done() ) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment