mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
install cypress and add initial test
This commit is contained in:
parent
23a45a3109
commit
5b9f0707b8
10 changed files with 768 additions and 20 deletions
12
cypress/e2e/login.cy.ts
Normal file
12
cypress/e2e/login.cy.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
describe('Login test', () => {
|
||||
it('logs user in with correct credentials and logs user out', () => {
|
||||
cy.visit('/login');
|
||||
cy.dataCy('input-username').type(Cypress.env('umami_user'));
|
||||
cy.dataCy('input-password').type(Cypress.env('umami_password'));
|
||||
cy.dataCy('button-submit').click();
|
||||
cy.url().should('eq', Cypress.config().baseUrl + '/dashboard');
|
||||
cy.dataCy('button-profile').click();
|
||||
cy.dataCy('item-logout').click();
|
||||
cy.url().should('eq', Cypress.config().baseUrl + '/login');
|
||||
});
|
||||
});
|
||||
5
cypress/support/e2e.ts
Normal file
5
cypress/support/e2e.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/// <reference types="cypress" />
|
||||
|
||||
Cypress.Commands.add('dataCy', value => {
|
||||
return cy.get(`[data-cy=${value}]`);
|
||||
});
|
||||
11
cypress/support/index.d.ts
vendored
Normal file
11
cypress/support/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/// <reference types="cypress" />
|
||||
|
||||
declare namespace Cypress {
|
||||
interface Chainable {
|
||||
/**
|
||||
* Custom command to select DOM element by data-cy attribute.
|
||||
* @example cy.dataCy('greeting')
|
||||
*/
|
||||
dataCy(value: string): Chainable<JQuery<HTMLElement>>;
|
||||
}
|
||||
}
|
||||
8
cypress/tsconfig.json
Normal file
8
cypress/tsconfig.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["es5", "dom"],
|
||||
"types": ["cypress", "node"]
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue