Tests for Jenkins

This commit is contained in:
Dawid Majsnerowski 2019-11-19 17:19:25 +01:00
parent d0d6365e22
commit 276747169d
7 changed files with 5213 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/node_modules/
/test/allure-results/*.xml
/test/allure-results/*.png
/test/allure-results/*.log
/test/allure-results/*.json
/test/screenshots/*.png
/allure-report/

23
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,23 @@
pipeline {
agent any
stages {
stage('Build') {
steps {
sh "cd tests"
sh "npm install"
}
}
stage('Test') {
steps {
echo 'Testing..'
sh ''./node_modules/.bin/wdio run ./test/config/base.conf.js'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
}

3410
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "BestNotes",
"version": "1.0.0",
"description": "Testowe Readme do projektu BestNotes",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.wmi.amu.edu.pl/s452101/BestNotes.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@wdio/allure-reporter": "^5.16.0",
"@wdio/cli": "^5.16.7",
"@wdio/local-runner": "^5.16.7",
"@wdio/mocha-framework": "^5.16.5",
"@wdio/spec-reporter": "^5.16.5",
"@wdio/sync": "^5.16.5",
"chromedriver": "^78.0.1",
"wdio-chromedriver-service": "^5.0.2"
}
}

48
test/config/base.conf.js Normal file
View File

@ -0,0 +1,48 @@
exports.config = {
runner: 'local',
path: '/',
specs: [
'./test/specs/**/*.js'
],
exclude: [
],
maxInstances: 10,
capabilities: [{
maxInstances: 5,
browserName: 'chrome',
}],
logLevel: 'info',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
services: ['chromedriver'],
framework: 'mocha',
reporters: [
['spec',
{
outputDir: 'test/allure-results',
},
],
['allure',
{
outputDir: 'test/allure-results',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false,
useCucumberStepReporter: false,
},
],
],
mochaOpts: {
ui: 'bdd',
timeout: 60000
},
afterTest: function(test, context, { error, result, duration, passed }) {
if (!passed) {
browser.takeScreenshot();
}
},
}

View File

@ -0,0 +1,9 @@
const assert = require('assert')
describe('webdriver.io page', () => {
it('should have the right title', () => {
browser.url('https://webdriver.io')
const title = browser.getTitle()
assert.strictEqual(title, 'WebdriverIO · Next-gen WebDriver test framework for Node.js')
})
})

1687
yarn.lock Normal file

File diff suppressed because it is too large Load Diff