Skip to content

Custom Commands

Manuel edited this page May 23, 2024 · 5 revisions

getBySel

Parameters:

  • selector -> The element selector

This command takes a data-cy element selector and forms a string such as [data-cy=${selector}] then uses the cy.get() to locate the element.

login

Parameters: None

This command visits /account/login inputs email, password, clicks on 'Remember Me' button and on submit on LoginForm.

It uses the testuser credentials found on: https://github.com/manuel12/productivity-app/wiki/Test-Data#testuserjson

loginWithAPI

Parameters:

  • cb -> A callback triggered on the response.

This command logs in programmatically through the POST /api/login endpoint.

It uses the testuser credentials found on: https://github.com/manuel12/productivity-app/wiki/Test-Data#testuserjson

register

Parameters: None

This command visits /account/register inputs username, email, password, password confirmation and on submit on RegisterForm.

It uses the testuser credentials found on: https://github.com/manuel12/productivity-app/wiki/Test-Data#testuserjson

registerWithAPI

Parameters:

  • user -> A user credentials objects that can be used to register instead of the default testuser credentials.

This command register a user programmatically through the POST /api/user endpoint.

If the user credentials object is provided it registers those credentials and if not it uses the testuser credentials found on: https://github.com/manuel12/productivity-app/wiki/Test-Data#testuserjson

deleteTestUsers

Parameters: None

This command programmatically deletes all test users through the DELETE /api/users/delete-test-users/ endpoint.

deleteTestTodos

Parameters: None

This command programmatically deletes all test todos through the DELETE /api/users/delete-test-todos/ endpoint.

deleteTestDailies

Parameters: None

This command programmatically deletes all test dailies through the DELETE /api/users/delete-test-dailies/ endpoint.