mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-05-14 01:26:37 +00:00
Added some cypress tests
This commit is contained in:
42
cypress-tests/cypress/e2e/02-create_tournament.cy.js
Normal file
42
cypress-tests/cypress/e2e/02-create_tournament.cy.js
Normal file
@@ -0,0 +1,42 @@
|
||||
describe('Create a tournament', () => {
|
||||
beforeEach(() => {
|
||||
// Use cy.session() with the login helper
|
||||
cy.session('authUser', () => {
|
||||
// cy.login() comes from cypress/support/commands.js
|
||||
cy.login();
|
||||
});
|
||||
});
|
||||
|
||||
it('Browses Tournaments and Creates a New Pool to bracket Tournament', () => {
|
||||
// Navigate to the Browse Tournaments page
|
||||
cy.visit('/');
|
||||
cy.contains('Browse Tournaments').click();
|
||||
|
||||
// Verify we're on the tournaments page
|
||||
cy.url().should('include', '/tournaments');
|
||||
cy.contains('Upcoming Tournaments');
|
||||
|
||||
// Click "New Tournament"
|
||||
cy.get('a[href="/tournaments/new"]').click();
|
||||
|
||||
// Verify we're on the "New Tournament" page
|
||||
cy.url().should('include', '/tournaments/new');
|
||||
|
||||
// Fill out the tournament creation form
|
||||
cy.get('input[name="tournament[name]"]').type('Cypress Test Tournament - Pool to bracket');
|
||||
cy.get('input[name="tournament[address]"]').type('123 Wrestling Way');
|
||||
cy.get('input[name="tournament[director]"]').type('John Doe');
|
||||
cy.get('input[name="tournament[director_email]"]').type('john.doe@example.com');
|
||||
cy.get('input[name="tournament[date]"]').type('2024-12-31');
|
||||
cy.get('select[name="tournament[tournament_type]"]').select('Pool to bracket');
|
||||
// cy.get('input[name="tournament[is_public]"]').check();
|
||||
|
||||
// Submit the form
|
||||
cy.contains('Submit').click();
|
||||
|
||||
// Verify successful creation (adjust based on app behavior)
|
||||
cy.url().should('include', '/tournaments');
|
||||
cy.contains('Cypress Test Tournament - Pool to bracket');
|
||||
cy.contains('Tournament was successfully created.')
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user