Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codeceptjs

Package Overview
Dependencies
Maintainers
4
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codeceptjs - npm Package Compare versions

Comparing version 3.5.7-beta.1 to 3.5.7

2

docs/advanced.md

@@ -153,3 +153,3 @@ ---

"args": ["run", "--grep", "@your_test_tag"],
"program": "${workspaceFolder}/node_modules/.bin/codeceptjs"
"program": "${workspaceFolder}/node_modules/codeceptjs/bin/codecept.js"
}

@@ -156,0 +156,0 @@ ```

@@ -186,2 +186,3 @@ let webdriverio;

webdriverio = require('webdriverio');
console.log('The Appium core team does not maintain Appium 1.x anymore since the 1st of January 2022. Please migrating to Appium 2.x by adding appiumV2: true to your config.\nThis Appium 1.x support will be removed in next major release');
}

@@ -188,0 +189,0 @@

@@ -47,2 +47,4 @@ ---

- `uniqueScreenshotNames` **[boolean][20]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
- `trace` **[boolean][20]?** record [tracing information][25] with screenshots.
- `keepTraceForPassedTests` **[boolean][20]?** save trace for passed tests.
- `keepBrowserState` **[boolean][20]?** keep browser state between tests when `restart` is set to false.

@@ -59,3 +61,3 @@ - `keepCookies` **[boolean][20]?** keep cookies between tests when `restart` is set to false.

- `browser` **[string][6]?** can be changed to `firefox` when using [puppeteer-firefox][2].
- `chrome` **[object][4]?** pass additional [Puppeteer run options][25].
- `chrome` **[object][4]?** pass additional [Puppeteer run options][26].
- `highlightElement` **[boolean][20]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).

@@ -65,2 +67,10 @@

#### Trace Recording Customization
Trace recording provides complete information on test execution and includes screenshots, and network requests logged during run.
Traces will be saved to `output/trace`
- `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
- `keepTraceForPassedTests`: - save trace for passed tests
#### Example #1: Wait for 0 network connections.

@@ -2269,2 +2279,4 @@

[25]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
[25]: https://pptr.dev/api/puppeteer.tracing
[26]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions

@@ -450,3 +450,3 @@ ---

```js
Scenario('do something with logged in user', ({ I, login) }) => {
Scenario('do something with logged in user', ({ I, login }) => {
login('user');

@@ -453,0 +453,0 @@ I.see('Dashboard','h1');

@@ -19,4 +19,2 @@ const { Configuration, OpenAIApi } = require('openai');

const aiInstance = null;
class AiAssistant {

@@ -32,6 +30,3 @@ constructor() {

if (!this.isEnabled) {
debug('No OpenAI API key provided. AI assistant is disabled.');
return;
}
if (!this.isEnabled) return;

@@ -45,7 +40,3 @@ const configuration = new Configuration({

static getInstance() {
return aiInstance || new AiAssistant();
}
async setHtmlContext(html) {
setHtmlContext(html) {
let processedHTML = html;

@@ -56,3 +47,3 @@

}
if (this.htmlConfig.minify) processedHTML = await minifyHtml(processedHTML);
if (this.htmlConfig.minify) processedHTML = minifyHtml(processedHTML);
if (this.htmlConfig.maxLength) processedHTML = splitByChunks(processedHTML, this.htmlConfig.maxLength)[0];

@@ -59,0 +50,0 @@

@@ -186,2 +186,3 @@ let webdriverio;

webdriverio = require('webdriverio');
console.log('The Appium core team does not maintain Appium 1.x anymore since the 1st of January 2022. Please migrating to Appium 2.x by adding appiumV2: true to your config.\nThis Appium 1.x support will be removed in next major release');
}

@@ -188,0 +189,0 @@

const { parse, serialize } = require('parse5');
const { minify } = require('html-minifier-terser');
const { minify } = require('html-minifier');
async function minifyHtml(html) {
function minifyHtml(html) {
return minify(html, {

@@ -14,3 +14,3 @@ collapseWhitespace: true,

useShortDoctype: true,
});
}).toString();
}

@@ -17,0 +17,0 @@

@@ -21,3 +21,4 @@ const colors = require('chalk');

let registeredVariables = {};
let aiAssistant;
const aiAssistant = new AiAssistant();
/**

@@ -48,4 +49,2 @@ * Pauses test execution and starts interactive shell

aiAssistant = AiAssistant.getInstance();
output.print(colors.yellow(' Interactive shell started'));

@@ -108,5 +107,3 @@ output.print(colors.yellow(' Use JavaScript syntax to try steps in action'));

try {
// eslint-disable-next-line
const locate = global.locate; // enable locate in this context
// eslint-disable-next-line
const I = container.support('I');

@@ -124,3 +121,3 @@ if (cmd.trim().startsWith('=>')) {

const html = await res;
await aiAssistant.setHtmlContext(html);
aiAssistant.setHtmlContext(html);
} catch (err) {

@@ -127,0 +124,0 @@ output.print(output.styles.error(' ERROR '), 'Can\'t get HTML context', err.stack);

@@ -12,2 +12,3 @@ const fs = require('fs');

fetch: I => I.grabCookie(),
check: () => {},
restore: (I, cookies) => {

@@ -287,3 +288,8 @@ I.amOnPage('/'); // open a page

}
const cookies = await userSession.fetch(I);
if (!cookies) {
debug('Cannot save user session with empty cookies from auto login\'s fetch method');
return;
}
if (config.saveToFile) {

@@ -290,0 +296,0 @@ debug(`Saved user session into file for ${name}`);

@@ -11,3 +11,2 @@ const debug = require('debug')('codeceptjs:heal');

const defaultConfig = {
healTries: 1,
healLimit: 2,

@@ -59,3 +58,3 @@ healSteps: [

module.exports = function (config = {}) {
const aiAssistant = AiAssistant.getInstance();
const aiAssistant = new AiAssistant();

@@ -65,5 +64,2 @@ let currentTest = null;

let healedSteps = 0;
let caughtError;
let healTries = 0;
let isHealing = false;

@@ -77,3 +73,2 @@ const healSuggestions = [];

healedSteps = 0;
caughtError = null;
});

@@ -83,14 +78,8 @@

event.dispatcher.on(event.step.after, (step) => {
if (isHealing) return;
event.dispatcher.on(event.step.before, () => {
const store = require('../store');
if (store.debugMode) return;
recorder.catchWithoutStop(async (err) => {
isHealing = true;
if (caughtError === err) throw err; // avoid double handling
caughtError = err;
if (!aiAssistant.isEnabled) {
output.print(colors.yellow('Heal plugin can\'t operate, AI assistant is disabled. Please set OPENAI_API_KEY env variable to enable it.'));
throw err;
}
if (!aiAssistant.isEnabled) throw err;
if (!currentStep) throw err;

@@ -100,10 +89,2 @@ if (!config.healSteps.includes(currentStep.name)) throw err;

if (healTries >= config.healTries) {
output.print(colors.bold.red(`Healing failed for ${config.healTries} time(s)`));
output.print('AI couldn\'t identify the correct solution');
output.print('Probably the entire flow has changed and the test should be updated');
throw err;
}
if (healedSteps >= config.healLimit) {

@@ -139,13 +120,5 @@ output.print(colors.bold.red(`Can't heal more than ${config.healLimit} step(s) in a test`));

healTries++;
await aiAssistant.setHtmlContext(html);
aiAssistant.setHtmlContext(html);
await tryToHeal(step, err);
recorder.add('close healing session', () => {
recorder.session.restore('heal');
recorder.ignoreErr(err);
});
await recorder.promise();
isHealing = false;
recorder.session.restore();
});

@@ -192,5 +165,2 @@ });

debug('Executing', codeSnippet);
recorder.catch((e) => {
console.log(e);
});
await eval(codeSnippet); // eslint-disable-line

@@ -204,3 +174,3 @@

recorder.add('healed', () => output.print(colors.bold.green(' Code healed successfully')));
output.print(colors.bold.green(' Code healed successfully'));
healedSteps++;

@@ -210,4 +180,2 @@ return;

debug('Failed to execute code', err);
recorder.ignoreErr(err); // healing ded not help
// recorder.catch(() => output.print(colors.bold.red(' Failed healing code')));
}

@@ -218,3 +186,2 @@ }

}
return recorder.promise();
};

@@ -14,3 +14,2 @@ const debug = require('debug')('codeceptjs:recorder');

let asyncErr = null;
let ignoredErrs = [];

@@ -98,3 +97,2 @@ let tasks = [];

tasks = [];
ignoredErrs = [];
this.session.running = false;

@@ -233,6 +231,5 @@ // reset this retries makes the retryFailedStep plugin won't work if there is Before/BeforeSuit block due to retries is undefined on Scenario

