-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #354 from DnD-Montreal/314-bulk-entry-cypress-tests
Create Cypress Tests for Bulk Entry Creation
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
cypress/integration/Game Session Tracking/bulk_entry_creation.js
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,49 @@ | ||
describe('Bulk Entry Creation Management Test Suite', () => { | ||
before(() => { | ||
cy.refreshDatabase() | ||
cy.seed('FastSeeder') | ||
}) | ||
|
||
it('Create Bulk Entries', () => { | ||
cy.seederLogin() | ||
cy.intercept('GET', Cypress.Laravel.route('character.index')).as('character') | ||
cy.visit(Cypress.Laravel.route('character.index')) | ||
cy.wait('@character') | ||
cy.get( | ||
`a[href^="${Cypress.config('baseUrl')}/${Cypress.Laravel.route( | ||
'character.index', | ||
)}/"]`, | ||
) | ||
.eq(1) | ||
.invoke('attr', 'href') | ||
.then((href) => { | ||
cy.intercept('GET', href).as('character_detail') | ||
cy.visit(href) | ||
cy.wait('@character_detail') | ||
}) | ||
|
||
cy.intercept('GET', '**/entry-bulk/*').as('bulk_entry_form') | ||
cy.intercept('POST', '**/entry-bulk').as('bulk_entry_create') | ||
|
||
cy.contains('button', 'Bulk Entry').click() | ||
cy.wait('@bulk_entry_form') | ||
|
||
cy.get('#adventures').click() | ||
cy.get('li[role=option]').eq(0).click() | ||
cy.contains('button', 'Create') | ||
.click() | ||
.then(() => { | ||
cy.contains('The end date must be a date after start date.') | ||
}) | ||
cy.get('#start_date').click() | ||
cy.get('svg[data-testid="PenIcon"]').click() | ||
cy.get('input[placeholder="yyyy-mm-dd hh:mm"]').clear().type('2022-02-01 17:00') | ||
cy.contains('button', 'OK').click() | ||
cy.get('#end_date').click() | ||
cy.get('svg[data-testid="PenIcon"]').click() | ||
cy.get('input[placeholder="yyyy-mm-dd hh:mm"]').clear().type('2022-03-01 17:00') | ||
cy.contains('button', 'OK').click() | ||
cy.contains('button', 'Create').click() | ||
cy.wait('@bulk_entry_create').its('response.statusCode').should('eq', 302) | ||
}) | ||
}) |