Skip to content

Commit

Permalink
Introduced cypress-plugin-steps, removed custom step logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
antowaddle committed Oct 31, 2024
1 parent 23d86fc commit 113d069
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,6 @@ declare global {
*/
// eslint-disable-next-line @typescript-eslint/method-signature-style
findAllByTestId(id: Matcher | Matcher[], options?: MatcherOptions): Chainable<JQuery>;

/**
* Logs a step in the Cypress test runner and console.
* This method is useful for creating clear, descriptive logs of test steps,
* enhancing test readability and debugging.
*
* @param description A string describing the step being performed in the test.
*
* Usage:
* cy.step('Logging in to the application');
* cy.step('Verifying dashboard elements');
*
* In the Cypress test runner and console, this will appear as:
* STEP: Logging in to the application
* STEP: Verifying dashboard elements
*
* This helps in quickly identifying the current stage of the test execution
* and provides a clear overview of the test flow.
*/
step: (description: string) => Chainable;
}
}
}
Expand Down Expand Up @@ -257,10 +237,6 @@ Cypress.Commands.overwriteQuery('findAllByTestId', function findAllByTestId(...a
return enhancedFindByTestId(this, ...args);
});

Cypress.Commands.add('step', (description: string) => {
cy.log(`\n--- 🔷 Step: ${description} 🔷---\n`);
});

const enhancedFindByTestId = (
command: Cypress.Command,
originalFn: Cypress.QueryFn<'findAllByTestId' | 'findByTestId'>,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/__tests__/cypress/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'cypress-mochawesome-reporter/register';
import './commands';
import { asProjectAdminUser } from '~/__tests__/cypress/cypress/utils/mockUsers';
import { addCommands as webSocketsAddCommands } from './websockets';
import 'cypress-plugin-steps';

chai.use(chaiSubset);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/__tests__/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"exclude": ["node_modules", "public", "coverage", ".nyc_output"],
"compilerOptions": {
"sourceMap": true,
"types": ["node", "cypress", "@testing-library/cypress", "cypress-axe"]
"types": ["node", "cypress", "@testing-library/cypress", "cypress-axe", "cypress-plugin-steps"]
}
}

0 comments on commit 113d069

Please sign in to comment.