
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
moizkhan-data-driven-test
Advanced tools
A comprehensive data-driven test automation framework for Playwright with universal field detection, intelligent error validation, and bundled source code protection
A comprehensive data-driven test automation framework for Playwright with universal field detection, intelligent error validation, and clean architectural separation.
This version introduces a clean separation of concerns and webpack bundling:
npm install moizkhan-data-driven-test
npm install moizkhan-data-driven-test
const { BaseTestPage, DataDrivenTestPage } = require('moizkhan-data-driven-test');
{
"pageInfo": {
"pageName": "Login",
"url": "https://example.com/login"
},
"selectors": {
"userIdInput": "input[name='userId']",
"passwordInput": "input[name='password']",
"loginButton": "button[type='submit']"
},
"credentials": {
"admin": {
"userId": "admin",
"password": "password123",
"description": "Admin account"
}
},
"fieldData": [
{
"labelName": "User ID",
"selector": "input[name='userId']",
"validInputs": [
{
"value": "admin",
"description": "Valid admin user"
}
],
"invalidInputs": [
{
"value": "",
"description": "Empty user ID",
"expectedError": "User ID is required"
}
]
}
]
}
const { BaseTestPage } = require('moizkhan-data-driven-test');
class LoginPage extends BaseTestPage {
constructor(page, testData) {
super(page, testData, testData.pageInfo.pageName);
this.loginUrl = testData.pageInfo.url;
this.selectors = testData.selectors;
this.credentials = testData.credentials;
}
async navigate() {
await this.page.goto(this.loginUrl);
}
getNextButtonSelector() {
return this.selectors.loginButton;
}
getSubmitButtonSelector() {
return this.selectors.loginButton;
}
}
const { test } = require('@playwright/test');
const loginTestData = require('./testData/loginTestData.json');
test('data-driven login test', async ({ page }) => {
const loginPage = new LoginPage(page, loginTestData);
// Run comprehensive validation tests
await loginPage.runValidationTests();
// Run positive tests only
await loginPage.runPositiveTestsOnly();
});
Main base class for page objects with data-driven capabilities.
Constructor:
constructor(page, testData, pageName)Abstract Methods:
getNextButtonSelector() - Must return next button selectorgetSubmitButtonSelector() - Must return submit button selectorMain Methods:
runValidationTests() - Run invalid then valid input testsrunPositiveTestsOnly() - Fill all fields with valid dataclickNext() - Click next button using generic approachCore test execution engine with universal field handling.
Constructor:
constructor(page, testData)Methods:
testOneValidInput(field) - Test single field with valid inputapplyBlurAndValidate(field, invalidInput) - Test field validationclickNextButton(selector) - Click button using provided selectorcompareErrorMessages(expected, actual) - Advanced error comparisonUtility functions for the framework.
Methods:
validateTestData(testData) - Validate test data structuremergeTestData(...testData) - Merge multiple test data objectsformatErrorMessage(error, context) - Format error messagesclass GenericLoginPage extends BaseTestPage {
constructor(page, testData) {
super(page, testData, testData.pageInfo.pageName);
this.loginUrl = testData.pageInfo.url;
this.selectors = testData.selectors;
this.credentials = testData.credentials;
}
async loginWithCredentials(credentialKey = 'admin') {
const credential = this.credentials[credentialKey];
await this.page.goto(this.loginUrl);
await this.page.fill(this.selectors.userIdInput, credential.userId);
await this.page.fill(this.selectors.passwordInput, credential.password);
await this.page.click(this.selectors.loginButton);
}
getNextButtonSelector() {
return this.selectors.loginButton;
}
getSubmitButtonSelector() {
return this.selectors.loginButton;
}
}
const { mergeTestData } = require('moizkhan-data-driven-test');
// Merge test data from multiple pages
const combinedTestData = mergeTestData(
loginTestData,
basicInfoTestData,
businessDetailsTestData
);
// Use in comprehensive flow tests
test('complete user flow', async ({ page }) => {
const flow = new UserFlow(page, combinedTestData);
await flow.completeFullWorkflow();
});
The framework expects test data in a specific JSON structure:
interface TestData {
pageInfo?: {
pageName?: string;
url?: string;
description?: string;
};
selectors?: {
[key: string]: string;
};
credentials?: {
[key: string]: {
userId: string;
password: string;
description?: string;
role?: string;
};
};
fieldData: FieldData[];
}
MIT
Note: This is a bundled package with minified source code for intellectual property protection. The framework provides comprehensive testing capabilities while keeping the implementation details secure.
FAQs
A comprehensive data-driven test automation framework for Playwright with universal field detection, intelligent error validation, and bundled source code protection
We found that moizkhan-data-driven-test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.