Skip to content

Instantly share code, notes, and snippets.

@fayimora
Created September 21, 2020 09:15
Show Gist options
  • Save fayimora/3559732305f4082505f8e4addba08a1d to your computer and use it in GitHub Desktop.
Save fayimora/3559732305f4082505f8e4addba08a1d to your computer and use it in GitHub Desktop.
image: node:12
stages:
- prepare
- test
services:
- selenium/standalone-chrome
prepare:
stage: prepare
script:
- apt update
- apt install -y apt-file && apt-file update
# - apt install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3
# - apt install -y libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0
# - apt install -y libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6
# - apt install -y libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3
# - apt install -y libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation
# - apt install -y libappindicator1 libnss3 libnss3-dev lsb-release xdg-utils wget
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- apt install -y ./google-chrome-stable_current_amd64.deb
- LATEST_VERSION=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
- wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/$LATEST_VERSION/chromedriver_linux64.zip
- unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
- npm install
artifacts:
expire_in: 7 days
paths:
- node_modules/
test:
stage: test
dependencies:
- prepare
script:
# - npm run test:ci-
- npm run test:ci --host=selenium__standalone-chrome
{
"name": "acceptance-tests",
"scripts": {
"clean": "rm -rf ./test-report",
"code:lint": "eslint 'src/**/*.js' && prettier --check \"src/**/*.js*\" --write",
"code:gherkin": "npx gherkin-lint -c .gherkin-lintrc.json src/test/e2e/features",
"cucumber:undefined:step": "npx cucumber-js --dry-run --require './src/test/e2e/steps/**/*.js' ./src/test/e2e/features --format summary",
"report:generate": "npx allure generate --clean ./test-report/allure-result/ -o ./test-report/allure-report",
"report:open": "npx allure open test-report/allure-report",
"test": "npm run clean && wdio wdio.conf.js",
"test:ci": "npm run clean && wdio wdio.ci.conf.js"
},
"dependencies": {
"@wdio/allure-reporter": "^6.4.6",
"@wdio/cli": "^6.4.6",
"@wdio/cucumber-framework": "^6.4.3",
"@wdio/local-runner": "^6.4.6",
"@wdio/spec-reporter": "^6.4.0",
"@wdio/sync": "^6.4.6",
"allure-commandline": "^2.13.0",
"chromedriver": "^85.0.0",
"cucumber": "^6.0.5",
"expect": "^26.4.2",
"expect-webdriverio": "^1.3.1",
"fibers": "^5.0.0",
"wdio-chromedriver-service": "^6.0.4",
"wdio-timeline-reporter": "^5.1.4",
"webdriverio": "^6.4.6"
},
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-export-default-from": "^7.10.4",
"@babel/preset-env": "^7.11.5",
"@babel/register": "^7.11.5",
"@types/cucumber": "^6.0.1",
"@types/node": "^14.6.4",
"eslint": "^7.8.1",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-wdio": "^6.0.12",
"gherkin-lint": "^4.1.2",
"prettier": "^2.1.1"
}
}
const { config } = require('./wdio.conf.js');
config.baseUrl = process.env.BASE_URL;
config.capabilities = [
{
browserName: 'chrome',
'goog:chromeOptions': {
args: [
'--disable-infobars',
'--window-size=1280,800',
'--headless',
'--no-sandbox',
'--disable-gpu',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
],
},
},
];
exports.config = config;
const {
TimelineService
} = require('wdio-timeline-reporter/timeline-service');
exports.config = {
// runner: 'local',
// hostname: 'localhost',
port: 4444,
path: '/wd/hub',
specs: ['./src/test/e2e/features/**/*.feature'],
maxInstances: 1,
capabilities: [{
maxInstances: 1,
browserName: 'chrome',
}],
logLevel: 'trace',
outputDir: './test-report/output',
bail: 0,
baseUrl: 'http://localhost:8080',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'cucumber',
reporters: [
'spec',
[
'allure',
{
outputDir: './test-report/allure-result/',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false,
useCucumberStepReporter: true,
},
],
[
'timeline',
{
outputDir: './test-report/timeline',
},
],
],
cucumberOpts: {
requireModule: ['@babel/register'],
require: ['./src/test/e2e/steps/**/*.steps.js'],
backtrace: false,
compiler: [],
dryRun: false,
failFast: true,
format: ['pretty'],
colors: true,
snippets: true,
source: true,
profile: [],
strict: false,
tags: [],
timeout: 300000,
ignoreUndefinedDefinitions: false,
tagExpression: 'not @skip',
},
services: ['chromedriver', [TimelineService]],
beforeSession() {
require('expect-webdriverio').setOptions({
wait: 5000,
});
},
before() {
browser.setWindowSize(1280, 720);
},
afterStep: function ({
uri,
feature,
step
},
context, {
error,
result,
duration,
passed
},
) {
console.log(step);
if (error) {
browser.takeScreenshot();
}
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment