brackt/cypress/e2e/league-settings.cy.ts

78 lines
2.6 KiB
TypeScript
Raw Normal View History

describe('League Settings', () => {
beforeEach(() => {
// Note: You'll need to implement proper authentication for real tests
// cy.login(Cypress.env('TEST_USER_EMAIL'), Cypress.env('TEST_USER_PASSWORD'));
});
// Note: These tests require authentication and a test league to exist
it.skip('should display league settings page', () => {
cy.visit('/leagues/test-league-id/settings');
cy.get('input[name="name"]').should('exist');
cy.get('select[name="teamCount"]').should('exist');
cy.get('select[name="draftSpeed"]').should('exist');
cy.get('input[name="isPublicDraftBoard"]').should('exist');
});
it.skip('should update league name', () => {
cy.visit('/leagues/test-league-id/settings');
cy.get('input[name="name"]').clear().type('Updated League Name');
cy.get('button[type="submit"]').contains(/save/i).click();
// Verify success
cy.findByDisplayValue('Updated League Name').should('exist');
});
it.skip('should toggle public draft board', () => {
cy.visit('/leagues/test-league-id/settings');
// Check the public draft board checkbox
cy.get('input[name="isPublicDraftBoard"]').check();
cy.get('button[type="submit"]').contains(/save/i).click();
// Verify it's checked after save
cy.get('input[name="isPublicDraftBoard"]').should('be.checked');
// Uncheck it
cy.get('input[name="isPublicDraftBoard"]').uncheck();
cy.get('button[type="submit"]').contains(/save/i).click();
// Verify it's unchecked
cy.get('input[name="isPublicDraftBoard"]').should('not.be.checked');
});
it.skip('should change draft speed', () => {
cy.visit('/leagues/test-league-id/settings');
cy.get('select[name="draftSpeed"]').select('fast');
cy.get('button[type="submit"]').contains(/save/i).click();
// Verify selection persists
cy.get('select[name="draftSpeed"]').should('have.value', 'fast');
});
it.skip('should update team count', () => {
cy.visit('/leagues/test-league-id/settings');
cy.get('select[name="teamCount"]').select('10');
cy.get('button[type="submit"]').contains(/save/i).click();
// Verify selection persists
cy.get('select[name="teamCount"]').should('have.value', '10');
});
it.skip('should delete league with confirmation', () => {
cy.visit('/leagues/test-league-id/settings');
// Click delete button
cy.findByRole('button', { name: /delete league/i }).click();
// Confirm deletion in dialog
cy.findByRole('button', { name: /confirm/i }).click();
// Should redirect to home
cy.url().should('eq', Cypress.config().baseUrl + '/');
});
});