Skip to content

Commit

Permalink
fix: adjust specs for the new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
malfynnction committed Jan 27, 2024
1 parent 6ff6280 commit 6baf6c4
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 65 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/accounts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Account: Creation', () => {
// prepare & select a budget
cy.wrap(createBudget({ name: 'Account Test' })).then(budget => {
cy.wrap(budget).as('budget')
cy.visit('/').get('h3').contains('Account Test').click()
cy.visit('/').get('li').contains('Open').click()
})
})

Expand All @@ -29,7 +29,7 @@ describe('Account: Creation', () => {
it('can create an external account for a budget', () => {
cy.contains('Accounts').click()
cy.contains('External Accounts').click()
cy.getByTitle('Create Account').click()
cy.getByTitle('Create Account').first().click()

cy.getInputFor('Name').type('Cash Test Account')
cy.contains('On Budget').should('not.exist')
Expand All @@ -52,7 +52,7 @@ describe('Account: Creation', () => {

cy.contains('Accounts').click()
cy.awaitLoading()
cy.contains('Old account').click()
cy.contains('Old account').closest('li').contains('Edit Account').click()
cy.awaitLoading()
cy.contains('Archive Account').click()
cy.contains('This Account is archived')
Expand Down
8 changes: 6 additions & 2 deletions cypress/e2e/budgets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ describe('Budget: Switch', () => {
cy.awaitLoading()

cy.contains('Switch Budget').click()
cy.get('h3').contains('First Budget').click()
cy.get('h3').contains('First Budget').closest('li').contains('Open').click()
cy.get('h1').contains('First Budget')

cy.contains('Switch Budget').click()
cy.get('h3').contains('Second Budget').click()
cy.get('h3')
.contains('Second Budget')
.closest('li')
.contains('Open')
.click()
cy.get('h1').contains('Second Budget')
})

Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/categories-envelopes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Envelope: Creation', () => {
beforeEach(() => {
// prepare & select a budget
cy.wrap(createBudget({ name: 'Category Test' })).then(() => {
cy.visit('/').get('h3').contains('Category Test').click()
cy.visit('/').get('li').contains('Open').click()
})
})

Expand All @@ -14,7 +14,7 @@ describe('Envelope: Creation', () => {
// Grocery Envelope (category Daily Spending)
cy.getByTitle('Create Envelope').first().click()
cy.getInputFor('Name').type('Grocery Envelope')
cy.getInputFor('Category').type('Daily Spending')
cy.getAutocompleteFor('Category').type('Daily Spending')
cy.contains('Create "Daily Spending"').click()
cy.getInputFor('Note').type(
'Groceries.{enter}{enter}Usually bought at a supermarket.'
Expand All @@ -24,14 +24,14 @@ describe('Envelope: Creation', () => {
// Restaurant Envelope (category Daily Spending)
cy.getByTitle('Create Envelope').first().click()
cy.getInputFor('Name').type('Restaurants')
cy.getInputFor('Category').type('Dail')
cy.getAutocompleteFor('Category').type('Dail')
cy.contains('Daily Spending').click()
cy.clickAndWait('Save')

// Rent Envelope (category Running Costs)
cy.getByTitle('Create Envelope').first().click()
cy.getInputFor('Name').type('Rent')
cy.getInputFor('Category').type('Running Costs')
cy.getAutocompleteFor('Category').type('Running Costs')
cy.contains('Create "Running Costs"').click()
cy.clickAndWait('Save')

Expand All @@ -50,15 +50,15 @@ describe('Envelope: Creation', () => {
// envelopes from other categories are still visible
cy.contains('Rent')

cy.getByTitle('Edit category').first().click()
cy.getByTitle('Edit Category').first().click()
cy.contains('Grocery Envelope')
cy.contains('Restaurants')
cy.contains('Rent').should('not.exist')

// edit the envelope again to create a new category
cy.clickAndWait('Cancel')
cy.contains('Restaurants').click()
cy.getInputFor('Category').clear().type('New Category')
cy.getAutocompleteFor('Category').clear().type('New Category')
cy.contains('Create "New Category"').click()
cy.clickAndWait('Save')
cy.contains('New Category')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Dashboard', () => {
).then(([firstEnvelope, secondEnvelope]: Envelope[]) => {
cy.wrap(firstEnvelope).as('firstEnvelope')
cy.wrap(secondEnvelope).as('secondEnvelope')
cy.visit('/').get('h3').contains('Dashboard Test').click()
cy.visit('/').get('li').contains('Open').click()
cy.awaitLoading()
cy.getCookie('budgetId').should('exist')
})
Expand Down
33 changes: 18 additions & 15 deletions cypress/e2e/transaction-import.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Transaction Import', () => {
).then(([ownAccount, otherOwnAccount, externalAccount]: Account[]) => {
cy.wrap(externalAccount).as('externalAccount')
// select budget
cy.visit('/').get('h3').contains('My Budget').click()
cy.visit('/').get('li').contains('Open').click()
})
})
})
Expand All @@ -30,7 +30,7 @@ describe('Transaction Import', () => {
cy.getByTitle('Import Transactions').click()
cy.awaitLoading()

cy.getInputFor('Account').type('account')
cy.getAutocompleteFor('Account').type('account')
cy.contains('External Account').should('not.exist')
cy.contains('My Other Account')
cy.contains('My Account').click()
Expand All @@ -45,15 +45,18 @@ describe('Transaction Import', () => {
// first transaction - checked prefilled values
cy.getInputFor('Note').should('have.value', 'Text').clear().type('MY NOTE')
cy.getInputFor('Amount').should('have.value', '84.76')
cy.getInputFor('Source')
cy.getAutocompleteFor('Source')
.should('have.value', 'My Account')
.should('be.disabled')
cy.getInputFor('Destination').should('have.value', 'Non Existing Account')
cy.getAutocompleteFor('Destination').should(
'have.value',
'Non Existing Account'
)
// only result in destination drop down is 'Create "Non Existing Account"'
cy.getInputFor('Destination').type('{downArrow}')
cy.getAutocompleteFor('Destination').type('{downArrow}')
cy.get('ul').find('li').should('have.length', 1)
cy.get('li').contains('Create "Non Existing Account"')
cy.getInputFor('Destination').clear().type('EDITED ACCOUNT{enter}')
cy.getAutocompleteFor('Destination').clear().type('EDITED ACCOUNT{enter}')
cy.getInputFor('Date').should('have.value', '2023-06-20')
cy.contains('Available From').should('not.exist')

Expand All @@ -63,12 +66,12 @@ describe('Transaction Import', () => {
'have.value',
'Transfer from my other account'
)
cy.getInputFor('Destination')
cy.getAutocompleteFor('Destination')
.should('have.value', 'My Account')
.should('be.disabled')
cy.getByTitle('Previous Transaction').click()
cy.getInputFor('Note').should('have.value', 'MY NOTE')
cy.getInputFor('Destination').should('have.value', 'EDITED ACCOUNT')
cy.getAutocompleteFor('Destination').should('have.value', 'EDITED ACCOUNT')

// import this transaction
cy.get('button').contains('Import').click()
Expand Down Expand Up @@ -96,18 +99,18 @@ describe('Transaction Import', () => {
// second transaction
cy.contains('2 of 5')
cy.getByTitle('Previous Transaction').should('be.disabled')
cy.getInputFor('Source').should('have.value', 'My Other Account')
cy.getAutocompleteFor('Source').should('have.value', 'My Other Account')
// dropdown results in source should be "My Other Account" & 'Create "My Other Account"'
cy.getInputFor('Source').type('{downArrow}')
cy.getAutocompleteFor('Source').type('{downArrow}')
cy.get('ul').find('li').should('have.length', 2)
cy.get('li').contains(/^My Other Account$/) // match "My Other Account" exactly
cy.get('li').contains('Create "My Other Account"')
// newly created account is available for selection
cy.getInputFor('Source').clear().type('EDITE')
cy.getAutocompleteFor('Source').clear().type('EDITE')
cy.contains('EDITED ACCOUNT')
cy.contains('Available From').should('not.exist')

cy.getInputFor('Destination')
cy.getAutocompleteFor('Destination')
.should('have.value', 'My Account')
.should('be.disabled')

Expand Down Expand Up @@ -176,7 +179,7 @@ describe('Transaction Import', () => {
cy.getByTitle('Import Transactions').click()
cy.awaitLoading()

cy.getInputFor('Account').type('My account{enter}')
cy.getAutocompleteFor('Account').type('My account{enter}')
cy.getInputFor('File').selectFile('cypress/fixtures/comdirect.csv')

cy.clickAndWait('Submit')
Expand All @@ -188,7 +191,7 @@ describe('Transaction Import', () => {
cy.getByTitle('Import Transactions').click()
cy.awaitLoading()

cy.getInputFor('Account').type('account')
cy.getAutocompleteFor('Account').type('account')
cy.contains('External Account').should('not.exist')
cy.contains('My Other Account')
cy.contains('My Account').click()
Expand All @@ -206,7 +209,7 @@ describe('Transaction Import', () => {
cy.getByTitle('Import Transactions').click()
cy.awaitLoading()

cy.getInputFor('Account').type('account')
cy.getAutocompleteFor('Account').type('account')
cy.contains('External Account').should('not.exist')
cy.contains('My Other Account')
cy.contains('My Account').click()
Expand Down
Loading

0 comments on commit 6baf6c4

Please sign in to comment.