-
-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): add coverage for chart of accounts
- Loading branch information
Showing
6 changed files
with
191 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
describe('Chart of Accounts', () => { | ||
let user; | ||
let host; | ||
|
||
before(() => { | ||
cy.signup().then(u => { | ||
user = u; | ||
cy.createHostOrganization(user.email).then(returnedAccount => { | ||
host = returnedAccount; | ||
cy.visit(`/dashboard/${host.slug}/chart-of-accounts`); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should support all chart of accounts operations', () => { | ||
// Create category and test form validation | ||
cy.contains('button', 'Create category').click(); | ||
|
||
// Fill form | ||
cy.get('input[name="code"]').type('TEST001'); | ||
cy.get('input[name="name"]').type('Test Category'); | ||
cy.get('input[name="friendlyName"]').type('Friendly Test Category'); | ||
cy.get('[data-cy="select"]').first().click(); | ||
cy.get('[data-cy="select-option"]').contains('Expenses').should('be.visible').click(); | ||
cy.get('[data-cy="select"]').eq(1).click(); | ||
cy.get('[data-cy="select-option"]').contains('Yes').should('be.visible').click(); | ||
cy.contains('button', 'Create category').click(); | ||
|
||
// Verify category was added | ||
cy.contains('TEST001'); | ||
cy.contains('Test Category'); | ||
cy.contains('Friendly Test Category'); | ||
|
||
// Test filtering by kind | ||
cy.get('[data-cy="filter-kind"]').click(); | ||
cy.get('[data-cy="combo-select-option"]').contains('Expenses').should('be.visible').click(); | ||
cy.get('table').should('contain', 'Expenses'); | ||
cy.get('table').should('not.contain', 'Contributions'); | ||
|
||
// Test filtering by visibility | ||
cy.get('[data-cy="filter-hostOnly"]').click(); | ||
cy.get('[data-cy="combo-select-option"]').contains('Yes').should('be.visible').click(); | ||
cy.get('table').should('contain', 'Yes'); | ||
cy.get('table').should('not.contain', 'No'); | ||
|
||
// Test search by code | ||
cy.get('[data-cy="filter-searchTerm"]').type('TEST001'); | ||
cy.get('table').should('contain', 'TEST001'); | ||
cy.get('table').should('not.contain', 'OTHER'); | ||
cy.get('[data-cy="filter-searchTerm"]').clear(); | ||
|
||
// Test search by name | ||
cy.get('[data-cy="filter-searchTerm"]').type('Test Category'); | ||
cy.get('table').should('contain', 'Test Category'); | ||
cy.get('table').should('not.contain', 'Other Category'); | ||
cy.get('[data-cy="filter-searchTerm"]').clear(); | ||
|
||
// Test search by friendly name | ||
cy.get('[data-cy="filter-searchTerm"]').type('Friendly Test Category'); | ||
cy.get('table').should('contain', 'Friendly Test Category'); | ||
cy.get('table').should('not.contain', 'Other Friendly Name'); | ||
cy.get('[data-cy="filter-searchTerm"]').clear(); | ||
|
||
// Test sorting by code | ||
cy.get('[data-cy="filter-orderBy"]').click(); | ||
cy.get('[data-cy="combo-select-option"]').contains('Code ascending').should('be.visible').click(); | ||
cy.get('tbody tr').first().should('contain', 'TEST001'); | ||
cy.get('[data-cy="filter-orderBy"]').click(); | ||
cy.get('[data-cy="combo-select-option"]').contains('Code descending').should('be.visible').click(); | ||
cy.get('tbody tr').first().should('not.contain', 'TEST001'); | ||
|
||
// Test sorting by name | ||
cy.get('[data-cy="filter-orderBy"]').click(); | ||
cy.get('[data-cy="combo-select-option"]').contains('Name ascending').should('be.visible').click(); | ||
cy.get('tbody tr').first().should('contain', 'Test Category'); | ||
cy.get('[data-cy="filter-orderBy"]').click(); | ||
cy.get('[data-cy="combo-select-option"]').contains('Name descending').should('be.visible').click(); | ||
cy.get('tbody tr').first().should('not.contain', 'Test Category'); | ||
|
||
// Test category deletion | ||
cy.get('table').contains('tr', 'TEST001').find('button').click(); | ||
cy.contains('Delete').should('be.visible').click(); | ||
cy.contains('button', 'Yes').click(); | ||
cy.get('table').should('not.contain', 'TEST001'); | ||
|
||
// Test drawer details | ||
cy.contains('button', 'Create category').click(); | ||
cy.get('input[name="code"]').type('VIEW001'); | ||
cy.get('input[name="name"]').type('View Category'); | ||
cy.get('input[name="friendlyName"]').type('Friendly View Category'); | ||
cy.get('[data-cy="select"]').first().click(); | ||
cy.get('[data-cy="select-option"]').contains('Expenses').should('be.visible').click(); | ||
cy.get('[data-cy="select"]').eq(1).click(); | ||
cy.get('[data-cy="select-option"]').contains('Yes').should('be.visible').click(); | ||
cy.contains('button', 'Create category').click(); | ||
|
||
// Open and verify drawer | ||
cy.contains('tr', 'VIEW001').click(); | ||
cy.get('[data-cy="category-drawer"]').within(() => { | ||
cy.contains('VIEW001'); | ||
cy.contains('View Category'); | ||
cy.contains('Friendly View Category'); | ||
cy.contains('Expenses'); | ||
cy.contains('Yes'); // Host only | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters