@forgeframework/e2e
v0.4.0
Published
E2E testing framework for the Forge Framework.
Downloads
571
Maintainers
Readme
@forgeframework/e2e
E2E testing framework for the Forge Framework.
Part of the Forge Framework — a TypeScript framework for backend microservices and web applications.
Installation
npm install @forgeframework/e2eUsage
import {
ForgeTestRunner,
PageObject,
DataFactory,
} from '@forgeframework/e2e';
class LoginPage extends PageObject {
readonly url = '/login';
private username = this.element('#username');
private password = this.element('#password');
private submitBtn = this.element('button[type="submit"]');
private errorMsg = this.element('.error-message');
async login(user: string, pass: string): Promise<void> {
await this.username.fill(user);
await this.password.fill(pass);
await this.submitBtn.click();
}
async getError(): Promise<string> {
return this.errorMsg.getText();
}
}
const userFactory = new DataFactory(() => ({
username: `user-${Date.now()}`,
password: 'Test1234!',
email: `test-${Date.now()}@example.com`,
}));
const runner = new ForgeTestRunner({
browsers: ['chromium', 'firefox'],
baseUrl: 'https://staging.example.com',
retries: 2,
parallel: true,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
visualRegression: {
threshold: 0.02,
mask: ['.timestamp', '.avatar'],
},
accessibility: {
standard: 'WCAG2AA',
},
dashboard: {
enabled: true,
outputDir: './test-results/dashboard',
},
reporters: ['console', 'html', 'junit'],
});
const results = await runner.run(['./tests/**/*.e2e.ts']);
await runner.generateReport();Documentation
Full API reference and guides: https://carbonforge.io/framework/docs/test/e2e
(Documentation site launching soon.)
License
MIT © Carbon Forge
