Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@codeceptjs/helper
Advanced tools
@codeceptjs/helper is a helper class for CodeceptJS, a popular end-to-end testing framework. This package provides various methods to interact with web applications, APIs, and mobile applications, making it easier to write and manage tests.
Web Interaction
This feature allows you to interact with web pages by navigating to URLs, filling out forms, clicking buttons, and verifying text on the page.
const { I } = inject();
I.amOnPage('https://example.com');
I.fillField('Username', 'user');
I.fillField('Password', 'password');
I.click('Login');
I.see('Welcome, user!');
API Testing
This feature allows you to send HTTP requests and validate the responses, making it useful for API testing.
const { I } = inject();
I.sendGetRequest('/api/users').then(response => {
I.assertEqual(response.status, 200);
I.assertEqual(response.data.length, 10);
});
Mobile Interaction
This feature allows you to interact with mobile applications, including installing apps, clicking buttons, and filling out forms.
const { I } = inject();
I.runOnAndroid({
device: 'emulator-5554',
app: 'path/to/app.apk'
}, () => {
I.seeAppIsInstalled('com.example.app');
I.click('Login');
I.fillField('Username', 'user');
I.fillField('Password', 'password');
I.click('Submit');
I.see('Welcome, user!');
});
Selenium WebDriver is a popular tool for automating web applications for testing purposes. It provides a more low-level API compared to @codeceptjs/helper, which can be more flexible but also more complex to use.
Cypress is a modern end-to-end testing framework that provides a rich set of features for web testing. It offers a more integrated and user-friendly experience compared to @codeceptjs/helper, but it is primarily focused on web applications.
WebdriverIO is a testing utility for Node.js that provides a high-level API for interacting with web applications. It is similar to @codeceptjs/helper in terms of functionality but offers more flexibility and customization options.
Base class for all CodeceptJS helpers. This class has been moved into a separate package to allow other helpers to be extended from it, without requiring main codeceptjs package.
npm i @codeceptjs/helper --save
Create CodeceptJS helper as described in documentation.
const Helper = require('@codeceptjs/helper');
class MyHelper extends Helper {
// implement custom helper here
}
Abstract class. Helpers abstracts test execution backends.
Methods of Helper class will be available in tests in I
object.
They provide user-friendly abstracted actions over NodeJS libraries.
Hooks (methods starting with _
) can be used to setup/teardown,
or handle execution flow.
Methods are expected to return a value in order to be wrapped in promise.
config
anyAbstract method to validate config
config
anyReturns any
Sets config for current test
opts
anyHook executed before all tests
Hook executed before each test.
test
Mocha.TestHook executed after each test
Hook provides a test details Executed in the very beginning of a test
test
Mocha.TestHook executed after each passed test
test
Mocha.TestHook executed after each failed test
test
Mocha.TestHook executed before each step
step
CodeceptJS.StepHook executed after each step
step
CodeceptJS.StepHook executed before each suite
suite
Mocha.SuiteHook executed after each suite
suite
Mocha.SuiteHook executed after all tests are executed
suite
Mocha.SuiteAbstract method to provide common interface to accessing helpers internals inside a test.
description
fn
Access another configured helper: this.helpers['AnotherHelper']
Type: any
Print debug message to console (outputs only in debug mode)
msg
stringAbstract method to provide required config options
Returns any
FAQs
Base class for all CodeceptJS helpers
The npm package @codeceptjs/helper receives a total of 174,686 weekly downloads. As such, @codeceptjs/helper popularity was classified as popular.
We found that @codeceptjs/helper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.