diff --git a/cypress.config.ts b/cypress.config.ts index 5bed49b8..4b01931b 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -4,4 +4,9 @@ export default defineConfig({ e2e: { baseUrl: 'http://localhost:3000', }, + // default username / password on init + env: { + umami_user: 'admin', + umami_password: 'umami', + }, }); diff --git a/cypress/docker-compose.yml b/cypress/docker-compose.yml index 3cd8f546..01a47bd8 100644 --- a/cypress/docker-compose.yml +++ b/cypress/docker-compose.yml @@ -43,9 +43,10 @@ services: - CYPRESS_umami_user=admin - CYPRESS_umami_password=umami volumes: - - ../tsconfig.json:/tsconfig.json + - ./tsconfig.json:/tsconfig.json - ../cypress.config.ts:/cypress.config.ts - ./:/cypress - ../node_modules/:/node_modules + - ../src/lib/crypto.ts:/src/lib/crypto.ts volumes: umami-db-data: diff --git a/cypress/e2e/login.cy.ts b/cypress/e2e/login.cy.ts index 288d5c51..5831c81d 100644 --- a/cypress/e2e/login.cy.ts +++ b/cypress/e2e/login.cy.ts @@ -6,8 +6,12 @@ describe('Login tests', () => { }, () => { cy.visit('/login'); - cy.getDataTest('input-username').find('input').type(Cypress.env('umami_user')); - cy.getDataTest('input-password').find('input').type(Cypress.env('umami_password')); + cy.getDataTest('input-username').find('input').click(); + cy.getDataTest('input-username').find('input').type(Cypress.env('umami_user'), { delay: 50 }); + cy.getDataTest('input-password').find('input').click(); + cy.getDataTest('input-password') + .find('input') + .type(Cypress.env('umami_password'), { delay: 50 }); cy.getDataTest('button-submit').click(); cy.url().should('eq', Cypress.config().baseUrl + '/dashboard'); cy.getDataTest('button-profile').click(); diff --git a/cypress/e2e/website.cy.ts b/cypress/e2e/website.cy.ts index feec39de..b60d8e7a 100644 --- a/cypress/e2e/website.cy.ts +++ b/cypress/e2e/website.cy.ts @@ -10,8 +10,10 @@ describe('Website tests', () => { cy.visit('/settings/websites'); cy.getDataTest('button-website-add').click(); cy.contains(/Add website/i).should('be.visible'); - cy.getDataTest('input-name').find('input').wait(500).type('Add test', { delay: 50 }); - cy.getDataTest('input-domain').find('input').wait(500).type('addtest.com', { delay: 50 }); + cy.getDataTest('input-name').find('input').click(); + cy.getDataTest('input-name').find('input').type('Add test', { delay: 50 }); + cy.getDataTest('input-domain').find('input').click(); + cy.getDataTest('input-domain').find('input').type('addtest.com', { delay: 50 }); cy.getDataTest('button-submit').click(); cy.get('td[label="Name"]').should('contain.text', 'Add test'); cy.get('td[label="Domain"]').should('contain.text', 'addtest.com'); @@ -26,10 +28,10 @@ describe('Website tests', () => { cy.deleteWebsite(websiteId); }); cy.visit('/settings/websites'); - cy.contains('Add test').should('not.exist'); + cy.contains(/Add test/i).should('not.exist'); }); - it.only('Edit a website', () => { + it('Edit a website', () => { // prep data cy.addWebsite('Update test', 'updatetest.com'); cy.visit('/settings/websites'); @@ -37,16 +39,12 @@ describe('Website tests', () => { // edit website cy.getDataTest('link-button-edit').first().click(); cy.contains(/Details/i).should('be.visible'); - cy.getDataTest('input-name') - .find('input') - .wait(500) - .clear() - .type('Updated website', { delay: 50 }); - cy.getDataTest('input-domain') - .find('input') - .wait(500) - .clear() - .type('updatedwebsite.com', { delay: 50 }); + cy.getDataTest('input-name').find('input').click(); + cy.getDataTest('input-name').find('input').clear(); + cy.getDataTest('input-name').find('input').type('Updated website', { delay: 50 }); + cy.getDataTest('input-domain').find('input').click(); + cy.getDataTest('input-domain').find('input').clear(); + cy.getDataTest('input-domain').find('input').type('updatedwebsite.com', { delay: 50 }); cy.getDataTest('button-submit').click({ force: true }); cy.getDataTest('input-name').find('input').should('have.value', 'Updated website'); cy.getDataTest('input-domain').find('input').should('have.value', 'updatedwebsite.com'); @@ -69,7 +67,7 @@ describe('Website tests', () => { cy.deleteWebsite(websiteId); }); cy.visit('/settings/websites'); - cy.contains('Add test').should('not.exist'); + cy.contains(/Add test/i).should('not.exist'); }); it('Delete a website', () => { @@ -86,6 +84,6 @@ describe('Website tests', () => { cy.contains(/Type DELETE in the box below to confirm./i).should('be.visible'); cy.get('input[name="confirm"').type('DELETE'); cy.get('button[type="submit"]').click(); - cy.contains('Delete test').should('not.exist'); + cy.contains(/Delete test/i).should('not.exist'); }); });