mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
add the config.js file
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
This commit is contained in:
parent
db81ebcc7f
commit
9670bd01f8
4 changed files with 27 additions and 10 deletions
|
@ -3,15 +3,16 @@
|
|||
const { Before, BeforeAll, AfterAll, After, setDefaultTimeout } = require('@cucumber/cucumber');
|
||||
const { chromium } = require('playwright');
|
||||
const { deleteProject } = require('./tests/acceptance/testHelpers/apiHelpers');
|
||||
const config = require('./tests/acceptance/config');
|
||||
|
||||
setDefaultTimeout(60000);
|
||||
setDefaultTimeout(config.timeout);
|
||||
|
||||
// launch the browser
|
||||
BeforeAll(async function () {
|
||||
global.browser = await chromium.launch({
|
||||
// makes true for CI
|
||||
headless: true,
|
||||
slowMo: 1000,
|
||||
headless: config.headless,
|
||||
slowMo: config.slowMo,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
12
client/tests/acceptance/config.js
Normal file
12
client/tests/acceptance/config.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
module.exports = {
|
||||
// environment
|
||||
adminUser: {
|
||||
email: 'demo@demo.demo',
|
||||
password: 'demo',
|
||||
},
|
||||
baseUrl: process.env.BASE_URL ?? 'http://localhost:1337/',
|
||||
// playwright
|
||||
slowMo: parseInt(process.env.SLOW_MO, 10) || 1000,
|
||||
timeout: parseInt(process.env.TIMEOUT, 10) || 6000,
|
||||
headless: process.env.HEADLESS !== 'true',
|
||||
};
|
|
@ -1,9 +1,12 @@
|
|||
const config = require(`../config`);
|
||||
|
||||
class LoginPage {
|
||||
constructor() {
|
||||
// url
|
||||
this.homeUrl = 'http://localhost:1337';
|
||||
this.loginUrl = `${this.homeUrl}/login`;
|
||||
this.homeUrl = config.baseUrl;
|
||||
this.loginUrl = `${this.homeUrl}login`;
|
||||
|
||||
// selectors
|
||||
this.loginButtonSelector = `//i[@class="right arrow icon"]`;
|
||||
this.usernameSelector = `//input[@name='emailOrUsername']`;
|
||||
this.passwordSelector = `//input[@name='password']`;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
const axios = require('axios');
|
||||
const config = require('../config');
|
||||
|
||||
async function getXauthToken() {
|
||||
try {
|
||||
const res = await axios.post(
|
||||
'http://localhost:1337/api/access-tokens',
|
||||
`${config.baseUrl}api/access-tokens`,
|
||||
{
|
||||
emailOrUsername: 'demo',
|
||||
password: 'demo',
|
||||
emailOrUsername: config.adminUser.email,
|
||||
password: config.adminUser.password,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
|
@ -22,7 +23,7 @@ async function getXauthToken() {
|
|||
|
||||
async function getProjectIDs() {
|
||||
try {
|
||||
const res = await axios.get('http://localhost:1337/api/projects', {
|
||||
const res = await axios.get(`${config.baseUrl}api/projects`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${await getXauthToken()}`,
|
||||
},
|
||||
|
@ -38,7 +39,7 @@ async function deleteProject() {
|
|||
const projectIDs = await getProjectIDs();
|
||||
await Promise.all(
|
||||
projectIDs.map(async (project) => {
|
||||
await axios.delete(`http://localhost:1337/api/projects/${project}`, {
|
||||
await axios.delete(`${config.baseUrl}api/projects/${project}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${await getXauthToken()}`,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue