🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

codeceptjs-cucumber

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codeceptjs-cucumber - npm Package Compare versions

Comparing version

to
5.0.0

acceptance/report/parallel_chunk1_0bf23c3eb595e98e44fe0872ddb50b7f_1/0b02ff7c-8701-4ab1-8f75-05b3ad8da1c1-testsuite.xml

470

cli.js

@@ -12,295 +12,303 @@ #!/usr/bin/env node

const init = () => {
addScripts();
console.clear();
console.log(
'\n' +
chalk.yellow(
figlet.textSync('BDD Codecept JS', {
font: 'Ghost',
horizontalLayout: 'default',
verticalLayout: 'default'
})
)
);
addScripts();
console.log(
'\n\n' +
emoji.emojify(':tada: ') +
chalk.blue.underline.bold('Welcome to CodeceptJs-BDD CLI!')
);
console.log(
'\n' +
chalk.yellow(
figlet.textSync('BDD Codecept JS', {
font: 'Ghost',
horizontalLayout: 'default',
verticalLayout: 'default',
})
)
);
console.log(
chalk.green.bold(
'\nThe CodeceptJs-BDD CLI is a command-line interface tool that you use to Create and Initialize the base ' +
chalk.blue.bold.underline('CodeceptJS Cucumber BDD Framework') +
' to your workspace. It will create ' +
chalk.blue.bold.underline('acceptance') +
' directory at your acceptance test location and ' +
chalk.blue.bold.underline('configurations') +
' under your workspace.\n'
)
);
console.log(
'\n\n' +
emoji.emojify(':tada: ') +
chalk.blue.underline.bold('Welcome to CodeceptJs-BDD CLI!')
);
console.log(
chalk.green.bold(
'\nThe CodeceptJs-BDD CLI is a command-line interface tool that you use to Create and Initialize the base ' +
chalk.blue.bold.underline('CodeceptJS Cucumber BDD Framework') +
' to your workspace. It will create ' +
chalk.blue.bold.underline('acceptance') +
' directory at your acceptance test location and ' +
chalk.blue.bold.underline('configurations') +
' under your workspace.\n'
)
);
};
const askQuestions_aboutLocations = () => {
return inquirer.prompt([
{
name: 'PROJECT_NAME',
type: 'input',
message:
'Enter name of your acceptance tests (e.g. BDD Acceptance Tests): '
},
{
name: 'ROOT_PATH',
type: 'input',
message:
'Enter the Full PATH to your destination Root project (full path to package.json): '
},
{
name: 'RELATIVE_PATH',
type: 'input',
message: 'Enter a name for your tests folder: '
}
]);
return inquirer.prompt([
{
name: 'PROJECT_NAME',
type: 'input',
message:
'Enter name of your acceptance tests (e.g. BDD Acceptance Tests): ',
},
{
name: 'ROOT_PATH',
type: 'input',
message:
'Enter the Full PATH to your destination Root project (full path to package.json): ',
},
{
name: 'RELATIVE_PATH',
type: 'input',
message: 'Enter a name for your tests folder: ',
},
]);
};
const askQuestions_aboutIntegrateSauceLabs = () => {
return inquirer.prompt([
{
name: 'INTEGRATE_SAUCE_LABS',
type: 'confirm',
message: 'Do you want to integrate SauceLabs?'
}
]);
return inquirer.prompt([
{
name: 'INTEGRATE_SAUCE_LABS',
type: 'confirm',
message: 'Do you want to integrate SauceLabs?',
},
]);
};
const askQuestions_aboutSauceLabsAccount = () => {
return inquirer.prompt([
{
name: 'SAUCE_USERNAME',
type: 'input',
message: 'Enter your Sauce Username: '
},
{
name: 'SAUCE_KEY',
type: 'input',
message: 'Enter your Sauce Access Key: '
}
]);
return inquirer.prompt([
{
name: 'SAUCE_USERNAME',
type: 'input',
message: 'Enter your Sauce Username: ',
},
{
name: 'SAUCE_KEY',
type: 'input',
message: 'Enter your Sauce Access Key: ',
},
]);
};
const askQuestions_toExecuteScenarios = () => {
return inquirer.prompt([
{
name: 'SHOULD_EXECUTE',
type: 'confirm',
message:
'The CLI also offers to test your setup and configurations. It provides the simple example tests of GitHub Search Feature. Do you want to run a sample GitHub Tests once your Setup is complete?'
}
]);
return inquirer.prompt([
{
name: 'SHOULD_EXECUTE',
type: 'confirm',
message:
'The CLI also offers to test your setup and configurations. It provides the simple example tests of GitHub Search Feature. Do you want to run a sample GitHub Tests once your Setup is complete?',
},
]);
};
const askQuestions_selectDriver = () => {
return inquirer.prompt([
{
name: 'DRIVER',
type: 'list',
choices: ['WebDriver', 'Playwright'],
message: 'Choose Default Driver. Framework comes with both WebDriver and Playwright drivers and you can run your tests on any driver through `DRIVER` env param, e.g. DRIVER=playwright yarn acceptance or DRIVER=webdriver yarn acceptance. For now, you can choose your default driver.'
}
]);
return inquirer.prompt([
{
name: 'DRIVER',
type: 'list',
choices: ['WebDriver', 'Playwright'],
message:
'Choose Default Driver. Framework comes with both WebDriver and Playwright drivers and you can run your tests on any driver through `DRIVER` env param, e.g. DRIVER=playwright yarn acceptance or DRIVER=webdriver yarn acceptance. For now, you can choose your default driver.',
},
]);
};
const addInfo = (username, key) => {
console.log(
'\n' +
chalk.bold.red(
emoji.emojify(':warning: ') +
'You must export Saucelabs Access Key through Environment Variable "SAUCE_KEY" to run your tests on Saucelabs. It is not recommend to store it on the Source Control.\n\n'
) +
chalk.bold.red(
emoji.emojify(':information_desk_person: ') +
'It is recommended to export your Saucelabs Username and Access Key through your ./bash_profile or ./zshrc. Add following to your profile:'
) +
chalk.bold.red(
'\n\n' +
'export SAUCE_USERNAME=' +
username +
'\n' +
'export SAUCE_KEY=' +
key +
'\n\n'
)
);
console.log(
'\n' +
chalk.bold.red(
emoji.emojify(':warning: ') +
'You must export Saucelabs Access Key through Environment Variable "SAUCE_KEY" to run your tests on Saucelabs. It is not recommend to store it on the Source Control.\n\n'
) +
chalk.bold.red(
emoji.emojify(':information_desk_person: ') +
'It is recommended to export your Saucelabs Username and Access Key through your ./bash_profile or ./zshrc. Add following to your profile:'
) +
chalk.bold.red(
'\n\n' +
'export SAUCE_USERNAME=' +
username +
'\n' +
'export SAUCE_KEY=' +
key +
'\n\n'
)
);
};
const addScripts = packageJson => {
const SCRIPTS =
'"scripts": {\n' +
'\t"acceptance": "codeceptjs run --verbose",\n' +
'\t"acceptance:parallel": "codeceptjs run-multiple parallel",\n' +
'\t"acceptance:parallel:multibrowsers": "codeceptjs run-multiple multibrowsers",\n' +
'\t"acceptance:report": "allure serve ",';
const addScripts = (packageJson) => {
const SCRIPTS =
'"scripts": {\n' +
'\t"acceptance": "codeceptjs run --verbose",\n' +
'\t"acceptance:parallel": "codeceptjs run-multiple parallel",\n' +
'\t"acceptance:parallel:multibrowsers": "codeceptjs run-multiple multibrowsers",\n' +
'\t"acceptance:report": "allure serve ",';
shell.sed('-i', '"scripts": {', SCRIPTS, packageJson);
shell.sed('-i', '"scripts": {', SCRIPTS, packageJson);
};
const success = filepath => {
console.log(
'\n' +
chalk.yellow.bold(
emoji.emojify(':clap: :thumbsup:') +
` Done! Acceptance Tests Created at ` +
chalk.blue.bold(filepath) +
'\n'
)
);
const success = (filepath) => {
console.log(
'\n' +
chalk.yellow.bold(
emoji.emojify(':clap: :thumbsup:') +
` Done! Acceptance Tests Created at ` +
chalk.blue.bold(filepath) +
'\n'
)
);
};
const failure = message => {
console.log(
'\n' +
chalk.bold.red(
emoji.emojify(':warning: ') +
emoji.emojify(':disappointed: ') +
'Error: ' +
message
)
);
shell.exit(1);
const failure = (message) => {
console.log(
'\n' +
chalk.bold.red(
emoji.emojify(':warning: ') +
emoji.emojify(':disappointed: ') +
'Error: ' +
message
)
);
shell.exit(1);
};
const run = async () => {
init();
init();
const {
PROJECT_NAME,
ROOT_PATH,
RELATIVE_PATH,
INTEGRATE_SAUCE_LABS
} = await askQuestions_aboutLocations();
const {
PROJECT_NAME,
ROOT_PATH,
RELATIVE_PATH,
INTEGRATE_SAUCE_LABS,
} = await askQuestions_aboutLocations();
if (!fs.existsSync(ROOT_PATH)) {
shell.mkdir('-p', ROOT_PATH);
}
if (!fs.existsSync(ROOT_PATH)) {
shell.mkdir('-p', ROOT_PATH);
}
const acceptanceTestsPath = path.join(ROOT_PATH, RELATIVE_PATH, 'acceptance');
const acceptanceTestsPath = path.join(
ROOT_PATH,
RELATIVE_PATH,
'acceptance'
);
if (!fs.existsSync(acceptanceTestsPath)) {
shell.mkdir('-p', acceptanceTestsPath);
}
if (!fs.existsSync(acceptanceTestsPath)) {
shell.mkdir('-p', acceptanceTestsPath);
}
shell.cp(
'-R',
path.join(process.cwd(), 'acceptance'),
path.join(ROOT_PATH, RELATIVE_PATH)
);
shell.cp('-R', path.join(process.cwd(), 'codecept.conf.js'), ROOT_PATH);
shell.cp(
'-R',
path.join(process.cwd(), 'acceptance'),
path.join(ROOT_PATH, RELATIVE_PATH)
);
shell.cp('-R', path.join(process.cwd(), 'codecept.conf.js'), ROOT_PATH);
const configFile = path.join(ROOT_PATH, 'codecept.conf.js');
const packageJson = path.join(ROOT_PATH, 'package.json');
const configFile = path.join(ROOT_PATH, 'codecept.conf.js');
const packageJson = path.join(ROOT_PATH, 'package.json');
shell.sed('-i', '<name>', PROJECT_NAME, configFile);
shell.sed('-i', '<name>', PROJECT_NAME, configFile);
const { DRIVER } = await askQuestions_selectDriver();
const { DRIVER } = await askQuestions_selectDriver();
if (DRIVER === 'WebDriver') {
const {
INTEGRATE_SAUCE_LABS
} = await askQuestions_aboutIntegrateSauceLabs();
if (DRIVER === 'WebDriver') {
const {
INTEGRATE_SAUCE_LABS,
} = await askQuestions_aboutIntegrateSauceLabs();
if (INTEGRATE_SAUCE_LABS) {
const {
SAUCE_USERNAME,
SAUCE_KEY
} = await askQuestions_aboutSauceLabsAccount();
shell.sed('-i', '<sauce_username>', SAUCE_USERNAME, configFile);
addInfo(SAUCE_USERNAME, SAUCE_KEY);
if (INTEGRATE_SAUCE_LABS) {
const {
SAUCE_USERNAME,
SAUCE_KEY,
} = await askQuestions_aboutSauceLabsAccount();
shell.sed('-i', '<sauce_username>', SAUCE_USERNAME, configFile);
addInfo(SAUCE_USERNAME, SAUCE_KEY);
}
}
}
shell.sed('-i', '<name>', PROJECT_NAME, configFile);
shell.sed('-i', 'webdriver', DRIVER, configFile);
shell.sed('-i', '<name>', PROJECT_NAME, configFile);
shell.sed('-i', 'webdriver', DRIVER, configFile);
shell.sed(
'-i',
'./acceptance/',
'./' + RELATIVE_PATH + '/acceptance/',
configFile
);
const { SHOULD_EXECUTE } = await askQuestions_toExecuteScenarios();
if (!fs.existsSync(path.join(ROOT_PATH, 'package.json'))) {
console.error(
'\n' +
emoji.emojify(':warning: ') +
chalk.red.bold(
`package.json does not exists at the ${ROOT_PATH}. Looks like the node project hasn't initialized yet.\n`
) +
emoji.emojify(':point_right: ') +
chalk.blue.bold(
`Don't worry! We are copying the existing to continue the setup. Please update the file once the setup is done!`
) +
emoji.emojify(':zap: ')
shell.sed(
'-i',
'./acceptance/',
'./' + RELATIVE_PATH + '/acceptance/',
configFile
);
shell.cp('-R', path.join(process.cwd(), 'package.json'), ROOT_PATH);
}
const { SHOULD_EXECUTE } = await askQuestions_toExecuteScenarios();
console.info('\nChange Directory to: ', ROOT_PATH);
if (!fs.existsSync(path.join(ROOT_PATH, 'package.json'))) {
console.error(
'\n' +
emoji.emojify(':warning: ') +
chalk.red.bold(
`package.json does not exists at the ${ROOT_PATH}. Looks like the node project hasn't initialized yet.\n`
) +
emoji.emojify(':point_right: ') +
chalk.blue.bold(
`Don't worry! We are copying the existing to continue the setup. Please update the file once the setup is done!`
) +
emoji.emojify(':zap: ')
);
shell.cd(ROOT_PATH);
shell.cp('-R', path.join(process.cwd(), 'package.json'), ROOT_PATH);
}
addScripts(packageJson);
console.info('\nChange Directory to: ', ROOT_PATH);
console.log(
'\n\n' +
chalk.white.bgBlue.bold(
emoji.emojify(':rocket:') + ` Installing dependencies...\n\n`
)
);
shell.cd(ROOT_PATH);
if (
shell.exec(
'yarn add codeceptjs-saucelabs@latest codeceptjs-shared@latest allure-commandline codeceptjs debug faker protractor rimraf should deepmerge soft-assert -D'
).code !== 0
) {
failure('Yarn command failed.');
}
addScripts(packageJson);
shell.cp('-R', path.join(ROOT_PATH, 'package.json'));
console.log(
'\n\n' +
chalk.white.bgBlue.bold(
emoji.emojify(':rocket:') + ` Installing dependencies...\n\n`
)
);
console.log(
'\n' +
chalk.white.bgBlue.bold(emoji.emojify(':coffee:') + ` Setup Completed!`)
);
if (
shell.exec(
'yarn add codeceptjs-saucelabs@latest codeceptjs-shared@latest allure-commandline codeceptjs debug faker protractor rimraf should deepmerge soft-assert -D'
).code !== 0
) {
failure('Yarn command failed.');
}
if (SHOULD_EXECUTE) {
shell.cd(ROOT_PATH);
shell.cp('-R', path.join(ROOT_PATH, 'package.json'));
console.log(
'\n' +
chalk.green(
figlet.textSync('Running Tests', {
font: 'speed',
horizontalLayout: 'default',
verticalLayout: 'default'
})
)
'\n' +
chalk.white.bgBlue.bold(
emoji.emojify(':coffee:') + ` Setup Completed!`
)
);
if (
shell.exec(
`DRIVER=${DRIVER} ./node_modules/.bin/codeceptjs run --grep=@search_results --verbose`
).code !== 0
) {
failure('Execution of Acceptance Test Failed.');
if (SHOULD_EXECUTE) {
shell.cd(ROOT_PATH);
console.log(
'\n' +
chalk.green(
figlet.textSync('Running Tests', {
font: 'speed',
horizontalLayout: 'default',
verticalLayout: 'default',
})
)
);
if (
shell.exec(
`DRIVER=${DRIVER} ./node_modules/.bin/codeceptjs run --grep=@search_results --verbose`
).code !== 0
) {
failure('Execution of Acceptance Test Failed.');
}
}
}
success(path.join(ROOT_PATH, RELATIVE_PATH));
success(path.join(ROOT_PATH, RELATIVE_PATH));
};
run();
{
"name": "codeceptjs-cucumber",
"version": "4.0.3",
"description": "CodeceptJs Cucumber E2E Framework",
"scripts": {
"start": "node cli.js",
"cli": "node cli.js",
"acceptance": "./node_modules/.bin/codeceptjs run --verbose",
"acceptance:parallel": "./node_modules/.bin/codeceptjs run-multiple parallel",
"acceptance:parallel:multibrowsers": "./node_modules/.bin/codeceptjs run-multiple multibrowsers",
"acceptance:report": "./node_modules/.bin/allure serve ./acceptance/report",
"test": "yarn acceptance --profile chrome:headless && DRIVER=playwright yarn acceptance"
},
"bin": {
"codeceptjs-bdd": "./cli.js"
},
"main": "cli.js",
"keywords": [
"Cucumber",
"CodeceptJS",
"Gherkin"
],
"author": {
"name": "Kushang Gajjar",
"email": "g.kushang@gmail.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gkushang/codeceptjs-bdd.git"
},
"devDependencies": {
"@wdio/selenium-standalone-service": "5.16.10",
"allure-commandline": "^2.9.0",
"chalk": "^2.4.2",
"codeceptjs": "^2.5.0",
"codeceptjs-saucelabs": "^4.0.1",
"codeceptjs-shared": "^4.0.3",
"debug": "^4.1.1",
"deepmerge": "^4.0.0",
"faker": "^4.1.0",
"figlet": "^1.2.3",
"inquirer": "^7.0.0",
"node-emoji": "^1.10.0",
"protractor": "^5.4.2",
"selenium-standalone": "^6.16.0",
"shelljs": "^0.8.3",
"should": "^13.2.3",
"soft-assert": "^0.2.0",
"webdriverio": "^5.2.2"
},
"license": "MIT",
"dependencies": {
"playwright": "^0.12.1"
},
"gitHead": "cd9574d8ba7d6ba486c9449e68220e687fc1e336"
"name": "codeceptjs-cucumber",
"version": "5.0.0",
"description": "CodeceptJs Cucumber E2E Framework",
"scripts": {
"start": "node cli.js",
"cli": "node cli.js",
"acceptance": "./node_modules/.bin/codeceptjs run --verbose",
"acceptance:parallel": "./node_modules/.bin/codeceptjs run-multiple parallel",
"acceptance:parallel:multibrowsers": "./node_modules/.bin/codeceptjs run-multiple multibrowsers",
"acceptance:report": "./node_modules/.bin/allure serve ./acceptance/report",
"test": "yarn acceptance --profile chrome:headless && DRIVER=playwright yarn acceptance"
},
"bin": {
"create-codeceptjs-bdd-tests": "./cli.js"
},
"main": "cli.js",
"keywords": [
"Cucumber",
"CodeceptJS",
"Gherkin"
],
"author": {
"name": "Kushang Gajjar",
"email": "g.kushang@gmail.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gkushang/codeceptjs-bdd.git"
},
"devDependencies": {
"@wdio/selenium-standalone-service": "5.16.10",
"allure-commandline": "^2.9.0",
"chalk": "^2.4.2",
"codeceptjs": "^2.5.0",
"codeceptjs-saucelabs": "^5.0.0",
"codeceptjs-shared": "^5.0.0",
"debug": "^4.1.1",
"deepmerge": "^4.0.0",
"faker": "^4.1.0",
"figlet": "^1.2.3",
"inquirer": "^7.0.0",
"node-emoji": "^1.10.0",
"playwright": "^0.12.1",
"protractor": "^5.4.2",
"selenium-standalone": "^6.16.0",
"shelljs": "^0.8.3",
"should": "^13.2.3",
"soft-assert": "^0.2.0",
"webdriverio": "^5.2.2"
},
"license": "MIT",
"gitHead": "8f5e4cbf551929c9a7386f666f39058e3b3f861f"
}