Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DavertMik committed Mar 16, 2019
1 parent 3e9dc05 commit 2d235b3
Show file tree
Hide file tree
Showing 9 changed files with 1,618 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,4 +1,6 @@
# Logs
output

logs
*.log
npm-debug.log*
Expand Down
76 changes: 76 additions & 0 deletions codecept.conf.js
@@ -0,0 +1,76 @@
require('dotenv').config();

const project = process.env.bugira_project;
const user = process.env.bugira_user;
const password = process.env.bugira_password;
const host = 'https://codeceptjs.bugira.app';

exports.config = {
tests: './*_test.js',
output: './output',
bootstrap: () => {
// injecting config
codeceptjs.container.append({
support: { project }
})
},
helpers: {
Puppeteer: {
url: host,
show: process.profile === 'show',
windowSize: '1600x1200',
keepCookies: true,
restart: false,
chrome: {
args: ['--no-sandbox']
}
},
ApiDataFactory: {
endpoint: `${host}/api/${project}`,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
onRequest: async (request) => {
let cookies = await codeceptjs.container.helpers('Puppeteer').grabCookie();
request.headers = { Cookie: cookies.map(c => `${c.name}=${c.value}`).join('; ') };
},
factories: {
ticket: {
uri: "/tickets",
factory: "./data/ticket_factory"
}
}
}

},
include: {
I: './steps_file.js'
},
plugins: {
retryFailedStep: {
enabled: true,
retries: 5,
},
autoLogin: {
enabled: true,
saveToFile: true,
inject: 'login',
users: {
admin: {
// login function is defined in `steps_file.js`
login: (I) => I.login(user, password),
// if we see `CodeceptJS Projects` on page, we assume we are logged in
check: (I) => {
// pause();
I.amOnPage('/');
// console.log('check');
I.see('CodeceptJS Projects');
}
}
}
}
},
mocha: {},
name: 'codeceptjs-bugira'
}
8 changes: 8 additions & 0 deletions data/ticket_factory.js
@@ -0,0 +1,8 @@
var Factory = require('rosie').Factory;
var faker = require('faker');

module.exports = new Factory()
.attr('title', () => faker.lorem.sentence())
.attr('description', () => faker.lorem.paragraph())
;

0 comments on commit 2d235b3

Please sign in to comment.