universe/views directory
:views-e2e
views-e2e <some_spec>
views-e2e specs/trial/test_trial
. cviews-e2e open
Commands
Cypress API is useful for adding new custom commands or overriding existing ones. For further detais, please check the Commands API documentation.Chainable
interface with the definition of your commands in the views/e2e/cypress/support/commands_def.ts
file:declare namespace Cypress {
interface Chainable<Subject> {
yourCustomCommand(arg: string): Chainable<Subject>;
anotherCustomCommand(arg1: string, arg2: number): Chainable<Subject>;
...
}
}
Commands.add
method in the views/e2e/support/commands.ts
file:Cypress.Commands.add("yourCustomCommand", (arg: string) => {
cy.log("Running your custom command");
// your command code goes here
...
});
Cypress.Commands.add("anotherCustomCommand", (arg1: string, arg2: number) => {
cy.log("Running another custom command");
// more custom command execution
...
});
views/e2e/specs
directory with file extension test_{your-test-name}.cy.ts
.// test_{your-test-name}.cy.ts
describe("Test findings", () => {
// Type here all tests which will start visisting /this/url
});
describe("Test findings", () => {
// Type here all tests which will visiting /this/one/other/url
});
views/e2e/support/user.ts
and contains a mapping logic which mimics the following behavior:User1, User2 and User3 (Should run in) => CI Node 1
User 4 (Should run in) => CI Node 2
User 5 and User6 (Should run in) => CI Node 3
...
runForUsers()
function:describe("Test an awesome aspect", () => {
runForUsers(
[
// users for running the following tests IntegratesUsers.integratesmanager,
IntegratesUsers.continuoushack2,
IntegratesUsers.integratesadmin,
],
(user) => {
// Now you can place your tests and will only run for the previous users! it("Test feature 1", ()=>{...}) it("Test feature 2", ()=>{...}) it("Test feature 3", ()=>{...}) }
);
});
views-lint
unit
: Each test should test a single unit of the application. This could be a single page, a single component, or a single feature. For example, a single test should not create a root, and then edit a user, and Then delete a user. Instead, there should be three separate tests for each of these actions.