Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing bot #325

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
.idea

# Tests
sauce_connect.log
/coverage
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ cache:
- node_modules
env:
global:
- SAUCE_USERNAME=flowjs
- SAUCE_ACCESS_KEY=53e609a9-cb5d-4eac-a888-aa5419836f19
- CC_TEST_REPORTER_ID=64800c476bad6ab9d10d0ff0901ae2c211457852f28c5f960ae5165c1fdfec73
- CODECLIMATE_REPO_TOKEN=64800c476bad6ab9d10d0ff0901ae2c211457852f28c5f960ae5165c1fdfec73

Expand All @@ -19,8 +17,6 @@ matrix:
node_js: "14"
- env: TEST='browser-tests'
node_js: "14"
addons:
sauce_connect: true
allow_failures:
- env: TEST='browser-tests'

Expand Down
14 changes: 0 additions & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ module.exports = function(grunt) {
singleRun: true,
browsers: ['Firefox'],
reporters: ['progress', 'coverage'],
},
saucelabs: {
singleRun: true,
reporters: ['progress', 'saucelabs'],
// global config for SauceLabs
sauceLabs: {
testName: 'flow.js',
username: grunt.option('sauce-username') || process.env.SAUCE_USERNAME,
accessKey: grunt.option('sauce-access-key') || process.env.SAUCE_ACCESS_KEY,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
startConnect: false
}
}
},
clean: {
Expand Down Expand Up @@ -61,8 +49,6 @@ module.exports = function(grunt) {
if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key);
}

