-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AndreyBelym/implement-provider
Implement provider
- Loading branch information
Showing
13 changed files
with
695 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[{.eslintrc,*.json,.travis.yml}] | ||
indent_size = 2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
"no-alert": "error", | ||
"no-array-constructor": "error", | ||
"no-caller": "error", | ||
"no-catch-shadow": "error", | ||
"no-console": "error", | ||
"no-eval": "error", | ||
"no-extend-native": "error", | ||
"no-extra-bind": "error", | ||
"no-implied-eval": "error", | ||
"no-iterator": "error", | ||
"no-label-var": "error", | ||
"no-labels": "error", | ||
"no-lone-blocks": "error", | ||
"no-loop-func": "error", | ||
"no-multi-str": "error", | ||
"no-native-reassign": "error", | ||
"no-new": "error", | ||
"no-new-func": "error", | ||
"no-new-object": "error", | ||
"no-new-wrappers": "error", | ||
"no-octal-escape": "error", | ||
"no-proto": "error", | ||
"no-return-assign": "error", | ||
"no-script-url": "error", | ||
"no-sequences": "error", | ||
"no-shadow": "error", | ||
"no-shadow-restricted-names": "error", | ||
"no-spaced-func": "error", | ||
"no-undef-init": "error", | ||
"no-unused-expressions": "error", | ||
"no-with": "error", | ||
"camelcase": "error", | ||
"comma-spacing": "error", | ||
"consistent-return": "error", | ||
"eqeqeq": "error", | ||
"semi": "error", | ||
"semi-spacing": ["error", {"before": false, "after": true}], | ||
"space-infix-ops": "error", | ||
"space-unary-ops": ["error", { "words": true, "nonwords": false }], | ||
"yoda": ["error", "never"], | ||
"brace-style": ["error", "stroustrup", { "allowSingleLine": false }], | ||
"eol-last": "error", | ||
"indent": ["error", 4, { "SwitchCase": 1 }], | ||
"key-spacing": ["error", { "align": "value" }], | ||
"max-nested-callbacks": ["error", 3], | ||
"new-parens": "error", | ||
"newline-after-var": ["error", "always"], | ||
"no-lonely-if": "error", | ||
"no-multiple-empty-lines": ["error", { "max": 2 }], | ||
"no-nested-ternary": "error", | ||
"no-underscore-dangle": "off", | ||
"no-unneeded-ternary": "error", | ||
"object-curly-spacing": ["error", "always"], | ||
"operator-assignment": ["error", "always"], | ||
"quotes": ["error", "single", "avoid-escape"], | ||
"keyword-spacing" : "error", | ||
"space-before-blocks": ["error", "always"], | ||
"prefer-const": "error", | ||
"no-path-concat": "error", | ||
"no-undefined": "error", | ||
"strict": "off", | ||
"curly": ["error", "multi-or-nest"], | ||
"dot-notation": "off", | ||
"no-else-return": "error", | ||
"one-var": ["error", "never"], | ||
"no-multi-spaces": ["error", { | ||
"exceptions": { | ||
"VariableDeclarator": true, | ||
"AssignmentExpression": true | ||
} | ||
}], | ||
"radix": "error", | ||
"no-extra-parens": "error", | ||
"new-cap": ["error", { "capIsNew": false }], | ||
"space-before-function-paren": ["error", "always"], | ||
"no-use-before-define" : ["error", "nofunc"], | ||
"handle-callback-err": "off" | ||
}, | ||
"env": { | ||
"node": 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
lib | ||
node_modules | ||
.screenshots | ||
.idea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- stable | ||
- '0.10' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
var path = require('path'); | ||
var gulp = require('gulp'); | ||
var babel = require('gulp-babel'); | ||
var mocha = require('gulp-mocha'); | ||
var sequence = require('gulp-sequence'); | ||
var del = require('del'); | ||
var nodeVersion = require('node-version'); | ||
var execa = require('execa'); | ||
|
||
|
||
var PACKAGE_PARENT_DIR = path.join(__dirname, '../'); | ||
var PACKAGE_SEARCH_PATH = (process.env.NODE_PATH ? process.env.NODE_PATH + path.delimiter : '') + PACKAGE_PARENT_DIR; | ||
|
||
|
||
gulp.task('clean', function () { | ||
return del('lib'); | ||
}); | ||
|
||
gulp.task('lint', function () { | ||
// TODO: eslint supports node version 4 or higher. | ||
// Remove this condition once we get rid of node 0.10 support. | ||
if (nodeVersion.major === '0') | ||
return null; | ||
|
||
var eslint = require('gulp-eslint'); | ||
|
||
return gulp | ||
.src([ | ||
'src/**/*.js', | ||
'test/**/*.js', | ||
'Gulpfile.js' | ||
]) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failAfterError()); | ||
}); | ||
|
||
gulp.task('build', ['lint', 'clean'], function () { | ||
return gulp | ||
.src('src/**/*.js') | ||
.pipe(babel()) | ||
.pipe(gulp.dest('lib')); | ||
}); | ||
|
||
gulp.task('test-mocha', ['build'], function () { | ||
if (!process.env.BROWSERSTACK_USERNAME || !process.env.BROWSERSTACK_ACCESS_KEY) | ||
throw new Error('Specify your credentials by using the BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables to authenticate to BrowserStack.'); | ||
|
||
process.env.NODE_PATH = PACKAGE_SEARCH_PATH; | ||
|
||
return gulp | ||
.src('test/mocha/**.js') | ||
.pipe(mocha({ | ||
ui: 'bdd', | ||
reporter: 'spec', | ||
timeout: typeof v8debug === 'undefined' ? 2000 : Infinity // NOTE: disable timeouts in debug | ||
})); | ||
}); | ||
|
||
gulp.task('test-testcafe', ['build'], function () { | ||
if (!process.env.BROWSERSTACK_USERNAME || !process.env.BROWSERSTACK_ACCESS_KEY) | ||
throw new Error('Specify your credentials by using the BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY environment variables to authenticate to BrowserStack.'); | ||
|
||
var testCafeCmd = path.join(__dirname, 'node_modules/.bin/testcafe'); | ||
|
||
var testCafeOpts = [ | ||
'browserstack:chrome', | ||
'test/testcafe/**/*.js', | ||
'-s', '.screenshots' | ||
]; | ||
|
||
// NOTE: we must add the parent of plugin directory to NODE_PATH, otherwise testcafe will not be able | ||
// to find the plugin. So this function starts testcafe with proper NODE_PATH. | ||
process.env.NODE_PATH = PACKAGE_SEARCH_PATH; | ||
|
||
var child = execa(testCafeCmd, testCafeOpts); | ||
|
||
child.stdout.pipe(process.stdout); | ||
child.stderr.pipe(process.stderr); | ||
|
||
return child; | ||
}); | ||
|
||
gulp.task('test', sequence('test-mocha', 'test-testcafe')); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 Developer Express Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# testcafe-browser-provider-browserstack | ||
[![Build Status](https://travis-ci.org/DevExpress/testcafe-browser-provider-browserstack.svg)](https://travis-ci.org/DevExpress/testcafe-browser-provider-browserstack) | ||
|
||
This plugin integrates [TestCafe](http://devexpress.github.io/testcafe) with the [BrowserStack Testing Cloud](https://browserstack.com/). | ||
|
||
## Install | ||
|
||
``` | ||
npm install testcafe-browser-provider-browserstack | ||
``` | ||
|
||
## Usage | ||
Before using this plugin, save the BrowserStack username and access key to environment variables `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY`. | ||
|
||
You can determine the available browser aliases by running | ||
``` | ||
testcafe -b browserstack | ||
``` | ||
|
||
If you run tests from the command line, use the alias when specifying browsers: | ||
|
||
``` | ||
testcafe "browserstack:[email protected]:Windows 10" "path/to/test/file.js" | ||
``` | ||
|
||
|
||
When you use API, pass the alias to the `browsers()` method: | ||
|
||
```js | ||
testCafe | ||
.createRunner() | ||
.src('path/to/test/file.js') | ||
.browsers('browserstack:[email protected]:Windows 10') | ||
.run(); | ||
``` | ||
|
||
Tip: you can skip version (`@53.0`) or/and OS name (`:Windows 10`). | ||
|
||
## Author | ||
Developer Express Inc. (https://devexpress.com) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "testcafe-browser-provider-browserstack", | ||
"version": "0.0.1", | ||
"description": "browserstack TestCafe browser provider plugin.", | ||
"repository": "https://github.com/DevExpress/testcafe-browser-provider-browserstack", | ||
"homepage": "https://github.com/DevExpress/testcafe-browser-provider-browserstack", | ||
"author": { | ||
"name": "Andrey Belym", | ||
"email": "[email protected]", | ||
"url": "https://github.com/DevExpress/testcafe-browser-provider-browserstack" | ||
}, | ||
"main": "lib/index", | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"test": "gulp test", | ||
"publish-please": "publish-please", | ||
"prepublish": "publish-please guard" | ||
}, | ||
"keywords": [ | ||
"testcafe", | ||
"browser provider", | ||
"plugin", | ||
"browserstack" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"babel-runtime": "^6.11.6", | ||
"browserstack-local": "^1.3.0", | ||
"desired-capabilities": "^0.1.0", | ||
"jimp": "^0.2.27", | ||
"os-family": "^1.0.0", | ||
"pinkie": "^2.0.4", | ||
"request": "^2.79.0", | ||
"request-promise": "^4.1.1" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^6.1.2", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-runtime": "^6.12.0", | ||
"babel-preset-es2015": "^6.13.2", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-stage-3": "^6.11.0", | ||
"chai": "^3.5.0", | ||
"del": "^2.2.2", | ||
"execa": "^0.4.0", | ||
"gulp": "^3.9.0", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-mocha": "^3.0.1", | ||
"gulp-sequence": "^0.4.6", | ||
"node-version": "^1.0.0", | ||
"publish-please": "^2.1.4", | ||
"testcafe": "^0.13.0", | ||
"tmp": "0.0.31" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compact": false, | ||
"presets": [ | ||
"es2015-loose", | ||
"babel-preset-stage-3" | ||
], | ||
"plugins": [ | ||
"transform-runtime", | ||
"add-module-exports" | ||
] | ||
} |
Oops, something went wrong.