Cypress
npm install @tracera/cypress
Requires Node.js ≥ 22.19 and Cypress ≥ 14 (see Autotest adapters). @tracera/cypress on npm.
In cypress.config.ts:
import { defineConfig } from 'cypress';
import { registerTraceraPlugin } from '@tracera/cypress';
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
return registerTraceraPlugin(on, config);
},
supportFile: 'cypress/support/e2e.ts',
},
});
In the support file:
import '@tracera/cypress/support';
For Component Testing, call registerTraceraPlugin from component.setupNodeEvents and import the same support entry from the CT support file.
Only the final Cypress attempt is reported when retries are enabled. If that attempt is a retry (retry > 0), the result Env tab includes CYPRESS_RETRY (1 is the second run).
Environment variables and run mode: Autotest adapters.
Bind testCaseId and autotestName
Import tracera / annotations from @tracera/cypress/runtime, or use cy.traceraTestCase after the support import. If you omit autotestName, the adapter uses the Cypress test title.
At declaration (preferred — bind runs even if you this.skip() early):
import { annotations } from '@tracera/cypress/runtime';
it('login', annotations(42, 'e2e/login'), () => {
cy.visit('/login');
cy.get('[data-testid=sign-in]').should('be.visible');
});
Inside the test (optional if annotations already bind the case):
import { tracera } from '@tracera/cypress/runtime';
it('login', () => {
tracera.testCase(42, 'e2e/login');
cy.visit('/login');
cy.get('[data-testid=sign-in]').should('be.visible');
});
Or: cy.traceraTestCase(42, "e2e/login").
Steps
Use tracera.step (or cy.traceraStep). After import "@tracera/cypress/support", stock beforeEach / afterEach are instrumented — steps inside them go to Setup / Teardown.
import { tracera } from '@tracera/cypress/runtime';
beforeEach(() => {
tracera.step('open shop', () => {
cy.visit('/shop');
});
});
it('checkout', () => {
tracera.testCase(10, 'e2e/checkout');
tracera.step('add to cart', () => {
cy.get('[data-testid=add]').click();
});
});
afterEach(() => {
tracera.step('cleanup', () => {
// …
});
});
Comments, errors, and attachments
Inside a step — fields on that step. Outside a step — fields on the result. At most 10 attachments on the result and on each step. Failure screenshots are forwarded when the plugin is registered.
import { tracera } from '@tracera/cypress/runtime';
it('login', () => {
tracera.testCase(42, 'e2e/login');
tracera.comment('result-level note');
tracera.error('result-level error text');
tracera.step('open login', () => {
cy.visit('/login');
tracera.comment('landed on login');
tracera.attachment({
fileName: 'suite-log.txt',
mimeType: 'text/plain',
data: 'finished login flow',
});
});
});