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)
65 lines
2.4 KiB
TypeScript
65 lines
2.4 KiB
TypeScript
describe('User tests', () => {
|
|
Cypress.session.clearAllSavedSessions();
|
|
|
|
beforeEach(() => {
|
|
cy.login(Cypress.env('admin_user'), Cypress.env('admin_password'));
|
|
cy.visit('/admin/users');
|
|
});
|
|
|
|
it('Add a User', () => {
|
|
// add user
|
|
cy.contains(/Create user/i).should('be.visible');
|
|
cy.getDataTest('button-create-user').click();
|
|
cy.getDataTest('input-username').find('input').as('inputName').click();
|
|
cy.get('@inputName').type('Test-user', { delay: 0 });
|
|
cy.getDataTest('input-password').find('input').as('inputPassword').click();
|
|
cy.get('@inputPassword').type('testPasswordCypress', { delay: 0 });
|
|
cy.getDataTest('dropdown-role').click();
|
|
cy.getDataTest('dropdown-item-user').click();
|
|
cy.getDataTest('button-submit').click();
|
|
cy.contains('table tbody tr', 'Test-user').should('contain.text', 'User');
|
|
});
|
|
|
|
it('Edit a User role and password', () => {
|
|
// edit user
|
|
cy.get('table tbody tr')
|
|
.contains('td', /Test-user/i)
|
|
.parent()
|
|
.within(() => {
|
|
cy.getDataTest('link-button-edit').click(); // Clicks the button inside the row
|
|
});
|
|
cy.getDataTest('input-password').find('input').as('inputPassword').click();
|
|
cy.get('@inputPassword').type('newPassword', { delay: 0 });
|
|
cy.getDataTest('dropdown-role').click();
|
|
cy.getDataTest('dropdown-item-viewOnly').click();
|
|
cy.getDataTest('button-submit').click();
|
|
|
|
cy.visit('/admin/users');
|
|
cy.get('table tbody tr')
|
|
.contains('td', /Test-user/i)
|
|
.parent()
|
|
.should('contain.text', 'View only');
|
|
|
|
cy.logout();
|
|
cy.url().should('eq', Cypress.config().baseUrl + '/login');
|
|
cy.getDataTest('input-username').find('input').as('inputUsername').click();
|
|
cy.get('@inputUsername').type('Test-user', { delay: 0 });
|
|
cy.get('@inputUsername').click();
|
|
cy.getDataTest('input-password').find('input').type('newPassword', { delay: 0 });
|
|
cy.getDataTest('button-submit').click();
|
|
cy.url().should('include', '/websites');
|
|
});
|
|
|
|
it('Delete a user', () => {
|
|
// delete user
|
|
cy.get('table tbody tr')
|
|
.contains('td', /Test-user/i)
|
|
.parent()
|
|
.within(() => {
|
|
cy.getDataTest('button-delete').click(); // Clicks the button inside the row
|
|
});
|
|
cy.contains(/Are you sure you want to delete Test-user?/i).should('be.visible');
|
|
cy.get('[role="dialog"]').contains('button', 'Delete').click();
|
|
});
|
|
});
|