Notes on AngularJS apps testing through Karma and Protractor
Last active
December 31, 2015 22:48
-
-
Save elgalu/8055613 to your computer and use it in GitHub Desktop.
AngularJS apps testing through Karma and Protractor
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
// Browser capabilities examples | |
// PhantomJS | |
// Note this config assumes the executable is in the $PATH but you can force an absolute path if you like | |
selenium.webdriver.phantomjs.webdriver.WebDriver( | |
executable_path='phantomjs', | |
port=0, | |
desired_capabilities = { | |
'platform': 'ANY', | |
'browserName': 'phantomjs', | |
'version': '', | |
'javascriptEnabled': True | |
} | |
) |
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
// Make sure the page is an Angular page. | |
driver.executeAsyncScript(clientSideScripts.testForAngular, 10). | |
then(function(hasAngular) { | |
if (!hasAngular) { | |
throw new Error('Angular could not be found on the page ' + destination); | |
} | |
}); |
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
# Install PhantomJS | |
npm install phantomjs | |
#=> phantomjs@1.9.2-5 ; Binary available at ~/node_modules/phantomjs/lib/phantom/bin/phantomjs | |
# Test PhantomJS | |
phantomjs --version | |
#=> 1.9.2 | |
phantomjs --webdriver=9515 | |
#=> PhantomJS is launching GhostDriver... GhostDriver - Main - running on port 9515 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment