-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4c1dacc
Showing
30 changed files
with
1,882 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,11 @@ | ||
example/ | ||
lib/ | ||
node_modules/ | ||
report/ | ||
.dockerignore | ||
.gitignore | ||
Dockerfile | ||
package-lock.json | ||
README.md | ||
server.js | ||
opicak.conf.js |
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 @@ | ||
/node_modules/ | ||
/package-lock.json | ||
/lib/ | ||
/opicak.conf.js |
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 @@ | ||
FROM node:8-slim | ||
|
||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true | ||
|
||
RUN mkdir -p /home/opicak | ||
|
||
WORKDIR /home/opicak | ||
|
||
ADD package.json . | ||
|
||
RUN npm install | ||
|
||
ADD . . | ||
|
||
RUN npm run build |
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 @@ | ||
# Opicak | ||
|
||
## Install | ||
Simply install the latest version via npm install | ||
``` | ||
npm install opicak | ||
``` | ||
|
||
Than you can run opicak like this | ||
``` | ||
node_modules/.bin/opicak -u https://www.example.com | ||
``` | ||
|
||
### Configuration | ||
Opicak will look for configuraition file in your current directory with name `opicak.conf.js`. | ||
|
||
```javascript | ||
module.exports = { | ||
url: 'https://www.seznamzpravy.cz', | ||
parallelInstances: 10 | ||
} | ||
``` | ||
|
||
## Development | ||
Build | ||
``` | ||
npm run build | ||
``` | ||
Build with watch | ||
``` | ||
npm run dev | ||
``` | ||
Run local testing website (from example) | ||
``` | ||
node server.js | ||
``` | ||
Start local version of opicak with source mapping | ||
``` | ||
npm start -- [options] | ||
``` |
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,63 @@ | ||
#!/usr/bin/env node | ||
|
||
var program = require('commander'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var Runner = require('../lib/Runner.js').default; | ||
var defaultConfigValues = require('../lib/config/template.js'); | ||
var version = require('../package.json').version; | ||
var configValues = {}; | ||
|
||
const USER_CONFIG_PATH = path.join(process.cwd(), './opicak.conf.js'); | ||
|
||
function getOptionSyntax(option, type) { | ||
let long = '--' + option.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`); | ||
let short = '-' + option.charAt(0); | ||
|
||
if (type === 'boolean') { | ||
return `${short}, ${long}`; | ||
} | ||
|
||
return `${short}, ${long} <${type}>`; | ||
} | ||
|
||
function getTypeHandler(type) { | ||
switch (type) { | ||
case 'number': return val => parseInt(val); | ||
case 'string[]': return val => val.split(','); | ||
default: return val => val; | ||
} | ||
} | ||
|
||
program | ||
.version(version) | ||
.usage('[options] [scenarioFiles ...]'); | ||
|
||
Object | ||
.keys(defaultConfigValues) | ||
.forEach(key => { | ||
let { description, type, value, syntax, cli_disabled } = defaultConfigValues[key]; | ||
|
||
if (cli_disabled) { | ||
return; | ||
} | ||
|
||
program.option(syntax || getOptionSyntax(key, type), description, getTypeHandler(type)); | ||
}); | ||
|
||
program.parse(process.argv); | ||
|
||
if (fs.existsSync(USER_CONFIG_PATH)) { | ||
configValues = require(USER_CONFIG_PATH); | ||
} | ||
|
||
Object | ||
.keys(defaultConfigValues) | ||
.forEach(key => { | ||
if (program[key]) { | ||
configValues[key] = program[key] | ||
} | ||
}); | ||
|
||
new Runner(configValues) | ||
.start(program.args); |
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,37 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>Example</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
</head> | ||
<title>Example</title> | ||
<body> | ||
<button id="btn1" onClick="noError()">Click Me!</button> | ||
<button id="btn2" onClick="window.location='./index3.html'">Click Me!</button> | ||
<button id="btn3" onClick="error()">Click Me!</button> | ||
<button id="btn4" onClick="noError()">Click Me!</button> | ||
<button id="btn5" onClick="activate()">Click Me!</button> | ||
<button id="btn6" onClick="noError()">Click Me!</button> | ||
<button id="btn7" onClick="window.location='./index2.html'">Click Me!</button> | ||
<button id="btn8" onClick="noError()">Click Me!</button> | ||
<button id="btn9" onClick="noError()">Click Me!</button> | ||
<button id="btn10" onClick="noError()">Click Me!</button> | ||
<button id="btn11" onClick="noError()">Click Me!</button> | ||
<button id="btn12" onClick="noError()">Click Me!</button> | ||
<script>function noError() {}</script> | ||
<script> | ||
var activated = false; | ||
function activate() { | ||
activated = true; | ||
} | ||
function error() { | ||
if (activated) { | ||
throw Error('Hey, something went seriously wrong!'); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |
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,37 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>Example</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
</head> | ||
<title>Example</title> | ||
<body> | ||
<button id="btn1" onClick="activate()">Click Me!</button> | ||
<button id="btn2" onClick="noError()">Click Me!</button> | ||
<button id="btn3" onClick="error()">Click Me!</button> | ||
<button id="btn4" onClick="noError()">Click Me!</button> | ||
<button id="btn5" onClick="noError()">Click Me!</button> | ||
<button id="btn6" onClick="activate()">Click Me!</button> | ||
<button id="btn7" onClick="noError()">Click Me!</button> | ||
<button id="btn8" onClick="noError()">Click Me!</button> | ||
<button id="btn9" onClick="activate()">Click Me!</button> | ||
<button id="btn10" onClick="noError()">Click Me!</button> | ||
<button id="btn11" onClick="activate()">Click Me!</button> | ||
<button id="btn12" onClick="noError()">Click Me!</button> | ||
<script>function noError() {}</script> | ||
<script> | ||
var activated = 0; | ||
function activate() { | ||
activated++; | ||
} | ||
function error() { | ||
if (activated > 4) { | ||
throw Error('Hey, something went seriously wrong!'); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |
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,47 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>Example</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
</head> | ||
<title>Example</title> | ||
<body> | ||
<div> | ||
<button id="btn1" onClick="activate()">Click Me!</button> | ||
</div> | ||
<button id="btn2" onClick="noError()">Click Me!</button> | ||
<table> | ||
<tr> | ||
<td> | ||
<button id="btn3" onClick="error()">Click Me!</button> | ||
</td> | ||
<td> | ||
<button id="btn4" onClick="noError()">Click Me!</button> | ||
</td> | ||
</tr> | ||
</table> | ||
<button id="btn5" onClick="noError()">Click Me!</button> | ||
<button id="btn6" onClick="noError()">Click Me!</button> | ||
<button id="btn7" onClick="noError()">Click Me!</button> | ||
<button id="btn8" onClick="noError()">Click Me!</button> | ||
<button id="btn9" onClick="noError()">Click Me!</button> | ||
<button id="btn10" onClick="noError()">Click Me!</button> | ||
<button id="btn11" onClick="noError()">Click Me!</button> | ||
<button id="btn12" onClick="noError()">Click Me!</button> | ||
<script>function noError() {}</script> | ||
<script> | ||
var activated = false; | ||
function activate() { | ||
activated = true; | ||
} | ||
function error() { | ||
if (activated) { | ||
throw Error('Hey, something went seriously wrong!'); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |
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,10 @@ | ||
var Runner = require('./lib/Runner.js').default; | ||
|
||
new Runner({ | ||
"parallelInstances": 2, | ||
"noNewScenariosAfterTime": 450000, | ||
"actionsPerScenario": 100, | ||
"url": "https://www.seznamzpravy.cz", | ||
"actions": [], | ||
"numberOfAllowedActionsToReproduceErrorFromPreviousRun": 10 | ||
}).start(); |
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,39 @@ | ||
{ | ||
"name": "opicak", | ||
"version": "0.0.1", | ||
"description": "Monkey testing library", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"There are no tests defined\"", | ||
"build": "rm -rf lib && babel src --out-dir lib --copy-files --plugins=transform-es2015-modules-commonjs", | ||
"dev": "npm run build -- --source-maps --watch", | ||
"start": "node -r source-map-support/register bin/opicak.js" | ||
}, | ||
"bin": { | ||
"opicak": "./bin/opicak.js" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://npm.dev.dszn.cz" | ||
}, | ||
"keywords": [ | ||
"testing", | ||
"e2e", | ||
"monkey" | ||
], | ||
"author": "Filip Satek <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"commander": "2.17.1", | ||
"glob-all": "3.1.0", | ||
"lodash": "4.17.10", | ||
"progress": "2.0.0", | ||
"puppeteer": "1.8.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "6.26.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "6.26.2", | ||
"express": "4.16.3", | ||
"serve-static": "1.13.2", | ||
"source-map-support": "0.5.9" | ||
} | ||
} |
Oops, something went wrong.