diff --git a/tests/cypress.config.ts b/tests/cypress.config.ts index 7a4b7d862..c37fac020 100644 --- a/tests/cypress.config.ts +++ b/tests/cypress.config.ts @@ -35,8 +35,6 @@ export default defineConfig({ // Project configuration projectId: 'o5451s', - - e2e: { // Setup node events async setupNodeEvents( diff --git a/tests/cypress/fixtures/wizard-config.json b/tests/cypress/fixtures/wizard-config.json deleted file mode 100644 index e4a7127df..000000000 --- a/tests/cypress/fixtures/wizard-config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "database": { - "type": "sqlite", - "connectionString": "Data Source=Ombi.db" - }, - "mediaServer": { - "type": "plex", - "host": "http://localhost:32400", - "token": "test-token" - }, - "user": { - "username": "admin", - "password": "admin123", - "claims": ["Admin"] - }, - "ombiConfig": { - "landingPage": "discover", - "autoApprove": false - } -} - - diff --git a/tests/cypress/support/e2e.ts b/tests/cypress/support/e2e.ts index 1a0474763..69b55842a 100644 --- a/tests/cypress/support/e2e.ts +++ b/tests/cypress/support/e2e.ts @@ -19,10 +19,7 @@ import './request.commands'; import './plex-settings.commands'; import './mock-data.commands'; import "cypress-real-events/support"; -import '@bahmutov/cy-api/support'; - -// Import our setup utilities -import './setup'; +import '@bahmutov/cypress-cucumber-preprocessor/support'; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/tests/cypress/support/setup.ts b/tests/cypress/support/setup.ts deleted file mode 100644 index 0affd1d50..000000000 --- a/tests/cypress/support/setup.ts +++ /dev/null @@ -1,84 +0,0 @@ -// Test setup and initialization utilities -import './commands'; - -// Global setup that runs before all tests -beforeEach(() => { - // Check if application is already set up - cy.checkApplicationSetup(); -}); - -// Check if the application is already configured -Cypress.Commands.add('checkApplicationSetup', () => { - cy.log('Checking application setup status...'); - - // Try to access the application to see if it's already configured - cy.request({ - method: 'GET', - url: '/api/v1/status', - failOnStatusCode: false, - timeout: 10000 - }).then((response) => { - if (response.status === 200) { - // Application is running and configured - cy.log('Application is already configured, skipping wizard'); - return; - } - - // Check if we're on the wizard page - cy.visit('/').then(() => { - cy.url().then((url) => { - if (url.includes('/wizard') || url.includes('/setup')) { - cy.log('Wizard detected, running setup...'); - cy.runWizardSetup(); - } else { - cy.log('Application appears to be configured'); - } - }); - }); - }); -}); - -// Run the wizard setup -Cypress.Commands.add('runWizardSetup', () => { - cy.log('Running wizard setup...'); - - // Import wizard page object - cy.fixture('wizard-config').then((config) => { - // Run through wizard steps - cy.get('[data-test="wizard-welcome-next"]').click(); - cy.get('[data-test="wizard-database-next"]').click(); - cy.get('[data-test="wizard-media-server-next"]').click(); - - // Create local user - cy.get('[data-test="wizard-username"]').type(Cypress.env('username')); - cy.get('[data-test="wizard-password"]').type(Cypress.env('password')); - cy.get('[data-test="wizard-user-next"]').click(); - - // Complete configuration - cy.get('[data-test="wizard-config-next"]').click(); - cy.get('[data-test="wizard-finish"]').click(); - - // Wait for setup to complete - cy.url().should('not.include', '/wizard'); - cy.log('Wizard setup completed successfully'); - }); -}); - -// Check if we need to run setup for this test run -Cypress.Commands.add('ensureApplicationSetup', () => { - // This command can be called explicitly in tests that need setup - cy.checkApplicationSetup(); -}); - -// Add to global commands interface -declare global { - namespace Cypress { - interface Chainable { - checkApplicationSetup(): Chainable; - runWizardSetup(): Chainable; - ensureApplicationSetup(): Chainable; - } - } -} - -