catch(customErrFn) {
const fnDescription = customErrFn?.toString()?.replace(/\s{2,}/g, ' ').replace(/\n/g, ' ')?.slice(0, 50);
debug(`${currentQueue()}Queued | catch with error handler ${fnDescription || ''}`);
debug(`${currentQueue()}Queued | catch with error handler`);
return promise = promise.catch((err) => {
log(`${currentQueue()}Error | ${err} ${fnDescription}...`);
log(`${currentQueue()}Error | ${err}`);
if (!(err instanceof Error)) { // strange things may happen

@@ -256,6 +253,4 @@ err = new Error(`[Wrapped Error] ${printObjectProperties(err)}`); // we should be prepared for them

catchWithoutStop(customErrFn) {
const fnDescription = customErrFn?.toString()?.replace(/\s{2,}/g, ' ').replace(/\n/g, ' ')?.slice(0, 50);
return promise = promise.catch((err) => {
if (ignoredErrs.includes(err)) return; // already caught
log(`${currentQueue()}Error (Non-Terminated) | ${err} | ${fnDescription || ''}...`);
log(`${currentQueue()}Error | ${err}`);
if (!(err instanceof Error)) { // strange things may happen

@@ -266,2 +261,4 @@ err = new Error(`[Wrapped Error] ${JSON.stringify(err)}`); // we should be prepared for them

return customErrFn(err);
} if (errFn) {
return errFn(err);
}

@@ -285,6 +282,2 @@ });

ignoreErr(err) {
ignoredErrs.push(err);
},
/**

@@ -291,0 +284,0 @@ * @param {*} err

@@ -14,3 +14,3 @@ const fs = require('fs');

module.exports.genTestId = (test) => {
return require('crypto').createHash('md5').update(test.fullTitle()).digest('base64')
return require('crypto').createHash('sha256').update(test.fullTitle()).digest('base64')
.slice(0, -2);

@@ -17,0 +17,0 @@ };

@@ -97,6 +97,27 @@ /* eslint-disable max-classes-per-file */

const workersToExecute = [];
const currentOutputFolder = config.output;
let currentMochawesomeReportDir;
let currentMochaJunitReporterFile;
if (config.mocha && config.mocha.reporterOptions) {
currentMochawesomeReportDir = config.mocha.reporterOptions?.mochawesome.options.reportDir;
currentMochaJunitReporterFile = config.mocha.reporterOptions['mocha-junit-reporter'].options.mochaFile;
}
collection.createRuns(selectedRuns, config).forEach((worker) => {
const workerName = worker.getOriginalName() || worker.getName();
const separator = path.sep;
const _config = { ...config };
let workerName = worker.name.replace(':', '_');
_config.output = `${currentOutputFolder}${separator}${workerName}`;
if (config.mocha && config.mocha.reporterOptions) {
_config.mocha.reporterOptions.mochawesome.options.reportDir = `${currentMochawesomeReportDir}${separator}${workerName}`;
const _tempArray = currentMochaJunitReporterFile.split(separator);
_tempArray.splice(_tempArray.findIndex(item => item.includes('.xml')), 0, workerName);
_config.mocha.reporterOptions['mocha-junit-reporter'].options.mochaFile = _tempArray.join(separator);
}
workerName = worker.getOriginalName() || worker.getName();
const workerConfig = worker.getConfig();
workersToExecute.push(getOverridenConfig(workerName, workerConfig, config));
workersToExecute.push(getOverridenConfig(workerName, workerConfig, _config));
});

@@ -103,0 +124,0 @@ const workers = [];

{
"name": "codeceptjs",
"version": "3.5.7-beta.1",
"version": "3.5.7",
"description": "Supercharged End 2 End Testing Framework for NodeJS",

@@ -46,4 +46,6 @@ "keywords": [

"test": "npm run test:unit && npm run test:runner",
"test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick'",
"test:appium-other": "mocha test/helper/Appium_test.js --grep 'second'",
"test:appium-quick": "mocha test/helper/AppiumV2_test.js --grep 'quick'",
"test:appium-other": "mocha test/helper/AppiumV2_test.js --grep 'second'",
"test:ios:appium-quick": "mocha test/helper/AppiumV2_ios_test.js --grep 'quick'",
"test:ios:appium-other": "mocha test/helper/AppiumV2_ios_test.js --grep 'second'",
"test-app:start": "php -S 127.0.0.1:8000 -t test/data/app",

@@ -90,5 +92,5 @@ "test-app:stop": "kill -9 $(lsof -t -i:8000)",

"glob": "6.0.1",
"html-minifier-terser": "^7.2.0",
"html-minifier": "4.0.0",
"inquirer": "6.5.2",
"joi": "17.6.0",
"joi": "17.11.0",
"js-beautify": "1.14.9",

@@ -120,13 +122,13 @@ "lodash.clonedeep": "4.5.0",

"@wdio/selenium-standalone-service": "8.3.2",
"@wdio/utils": "8.16.22",
"@wdio/utils": "8.20.3",
"apollo-server-express": "2.25.3",
"chai-as-promised": "7.1.1",
"chai-subset": "1.6.0",
"contributor-faces": "1.0.3",
"contributor-faces": "1.1.0",
"documentation": "12.3.0",
"dtslint": "4.1.6",
"electron": "27.0.2",
"eslint": "8.50.0",
"eslint": "8.53.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-mocha": "6.3.0",

@@ -146,3 +148,3 @@ "expect": "29.7.0",

"runok": "0.9.3",
"sinon": "15.2.0",
"sinon": "17.0.1",
"sinon-chai": "3.7.0",

@@ -153,3 +155,3 @@ "testcafe": "3.3.0",

"tsd-jsdoc": "2.5.0",
"typedoc": "0.24.8",
"typedoc": "0.25.3",
"typedoc-plugin-markdown": "3.13.4",

@@ -156,0 +158,0 @@ "typescript": "5.2.2",

@@ -10,6 +10,10 @@ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua)

Appium Helper:
[![Appium V2 Tests - Android](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_Android.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_Android.yml)
[![Appium V2 Tests - iOS](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_iOS.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_iOS.yml)
Web Helper:
[![Playwright Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml)
[![Puppeteer Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml)
[![WebDriver Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml)
[![Appium Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium.yml)
[![TestCafe Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml)

@@ -16,0 +20,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc