I'm learning Nightwatch and have successfully got my first tests running. I'd now like to organise my tests a little better and use have a bunch of reusable common tests that I can build a main test with going forward. I've attempted to set this up using the code below but I'm not too familiar with Node exports, (truth be known I would prefer to use es6 import / export so if anyone can shed any light on this I'd be grateful) so I've probably made some fundamental error:
File structure
Tests
-auth
-- auth.js
index.js
nightwatch.json
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"selenium" : {
"start_process" : true,
"server_path" : "./bin/selenium-server-standalone-3.8.1.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
package.json
{
"name": "mostesting",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test-e2e": "nightwatch"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-plugin-add-module-exports": "^0.2.1",
"nightwatch": "^0.9.19",
"selenium-webdriver": "^4.0.0-alpha.1"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.24.1"
}
}
index.js
const auth = require('./auth/auth.js')
module.exports = {
'Log into system': auth.login()
}
auth.js
exports.login = function (client) {
client
.url('http://myurl.co.uk')
.waitForElementVisible('body', 1000)
.assert.title('Reach - Log in')
.assert.visible('#UserName')
.setValue('#UserName', 'XXXX')
.assert.visible('#Password')
.setValue('#Password', 'XXXX')
.assert.visible('input[value="Login"]')
.click('input[value="Login"]')
.waitForElementVisible('img.test', 10000, false)
}
When I run the test it opens, it runs and passes but at the end I get the following console error:
OK. 6 assertions passed. (8.549s)
There was an error while starting the test runner:
TypeError: Cannot read property 'url' of undefined
at Object.exports.login (/Applications/MAMP/htdocs/mostesting/tests/auth/auth.js:3:5)
at Object.<anonymous> (/Applications/MAMP/htdocs/mostesting/tests/index.js:4:27)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at new Module (/Applications/MAMP/htdocs/mostesting/node_modules/nightwatch/lib/runner/module.js:7:23)
Please can anyone point me to where I'm going wrong?
Many thanks in advance.
When you're defining your test run, no need to call test run function auth.login(). What you need is to export this function, so Nightwatch can execute it:
// index.js
const auth = require('./auth/auth.js')
module.exports = {
'Log into system': auth.login
}
Related
I'm trying to integrate some e2e tests into my react native (expo ejected) mobile project. I'm following the instructions found on the detox Getting Started page. I'm able to successfully build my project, but everytime I attempt the detox test command:
detox test --configuration ios --loglevel trace
I get the following error:
FAIL e2e/firstTest.e2e.jsrun...
● Test suite failed to run
TypeError: Class extends value #<Object> is not a constructor or null
at Object.<anonymous> (../node_modules/detox/runners/jest-circus/environment.js:24:38)
at Object.newLoader (../node_modules/pirates/lib/index.js:141:7)
at Object.<anonymous> (../node_modules/detox/runners/jest-circus/index.js:4:32)
09:07:59.324 detox[21032] ERROR: [cli.js] Command failed: jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' e2e
I have a fairly simple out-of-the-box configuration of detox and jest:
package.json
...
"detox": "^19.6.2"
"jest": "^27.0.0",
"jest-circus": "^27.5.1",
...
./e2e/config.json
{
"testEnvironment": "./environment",
"testRunner": "jest-circus/runner",
"testTimeout": 120000,
"testRegex": "\\.e2e\\.js$",
"reporters": ["detox/runners/jest/streamlineReporter"],
"verbose": true
}
./e2e/environment.js
const {
DetoxCircusEnvironment,
SpecReporter,
WorkerAssignReporter,
} = require('detox/runners/jest-circus');
class CustomDetoxEnvironment extends DetoxCircusEnvironment {
constructor(config, context) {
super(config, context);
// Can be safely removed, if you are content with the default value (=300000ms)
this.initTimeout = 300000;
// This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
// This is strictly optional.
this.registerListeners({
SpecReporter,
WorkerAssignReporter,
});
}
}
module.exports = CustomDetoxEnvironment;
.detoxrc.json
{
"testRunner": "jest",
"runnerConfig": "e2e/config.json",
"skipLegacyWorkersInjection": true,
"apps": {
"ios": {
"type": "ios.app",
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/Example.app",
"build": "xcodebuild -workspace ios/Example.xcworkspace -configuration release -scheme Example -sdk iphonesimulator -derivedDataPath ios/build"
},
"android": {
"type": "android.apk",
"binaryPath": "SPECIFY_PATH_TO_YOUR_APP_BINARY"
}
},
"devices": {
"simulator": {
"type": "ios.simulator",
"device": {
"type": "iPhone 12 Pro"
}
},
"emulator": {
"type": "android.emulator",
"device": {
"avdName": "Pixel_3a_API_30_x86"
}
}
},
"configurations": {
"ios": {
"device": "simulator",
"app": "ios"
},
"android": {
"device": "emulator",
"app": "android"
}
}
}
It can't be this hard. Any help would be greatly appreciated.
Able to solve using Jest 27.0.1
I asked on github because I had the same problem as you and they gave me this solution
It's my first time using CodeceptJs and I'm struggling to run my feature file as the IDE asks me to implement steps for my scenario but this is already done, so I feel it may be searching for them somewhere other than the specified under the codecept.conf.js file?
When I run npx codeceptjs gherkin:steps or snippets on the terminal I get this message saying Could not include object Step Definition from ./step_definitions/steps.js from module '/Users/myUser/IdeaProjects/codeceptjs_webdriver/step_definitions/steps.js' The "from" argument must be of type string. Received undefined .
I then move the step_definitions folder to inside features as read that this would be the default location for these and now get an inject is not defined error, which may be the actual cause for the issue I'm getting, but not sure what to do to fix it.
I've tried on IntelliJ Ultimate, Webstorm and VSCode but get the same on all of them.
basic.feature
Feature: Business rules
In order to achieve my goals
As a persona
I want to be able to interact with a system
Scenario: do something
Given I have a defined step
steps.js
const {Given} = require('cucumber');
const {I} = inject();
Given(/^I have a defined step$/, function () {
I.amOnPage('/');
});
codecept.conf.js
exports.config = {
output: './output',
helpers: {
WebDriver: {
url: 'https:www.google.com',
browser: 'chrome'
}
},
include: {
I: './steps_file.js'
},
mocha: {},
bootstrap: null,
teardown: null,
hooks: [],
gherkin: {
features: './features/*.feature',
steps: ['./step_definitions/steps.js']
},
plugins: {
screenshotOnFail: {
enabled: true
},
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
}
},
tests: './*_test.js',
name: 'codeceptjs_webdriver'
}
package.json
{
"name": "codeceptjs_webdriver",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"codeceptjs": "^3.0.0",
"cucumber": "^5.0.1"
},
"dependencies": {
"#codeceptjs/configure": "^0.6.0"
},
"description": ""
}
IntelliJ Ultimate 2020.2
And here my Github repo
Thank you very much.
It's working now and I've come back to update it here if useful to someone else.
Was able to keep the steps under step_definitions/steps folder (not the one inside the features folder). To fix the non implemented issue had to install the wdio dependency. In order for this to take effect properly through running npm install both node_modules and package-lock.json had to be deleted to be freshly regenerated.
updated package.json
{
"name": "codeceptjs_webdriver",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "npx codeceptjs run"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {},
"dependencies": {
"#wdio/selenium-standalone-service": "^6.6.2",
"codeceptjs": "^2.6.8",
"codeceptjs-assert": "0.0.4",
"webdriverio": "6.3.6"
},
"description": ""
}
updated codecept.conf.js
exports.config = {
output: './output',
helpers: {
WebDriver: {
url: 'https://www.google.com',
browser: 'chrome'
}
},
include: {
I: './steps_file.js'
},
mocha: {},
bootstrap: null,
teardown: null,
hooks: [],
gherkin: {
features: './features/*.feature',
steps: ['./step_definitions/steps.js']
},
plugins: {
wdio: {
enabled: true,
services: ['selenium-standalone']
// additional config for service can be passed here
},
screenshotOnFail: {
enabled: true
},
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
},
tests: './*_test.js',
name: 'codeceptjs_webdriver'
}
I want to add support for async / await functions for my project.
I install
"#babel/core": "^7.2.0",
"#babel/plugin-transform-runtime": "^7.2.0",
"#babel/preset-env": "^7.2.0",
"#babel/preset-es2015": "^7.0.0-beta.53",
"#babel/preset-stage-2": "^7.0.0",
"#babel/runtime": "^7.2.0",
It's my webpack.config.js
const Encore = require('#symfony/webpack-encore');
Encore
.setOutputPath('public/build')
.setPublicPath('/build')
.addEntry('app', './assets/app.js')
.enableSourceMaps(!Encore.isProduction())
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableVueLoader()
.configureBabel(function(babelConfig) {
babelConfig.presets.push('#babel/preset-env');
babelConfig.presets.push('#babel/preset-stage-2');
babelConfig.plugins.push('#babel/plugin-transform-runtime');
})
;
const config = Encore.getWebpackConfig();
config.externals = {
mode: 'development',
// global app config object
config: JSON.stringify({
apiUrl: 'http://localhost:80',
devServer: {
public: 'http://localhost:3000',
disableHostCheck: true,
},
})
};
config.node = {
fs: "empty"
};
module.exports = config;
When I run a server dev, I get an error.
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.
plugins: [
['some-plugin', {}],
['some-plugin', {}, 'some unique name'],
]
I can not understand what the problem is.
I also created a .babelrc file and wrote the same configuration in it. But unfortunately, this did not help (
Use .babelrc for change babel config like this. This file should be in your project root
{
"plugins": ["#babel/plugin-transform-runtime"],
"presets": [
[
"#babel/preset-env",
...
],
...
]
}
Then remove this from your webpack.config.js
.configureBabel(function(babelConfig) {
babelConfig.presets.push('#babel/preset-env');
babelConfig.presets.push('#babel/preset-stage-2');
babelConfig.plugins.push('#babel/plugin-transform-runtime');
})
After upgrading to react-native 0.56 I'm experiencing tons of babel reated errors on jest specs that used to run just fine.
I realize that react-native 0.56 requires babel7 and that's probably related but I don't have enough experience/understaanding in babel to figure out what I'm missing.
Some error examples:
/xxx/spec/Bootstrap.test.js:6
import thunk from 'redux-thunk';
^^^^^
SyntaxError: Unexpected identifier
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
another:
import { rootReducer } from '../store';
^
SyntaxError: Unexpected token {
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
My package.json jest config is as follows:
"jest": {
"preset": "react-native",
"collectCoverage": true,
"coverageReporters": [
"cobertura",
"lcov"
],
"coverageDirectory": "coverage",
"globals": {
"__TEST__": true
},
"moduleNameMapper": {
"styled-components": "<rootDir>/node_modules/styled-components/dist/styled-components.native.cjs.js"
},
"moduleDirectories": [
"node_modules",
"/"
],
"transformIgnorePatterns": [
"node_modules/(?!react-native|react-navigation)/"
],
"setupFiles": [
"jest-localstorage-mock",
"./node_modules/appcenter/test/AppCenterMock.js",
"./node_modules/appcenter-analytics/test/AppCenterAnalyticsMock.js",
"./node_modules/appcenter-crashes/test/AppCenterCrashesMock.js"
]
},
.babelrc is defined as follows:
{
"presets": ["react-native"],
"env": {
"development": {
"plugins": ["transform-class-properties"]
},
"test": {
"plugins": ["transform-class-properties"]
}
}
}
I also have the following devdependencies:
"#babel/core": "^7.0.0-beta.52",
"babel-core": "^7.0.0-beta.52",
"babel-eslint": "~8.2.5",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-class-properties": "~6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-expo": "~4.0.0",
"babel-preset-react-native": "^5.0.1",
"babel-preset-react-native-stage-0": "^1.0.1",
"babel-preset-stage-0": "^6.24.1",
I've tried several approaches but couldn't progress much.
Besides the jest environment, the application runs fine.
Details of the workaround I did to move on, while 0.57 wasn't ready:
Basically I had to create 2 config files:
jest-acceptance.config (with the following relevant snippets)
"preset": "react-native",
"transform": {
"^.+\\.js$": "<rootDir>/custom_b7_processor.js"
},
"testRegex": "(/test/.*|(\\.|/)spec)\\.js$",
jest-unit.config (with the following relevant snippets)
"preset": "react-native",
"testRegex": "(/test/.*|(\\.|/)test)\\.js$",
That custom_b7_processor, is some sort of internal code from react-native:
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* #format
* #flow
*/
/* eslint-disable */
'use strict';
const {transformSync: babelTransformSync} = require('#babel/core');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const babelRegisterOnly = require('metro-babel-register');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
const generate = require('#babel/generator').default;
const nodeFiles = RegExp(
[
'/local-cli/',
'/metro(?:-[^/]*)?/', // metro, metro-core, metro-source-map, metro-etc
].join('|'),
);
const nodeOptions = babelRegisterOnly.config([nodeFiles]);
babelRegisterOnly([]);
/* $FlowFixMe(site=react_native_oss) */
const transformer = require('metro/src/reactNativeTransformer');
module.exports = {
process(src /*: string */, file /*: string */) {
if (nodeFiles.test(file)) {
// node specific transforms only
return babelTransformSync(
src,
Object.assign(
{filename: file},
{sourceType: 'script', ...nodeOptions, ast: false},
),
).code;
}
const {ast} = transformer.transform({
filename: file,
localPath: file,
options: {
ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044
dev: true,
inlineRequires: true,
platform: '',
projectRoot: '',
retainLines: true,
sourceType: 'unambiguous', // b7 required. detects module vs script mode
},
src,
plugins: [
[require('#babel/plugin-transform-block-scoping')],
// the flow strip types plugin must go BEFORE class properties!
// there'll be a test case that fails if you don't.
[require('#babel/plugin-transform-flow-strip-types')],
[
require('#babel/plugin-proposal-class-properties'),
// use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
{loose: true},
],
[require('#babel/plugin-transform-computed-properties')],
[require('#babel/plugin-transform-destructuring')],
[require('#babel/plugin-transform-function-name')],
[require('#babel/plugin-transform-literals')],
[require('#babel/plugin-transform-parameters')],
[require('#babel/plugin-transform-shorthand-properties')],
[require('#babel/plugin-transform-react-jsx')],
[require('#babel/plugin-transform-regenerator')],
[require('#babel/plugin-transform-sticky-regex')],
[require('#babel/plugin-transform-unicode-regex')],
[
require('#babel/plugin-transform-modules-commonjs'),
{strict: false, allowTopLevelThis: true},
],
[require('#babel/plugin-transform-classes')],
[require('#babel/plugin-transform-arrow-functions')],
[require('#babel/plugin-transform-spread')],
[require('#babel/plugin-proposal-object-rest-spread')],
[
require('#babel/plugin-transform-template-literals'),
{loose: true}, // dont 'a'.concat('b'), just use 'a'+'b'
],
[require('#babel/plugin-transform-exponentiation-operator')],
[require('#babel/plugin-transform-object-assign')],
[require('#babel/plugin-transform-for-of'), {loose: true}],
[require('#babel/plugin-transform-react-display-name')],
[require('#babel/plugin-transform-react-jsx-source')],
],
});
return generate(
ast,
{
code: true,
comments: false,
compact: false,
filename: file,
retainLines: true,
sourceFileName: file,
sourceMaps: true,
},
src,
).code;
},
getCacheKey: createCacheKeyFunction([
__filename,
require.resolve('metro/src/reactNativeTransformer'),
require.resolve('#babel/core/package.json'),
]),
};
At my .babelrc I had to include the following:
"presets": ["./node_modules/babel-preset-react-native-b6"],
That is pointing to a fork I made of the babel preset that React-native was using at 0.56-
https://github.com/lhrolim/babel-preset-react-native.
At my package.json I had te following babel dependencies
"babel-preset-react-native": "~5.0.2",
"babel-preset-react-native-b6": "github:lhrolim/babel-preset-react-native",
The test scripts I used then:
"test": "npm run test-acc && npm run test-unit",
"test-acc": "jest --config=jest_acceptance-config.json",
"test-unit": "jest --config=jest_unit-config.json",
I believe there might be some redundancies here and there, but that's what worked for me.
I'm running a grunt test within a MEAN JS stack app and found an issue that I can't work out its cause.
Running webdriver-manager on its own, i.e. webdriver-manager start, works fine, but running via the grunt test task seems to fail.
I also noticed that the port is different (not 4444). Not sure how to change this either.
Running "protractor:e2e" (protractor) task
webdriver-manager path: /Users/valdy/Development/MeanJSApp/node_modules/protractor/bin/webdriver-manager
selenium standalone is up to date.
chromedriver is up to date.
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.0.115:64594/wd/hub
/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/atoms/error.js:108
var template = new Error(this.message);
^
UnknownError: Connection refused (Connection refused)
at new bot.Error (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
at Object.bot.response.checkResponse (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
at /Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:160:24
at promise.ControlFlow.runInFrame_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
at wrappedCtr.notify (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
at promise.Promise.notify_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
at Array.forEach (native)
at promise.Promise.notifyAll_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
at goog.async.run.processWorkQueue (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/goog/async/run.js:130:15)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:157:22)
at Function.webdriver.WebDriver.createSession (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:30)
at Builder.build (/Users/valdy/Development/MeanJSApp/node_modules/selenium-webdriver/builder.js:445:22)
at LocalDriverProvider.DriverProvider.getNewDriver (/Users/valdy/Development/MeanJSApp/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
at Runner.createBrowser (/Users/valdy/Development/MeanJSApp/node_modules/protractor/lib/runner.js:182:37)
at /Users/valdy/Development/MeanJSApp/node_modules/protractor/lib/runner.js:263:21
at _fulfilled (/Users/valdy/Development/MeanJSApp/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/Users/valdy/Development/MeanJSApp/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/Users/valdy/Development/MeanJSApp/node_modules/q/q.js:759:13)
at /Users/valdy/Development/MeanJSApp/node_modules/q/q.js:573:44
[launcher] Process exited with error code 1
>>
Warning: Tests failed, protractor exited with code: 1 Use --force to continue.
Aborted due to warnings.
This is the config for tests.js (/config/assets/tests.js):
'use strict';
module.exports = {
tests: {
// client: ['modules/*/tests/client/**/*.js'],
client: ['modules/forum/tests/client/**/*.js'],
// server: ['modules/*/tests/server/**/*.js'],
server: ['modules/forum/tests/server/**/*.js'],
e2e: ['modules/*/tests/e2e/**/*.js']
// e2e: ['modules/forum/tests/e2e/**/*.js']
}
};
I also found that protractor's config.json, under /node_module/protractor/config.json has this configuration:
{
"webdriverVersions": {
"selenium": "2.47.1",
"chromedriver": "2.19",
"iedriver": "2.47.0"
}
}
And this is my own protractor.config.js, in the root of the web app:
'use strict';
// Protractor configuration
var config = {
specs: ['modules/*/tests/e2e/*.js']
};
if (process.env.TRAVIS) {
config.capabilities = {
browserName: 'firefox'
};
}
exports.config = config;
And here is protractor's npm descriptor (/node_module/protractor/package.json):
{
"_args": [
[
{
"raw": "Protractor#2.5.1",
"scope": null,
"escapedName": "Protractor",
"name": "Protractor",
"rawSpec": "2.5.1",
"spec": "2.5.1",
"type": "version"
},
"/Users/valdy/Development/MeanJSApp"
]
],
"_from": "Protractor#2.5.1",
"_id": "protractor#2.5.1",
"_inCache": true,
"_location": "/protractor",
"_nodeVersion": "0.12.7",
"_npmUser": {
"name": "angularcore",
"email": "angular-core+npm#google.com"
},
"_npmVersion": "2.11.3",
"_phantomChildren": {
"boom": "2.10.1",
"chalk": "1.1.3",
"combined-stream": "1.0.5",
"core-util-is": "1.0.2",
"cryptiles": "2.0.5",
"ctype": "0.5.3",
"forever-agent": "0.6.1",
"graceful-readlink": "1.0.1",
"hoek": "2.16.3",
"inherits": "2.0.3",
"is-my-json-valid": "2.16.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"lru-cache": "2.7.3",
"oauth-sign": "0.8.2",
"sigmund": "1.0.1",
"sntp": "1.0.9",
"string_decoder": "0.10.31",
"stringstream": "0.0.5",
"tough-cookie": "2.3.2"
},
"_requested": {
"raw": "Protractor#2.5.1",
"scope": null,
"escapedName": "Protractor",
"name": "Protractor",
"rawSpec": "2.5.1",
"spec": "2.5.1",
"type": "version"
},
"_requiredBy": [
"#USER",
"/grunt-protractor-runner",
"/gulp-protractor"
],
"_resolved": "https://registry.npmjs.org/protractor/-/protractor-2.5.1.tgz",
"_shasum": "03d6c93cd7c268f4250177d55a2fec8a198372cd",
"_shrinkwrap": null,
"_spec": "Protractor#2.5.1",
"_where": "/Users/valdy/Development/MeanJSApp",
"author": {
"name": "Julie Ralph",
"email": "ju.ralph#gmail.com"
},
"bin": {
"protractor": "bin/protractor",
"webdriver-manager": "bin/webdriver-manager"
},
"bugs": {
"url": "https://github.com/angular/protractor/issues"
},
"dependencies": {
"accessibility-developer-tools": "~2.6.0",
"adm-zip": "0.4.4",
"glob": "~3.2",
"html-entities": "~1.1.1",
"jasmine": "2.3.2",
"jasminewd": "1.1.0",
"jasminewd2": "0.0.6",
"lodash": "~2.4.1",
"minijasminenode": "1.1.1",
"optimist": "~0.6.0",
"q": "1.0.0",
"request": "~2.57.0",
"saucelabs": "~1.0.1",
"selenium-webdriver": "2.47.0",
"source-map-support": "~0.2.6"
},
"description": "Webdriver E2E test wrapper for Angular.",
"devDependencies": {
"chai": "~3.3.0",
"chai-as-promised": "~5.1.0",
"cucumber": "~0.6.0",
"expect.js": "~0.2.0",
"express": "~3.3.4",
"jshint": "2.5.0",
"mocha": "2.3.3",
"rimraf": "~2.2.6"
},
"directories": {},
"dist": {
"shasum": "03d6c93cd7c268f4250177d55a2fec8a198372cd",
"tarball": "https://registry.npmjs.org/protractor/-/protractor-2.5.1.tgz"
},
"gitHead": "645133d557f1059d9e885f2566fc4c29ce7c19cc",
"homepage": "https://github.com/angular/protractor",
"keywords": [
"angular",
"test",
"testing",
"webdriver",
"webdriverjs",
"selenium"
],
"license": "MIT",
"main": "lib/protractor.js",
"maintainers": [
{
"name": "juliemr",
"email": "ju.ralph#gmail.com"
},
{
"name": "angularcore",
"email": "angular-core+npm#google.com"
}
],
"name": "protractor",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/angular/protractor.git"
},
"scripts": {
"pretest": "jshint lib spec scripts",
"start": "node testapp/scripts/web-server.js",
"test": "node scripts/test.js"
},
"version": "2.5.1"
}
Here is my best guess at what's going on:
You are launching with the selenium standalone server locally using your ip address and a port that is not 4444. This means that you did not select seleniumAddress: "http://localhost:4444/wd/hub" or directConnect: true. I'll have a code snippet below of what this looks like.
If you are launching locally and not on Travis, then Protractor launches by the Chrome browser by default. This also means that you should have downloaded the ChromeDriver.
You should upgrade from Protractor 2.5 to the latest. Protractor is strongly coupled with the entire stack: selenium-webdriver, the standalone server, browser drivers and browsers. If you are using an up-to-date browser and Protractor 2.5, then probably webdriver-manager downloaded old binaries that may be incompatible with your browser.
Here is the code snippet:
exports.config = {
// option 1. launches a selenium standalone server. this is helpful if
// you launch it with "webdriver-manager start"
// seleniumAddress: "http://localhost:4444/wd/hub",
//
// option 2. launch browser directly using browser binaries
// directConnect: true,
//
// option 3. do not include either seleniumAddress or directConnect
// and this option will launch the selenium standalone server using
// your ip address.
//
// option 4: launch with saucelabs or browserstack options
}
This file relates to this one where you define your config, set capabilities only for travis and export the config.
'use strict';
// Protractor configuration
var config = {
specs: ['modules/*/tests/e2e/*.js']
};
if (process.env.TRAVIS) {
config.capabilities = {
browserName: 'firefox'
};
}
exports.config = config;