Skip to content

Instantly share code, notes, and snippets.

@leejsinclair
Last active August 19, 2018 06:25
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save leejsinclair/526fbf3788f497765d1f to your computer and use it in GitHub Desktop.
Save leejsinclair/526fbf3788f497765d1f to your computer and use it in GitHub Desktop.
Running protractor tests on codeship #testing #browser #selenium
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
// 'browserName': 'internet explorer', - special installation needed
// 'version':'10',
'browserName': 'chrome',
//'browserName': 'firefox'
},
baseUrl:'http://127.0.0.1:8080',
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['test/protractor/protractor.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
# -------------------------------------------
# 1. HTML website separate from API
# 2. HTML website is static HTML
# 3. API is mocked
# -------------------------------------------
# Install simple http server and protractor
npm install -g http-server protractor
# Download and install selenium webdrivers
webdriver-manager update
# Run web driver in background, keeping in mind it takes a few seconds to become responsive
nohup bash -c "webdriver-manager start 2>&1 &" && sleep 9
# Run local website, my website is contained within the ./app folder
http-server app > /dev/null &
# Run protractor tests
protractor protractor.conf.js
@sergiopvilar
Copy link

Hey @leejsinclair, I always get the Error while waiting for Protractor to sync with the page: {}, but only in Codeship, locally runs normally. Do you know what it can be?

@hugorodrigues
Copy link

+1

@bahout
Copy link

bahout commented Jan 12, 2015

How did you install 'internet explorer' browser on codeship?

@keithharvey
Copy link

@sergiovilar This definitely worked for me. Saw your error but was forgetting to run 'bower install' in the setup.

Copy link

ghost commented Mar 20, 2015

Hi, the config is working but all tests are failing in Codeship while on local env they're correct.

@ioanabote
Copy link

Hi, I also have the config working, the baseUrl is accessed successfully (I'm doing a print screen, and the main page is loaded correctly) but the first API request that I make fails with 405 Method not allowed (this being the login request all other tests fail). All tests are running fine on my local environment. I have a rails app with angularjs. Any thoughts why the API would return 405 only on Codeship?

@pdsullivan
Copy link

This was working for me for a while but all the sudden i started getting an error on the test step. Not really sure what changed. Is anybody else having an issue?

[launcher] Process exited with error code 1

/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/q/q.js:126
throw e;
^
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1123:19)
at Object.goog.loadModule (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1085:46)
at /home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1:6
at Object.Context.closure.goog.retrieveAndExecModule_ (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:135:8)
at <anonymous>:1:6
at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/_base.js:104:12)
at Object.goog.importScript_ (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:879:9)
at Object.goog.importModule_ (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:900:14)
at Object.goog.writeScripts_ (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1323:16)
at Object.goog.require (/home/rof/.nvm/v0.10.40/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:663:14)

@bondarewicz
Copy link

same as @pdsullivan here, even when using sause labs server instead of localhost...

@bondarewicz
Copy link

just found that there is BREAKING CHANGE: 1) Users will no longer be able to use node versions <4. 2
http://stackoverflow.com/a/33835026/1109957,

just updated node to 4.2.1 via nvm install 4.2.1 and all working again.
https://codeship.com/documentation/languages/nodejs/

@awhit012
Copy link

awhit012 commented Nov 21, 2016

For those of you running a Rails app, substitute this line:

# Run local website, my website is contained within the ./app folder

http-server app > /dev/null &

with this:
nohup bash -c "rails s &"

This will start the rails server in the background and continue to the next task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment