Add E2E tests for logout, account CRUD, and file operations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
62
cypress/e2e/logout.cy.js
Normal file
62
cypress/e2e/logout.cy.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import { loginWithFixtures } from '../support/intercept';
|
||||
|
||||
describe('Logout Flow', () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
});
|
||||
|
||||
it('shows account menu when head icon is clicked', () => {
|
||||
cy.visit('/files');
|
||||
cy.wait('@getFiles');
|
||||
|
||||
// Click the head icon to open account menu
|
||||
cy.get('#acct_mgmt_button').click();
|
||||
cy.get('#account_menu').should('be.visible');
|
||||
cy.get('#greeting').should('contain', 'Test Admin');
|
||||
});
|
||||
|
||||
it('account menu shows admin management link for admin user', () => {
|
||||
cy.visit('/files');
|
||||
cy.wait('@getFiles');
|
||||
|
||||
cy.get('#acct_mgmt_button').click();
|
||||
cy.get('#account_menu').should('be.visible');
|
||||
// Admin user should see account management option
|
||||
cy.get('#btn_acct_mgmt').should('exist');
|
||||
});
|
||||
|
||||
it('account menu has logout button', () => {
|
||||
cy.visit('/files');
|
||||
cy.wait('@getFiles');
|
||||
|
||||
cy.get('#acct_mgmt_button').click();
|
||||
cy.get('#btn_logout_in_menu').should('exist');
|
||||
});
|
||||
|
||||
it('clicking My Account navigates to /my-account', () => {
|
||||
cy.visit('/files');
|
||||
cy.wait('@getFiles');
|
||||
|
||||
cy.get('#acct_mgmt_button').click();
|
||||
cy.get('#btn_mang_ur_acct').click();
|
||||
cy.url().should('include', '/my-account');
|
||||
});
|
||||
|
||||
it('clicking Account Management navigates to /account-admin', () => {
|
||||
cy.visit('/files');
|
||||
cy.wait('@getFiles');
|
||||
|
||||
cy.get('#acct_mgmt_button').click();
|
||||
cy.get('#btn_acct_mgmt').click();
|
||||
cy.url().should('include', '/account-admin');
|
||||
});
|
||||
|
||||
it('logout redirects to login page', () => {
|
||||
cy.visit('/files');
|
||||
cy.wait('@getFiles');
|
||||
|
||||
cy.get('#acct_mgmt_button').click();
|
||||
cy.get('#btn_logout_in_menu').click();
|
||||
cy.url().should('include', '/login');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user