Skip to content
Snippets Groups Projects
Commit 6b071af2 authored by Beatrice-Emanuela Suarasan's avatar Beatrice-Emanuela Suarasan
Browse files

test: add cypress custom commands

parent a78151e4
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ const ACCEPTED_AND_PUBLISHED_TITLE = 'Badge__SuccessStatus';
export const Dashboard = {
getSubmitButton() {
return cy.get(BUTTON).contains('New Submission');
return cy.get(BUTTON).contains('New submission');
},
clickSubmit() {
this.getSubmitButton().click();
......
......@@ -37,3 +37,43 @@ Cypress.Commands.add('login', name => {
cy.visit('/kotahi/dashboard')
})
})
Cypress.Commands.add('fillInput', { prevSubject: true }, (subject, text) => {
return cy.wrap(subject).click().clear().type(text);
});
Cypress.Commands.add('getByDataTestId', (dataTestId) => {
cy.get(`[data-testid='${dataTestId}']`);
});
Cypress.Commands.add('getByContainsDataTestId', (dataTestId) => {
cy.get(`[data-testid*='${dataTestId}']`);
});
Cypress.Commands.add('getByClass', (className) => {
cy.get(`[class='${className}']`);
});
Cypress.Commands.add('getByContainsClass', (className) => {
cy.get(`[class*='${className}']`);
});
Cypress.Commands.add('getByContainsAreaLabel', (areaLabel) => {
cy.get(`[aria-label*='${areaLabel}']`);
});
Cypress.Commands.add('getByName', (name) => {
cy.get(`[name='${name}']`);
});
Cypress.Commands.add('getByContainsName', (name) => {
cy.get(`[name*='${name}']`);
});
Cypress.Commands.add('getByContainsId', (id) => {
cy.get(`[id*='${id}']`);
});
Cypress.Commands.add('getByNameAndValue', (name, value) => {
cy.get(`[name='${name}'][value=${value}]`);
});
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment