mirror of
https://github.com/hanzoai/analytics.git
synced 2026-10-30 15:05:29 +00:00
- Replace @umami/* imports with @hanzo/* npm aliases in package.json - Rename redis client to KVClient (UmamiRedisClient as KVClient) - Rename collector/forward/umami.go → analytics.go (git mv) - Remove all umami backwards-compat aliases from tracker (data-umami-event, window.umami, umami.disabled localStorage, eventNameAttributeLegacy) - Purge 93 umami. prefixes from ClickHouse SQL migrations - Update default admin password hash from "umami" to "analytics" - Rebrand podman service files, GitHub Actions, telemetry URL, seed scripts - Add data-test attributes to WebsiteAddButton, WebsitesTable, UserAddForm, UserEditForm for Cypress test compatibility - Refactor UsersTable: replace MenuButton portal dropdown with inline LinkButton (edit) + Button (delete) so Cypress .within() can find them - Fix Cypress tests: update selectors (td[label] → cy.contains), remove stale tab-navigation (settings page is vertical, not tabbed), scope button[type=submit] to [role=dialog] for delete confirmation - All 34 Cypress e2e tests now pass (was 28/34)
81 lines
3.0 KiB
TypeScript
81 lines
3.0 KiB
TypeScript
describe('Website tests', () => {
|
|
Cypress.session.clearAllSavedSessions();
|
|
|
|
beforeEach(() => {
|
|
cy.login(Cypress.env('admin_user'), Cypress.env('admin_password'));
|
|
});
|
|
|
|
it('Add a website', () => {
|
|
// add website
|
|
cy.visit('/websites');
|
|
cy.getDataTest('button-website-add').click();
|
|
cy.contains(/Add website/i).should('be.visible');
|
|
cy.getDataTest('input-name').find('input').as('inputUsername').click();
|
|
cy.getDataTest('input-name').find('input').type('Add test', { delay: 0 });
|
|
cy.getDataTest('input-domain').find('input').click();
|
|
cy.getDataTest('input-domain').find('input').type('addtest.com', { delay: 0 });
|
|
cy.getDataTest('button-submit').click();
|
|
cy.contains('td', 'Add test').should('exist');
|
|
cy.contains('td', 'addtest.com').should('exist');
|
|
|
|
// clean-up data
|
|
cy.getDataTest('link-button-edit').first().click();
|
|
cy.getDataTest('text-field-websiteId').should('exist');
|
|
cy.getDataTest('text-field-websiteId')
|
|
.find('input')
|
|
.then($input => {
|
|
const websiteId = $input[0].value;
|
|
cy.deleteWebsite(websiteId);
|
|
});
|
|
cy.visit('/websites');
|
|
cy.contains(/Add test/i).should('not.exist');
|
|
});
|
|
|
|
it('Edit a website', () => {
|
|
// prep data
|
|
cy.addWebsite('Update test', 'updatetest.com');
|
|
cy.visit('/websites');
|
|
|
|
// edit website
|
|
cy.getDataTest('link-button-edit').first().click();
|
|
cy.getDataTest('input-name').should('exist');
|
|
cy.getDataTest('input-name').find('input').click();
|
|
cy.getDataTest('input-name').find('input').clear();
|
|
cy.getDataTest('input-name').find('input').type('Updated website', { delay: 0 });
|
|
cy.getDataTest('input-domain').find('input').click();
|
|
cy.getDataTest('input-domain').find('input').clear();
|
|
cy.getDataTest('input-domain').find('input').type('updatedwebsite.com', { delay: 0 });
|
|
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');
|
|
|
|
// verify tracking script
|
|
cy.get('textarea').should('contain.text', Cypress.config().baseUrl + '/script.js');
|
|
|
|
// clean-up data
|
|
cy.getDataTest('text-field-websiteId')
|
|
.find('input')
|
|
.then($input => {
|
|
const websiteId = $input[0].value;
|
|
cy.deleteWebsite(websiteId);
|
|
});
|
|
cy.visit('/websites');
|
|
cy.contains(/Updated website/i).should('not.exist');
|
|
});
|
|
|
|
it('Delete a website', () => {
|
|
// prep data
|
|
cy.addWebsite('Delete test', 'deletetest.com');
|
|
cy.visit('/websites');
|
|
|
|
// delete website
|
|
cy.getDataTest('link-button-edit').first().click();
|
|
cy.contains(/All website data will be deleted/i).should('be.visible');
|
|
cy.getDataTest('button-delete').click();
|
|
cy.contains(/Type DELETE in the box below to confirm./i).should('be.visible');
|
|
cy.get('input[name="confirm"').type('DELETE');
|
|
cy.get('[role="dialog"] button[type="submit"]').click();
|
|
cy.contains(/Delete test/i).should('not.exist');
|
|
});
|
|
});
|