// Default task.
grunt.registerTask('default', ['test']);
// Release tasks
grunt.registerTask('build', ['exec:build']);
grunt.registerTask('release', function(type) {
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Flow.js [![Build Status](https://travis-ci.org/flowjs/flow.js.svg)](https://travis-ci.org/flowjs/flow.js) [![Test Coverage](https://codeclimate.com/github/flowjs/flow.js/badges/coverage.svg)](https://codeclimate.com/github/flowjs/flow.js/coverage) [![Saucelabs Test Status](https://saucelabs.com/browser-matrix/flowjs.svg)](https://saucelabs.com/u/flowjs) [![Inline docs](http://inch-ci.org/github/flowjs/flow.js.svg?branch=master)](http://inch-ci.org/github/flowjs/flow.js)
# Flow.js [![Build Status](https://travis-ci.org/flowjs/flow.js.svg)](https://travis-ci.org/flowjs/flow.js) [![Test Coverage](https://codeclimate.com/github/flowjs/flow.js/badges/coverage.svg)](https://codeclimate.com/github/flowjs/flow.js/coverage) [![TestingBot Test Status](https://testingbot.com/buildstatus/5d800834dbe71830e9604d5e8944e0fc?auth=bb00c9fad42a55cf278d37d1416fb8d0)](https://testingbot.com/builds/5d800834dbe71830e9604d5e8944e0fc?auth=bb00c9fad42a55cf278d37d1416fb8d0) [![Inline docs](http://inch-ci.org/github/flowjs/flow.js.svg?branch=master)](http://inch-ci.org/github/flowjs/flow.js)

<a href="https://www.buymeacoffee.com/aidas" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>

Expand Down Expand Up @@ -273,12 +273,14 @@ To re-run tests just change any source or test file.

Automated tests is running after every commit at travis-ci.

### Running test on sauceLabs
### Running tests locally

1. Connect to sauce labs https://saucelabs.com/docs/connect
2. `grunt test --sauce-local=true --sauce-username=**** --sauce-access-key=***`
`npm run test`

other browsers can be used with `--browsers` flag, available browsers: sl_opera,sl_iphone,sl_safari,sl_ie10,sl_chrome,sl_firefox
Other browsers can be used with `-- --browsers=...`, available browsers:
- ChromiumHeadlessNS
- ff (local Firefox)
- or, via Docker images: chromium_[57, 61, 68, 72, 77, 81, 83] and firefox_[60, 78, 81]

## Origin
Flow.js was inspired by and evolved from https://github.com/23/resumable.js. Library has been supplemented with tests and features, such as drag and drop for folders, upload speed, time remaining estimation, separate files pause, resume and more.
204 changes: 111 additions & 93 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,107 +1,128 @@
module.exports = function(config) {
if (config.sauceLabs && (!config.sauceLabs.username || !config.sauceLabs.accessKey)) {
console.log('Undefined sauce username/accessKey.');
process.exit(1)
var docker_images = {},

ChromeHeadlessDocker = {
base: 'Docker',
modemOptions: {
socketPath: '/run/docker.sock'
},
createOptions: {
// Image: 'registry.gitlab.com/drzraf/docker-alpine-browsers/chromium:81',
Cmd: ['chromium-browser', '--disable-gpu', '--headless', '--no-sandbox', '--remote-debugging-address=0.0.0.0', '--remote-debugging-port=9222', '--user-data-dir=/data', '--disable-dev-shm-usage', '$KARMA_URL'],
HostConfig: {
NetworkMode: 'host'
}
}
},

FirefoxHeadlessDocker = {
base: 'Docker',
modemOptions: {
socketPath: '/run/docker.sock'
},
createOptions: {
// Image: 'registry.gitlab.com/drzraf/docker-alpine-browsers/firefox:60',
Cmd: ['firefox', /*'--profile', '/tmp/headless', */ '-headless', '-no-remote', '-url', '$KARMA_URL'],
HostConfig: {
NetworkMode: 'host'
}
}
};

for(let i of [57, 61, 68, 72, 77, 81, 83]) {
docker_images['chromium' + i] = JSON.parse(JSON.stringify(ChromeHeadlessDocker));
docker_images['chromium' + i]['createOptions']['Image'] = 'registry.gitlab.com/drzraf/docker-alpine-browsers/chromium:' + i;
}

// define SL browsers
// first headless version = 55. ESR = [60, 68, 78]
for(let i of [60, 78, 81]) {
docker_images['firefox' + i] = JSON.parse(JSON.stringify(FirefoxHeadlessDocker));
docker_images['firefox' + i]['createOptions']['Image'] = 'registry.gitlab.com/drzraf/docker-alpine-browsers/firefox:' + i;
}

var testingbot_common_settings = {
// extra: 'foobar',
maxduration: 200,
groups: "flowjs",
build: "flowjs",
recordLogs: "true",
// 'testingbot.geoCountryCode': 'DE',
// deviceOrientation: 'portrait' || 'landscape'
};


var customLaunchers = {
sl_ie10: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8',
version: '10.0'
},
sl_ie11: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 10',
version: '11.0'
},
sl_edge: {
base: 'SauceLabs',
browserName: 'microsoftedge',
platform: 'Windows 10',
version: '20.10240'
},
sl_chrome_1: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Linux',
version: '26'
ff: {
base: 'Firefox',
// flags: ['-headless'],
},
sl_chrome_2: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Linux',
version: '46'
},
sl_firefox_1: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Linux',
version: '13'
},
sl_firefox_2: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Linux',
version: '42'
},
sl_ff: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Linux',
version: '45'

// https://github.com/karma-runner/karma-chrome-launcher/issues/158
ChromiumHeadlessNS: {
base: 'ChromiumHeadless',
flags: ['--no-sandbox']
},
sl_ff_win: {
base: 'SauceLabs',

...docker_images
};

var tbLaunchers = {
tb_ff: {
// use TB_KEY & TB_SECRET
base: 'TestingBot',
platform: 'WIN10',
browserName: 'firefox',
platform: 'Windows 10',
version: '80'
},
sl_android_1: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4'
version: '82',
...testingbot_common_settings
},
sl_android_2: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '5.1'
},
sl_iphone_1: {
base: 'SauceLabs',
browserName: 'iPhone',
platform: 'OS X 10.10',
deviceName: 'iPad Simulator',
version: '7.1'
},
sl_iphone_2: {
base: 'SauceLabs',
browserName: 'iPhone',
platform: 'OS X 10.10',
deviceName: 'iPad Simulator',
deviceOrientation: 'portrait',
version: '9.2'

tb_android_chrome: {
// use TB_KEY & TB_SECRET
base: 'TestingBot',
platform: "ANDROID",
platformName: "Android",
version: "7.1",
browserName: "Chrome",
deviceName: "Pixel 2",
...testingbot_common_settings
},
sl_safari_1: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.8',
version: '6.0'

// Not working
tb_android_ff: {
// use TB_KEY & TB_SECRET
base: 'TestingBot',
platform: "ANDROID",
platformName: "Android",
version: "7.1",
browserName: "Firefox",
deviceName: "Pixel 2",
...testingbot_common_settings
},
sl_safari_2: {
base: 'SauceLabs',

// Not working
tb_iphone: {
// use TB_KEY & TB_SECRET
base: 'TestingBot',
platform: 'iOS',
browserName: 'safari',
platform: 'OS X 10.11',
version: '9.0'
version: '13.4',
deviceName: 'iPhone 8',
platformName: 'iOS',
...testingbot_common_settings
}
};

if (process.env.TB_KEY && process.env.TB_SECRET) {
customLaunchers = {...customLaunchers, ...tbLaunchers};
}

config.set({
captureTimeout: 3e5,
browserDisconnectTolerance: 0,
browserDisconnectTimeout: 6e5,
browserSocketTimeout: 8e4,
browserNoActivityTimeout: 1e5,

// base path, that will be used to resolve files and exclude
basePath: '',

Expand All @@ -127,7 +148,7 @@ module.exports = function(config) {

// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress', 'coverage'],
reporters: ['progress', 'testingbot', 'coverage'],
coverageReporter: [
{type: "lcov", dir: "coverage", subdir: "."}
],
Expand All @@ -145,9 +166,6 @@ module.exports = function(config) {
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,

// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,

// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "src/flow.js",
"browser": "dist/flow.js",
"scripts": {
"test": "grunt test"
"test": "karma start --single-run karma.conf.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -52,7 +52,7 @@
"karma-coverage": "^2.0.3",
"karma-firefox-launcher": "^1.3.0",
"karma-jasmine": "4.0",
"karma-sauce-launcher": "4.1.5",
"karma-testingbot-launcher": "^1.0.4",
"rollup": "^2.26.9",
"rollup-plugin-terser": "^7.0.1",
"sinon": "^9.0.3"
Expand Down
2 changes: 1 addition & 1 deletion travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ if [[ $TEST = "unit-tests" ]]; then
elif [[ $TEST = "browser-tests" ]]; then

echo "Running browser-tests"
grunt karma:saucelabs
./node_modules/.bin/karma start --single-run --browsers tb_ff karma.conf.js

fi