diff --git a/.env b/.env index 4121e4e..323fc00 100644 --- a/.env +++ b/.env @@ -8,4 +8,4 @@ MAILER_DSN=smtp://localhost:1025 MAIL_FROM=aulasoftwarelibre@uco.es MAILER_SECRET=CHANGE_ME MAILER_URL=http://localhost:3000/api/mailer/ -WEBMAIL_URL=http://localhost:8025/ +WEBMAIL_URL=http://localhost:8025/monitor diff --git a/docker-compose.yaml b/docker-compose.yaml index 4ac7d38..aaa3dfa 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,10 @@ services: smtp: - build: https://github.com/mailhog/MailHog.git#master + image: inbucket/inbucket ports: - - 1025:1025 - - 8025:8025 + - 1025:2500 + - 8025:9000 + db: image: postgres:12 environment: diff --git a/e2e/global.setup.ts b/e2e/global.setup.ts index bfe4e88..343921f 100644 --- a/e2e/global.setup.ts +++ b/e2e/global.setup.ts @@ -22,7 +22,7 @@ setup('authenticate as user', async ({ page, request }) => { await page.close() // Purge WebMail - await request.delete('http://localhost:8025/api/v1/messages') + await request.delete('http://localhost:8025/api/v1/mailbox/noreply') }) setup('authenticate as admin', async ({ page, request }) => { @@ -42,5 +42,5 @@ setup('authenticate as admin', async ({ page, request }) => { await page.close() // Purge WebMail - await request.delete('http://localhost:8025/api/v1/messages') + await request.delete('http://localhost:8025/api/v1/mailbox/admin') }) diff --git a/e2e/login/logging.spec.ts b/e2e/login/logging.spec.ts index 94246c3..02974f0 100644 --- a/e2e/login/logging.spec.ts +++ b/e2e/login/logging.spec.ts @@ -34,13 +34,13 @@ test.describe('Do login with email', () => { await expect(page).toHaveURL('/verify') await expect(page.locator('body')).toHaveText(/Verifica tu correo/) - const response = await request.get('http://localhost:8025/api/v1/messages') + const response = await request.get( + 'http://localhost:8025/api/v1/mailbox/noreply', + ) expect(response.ok()).toBeTruthy() expect(await response.json()).toEqual( expect.arrayContaining([ - expect.objectContaining({ - Raw: expect.objectContaining({ To: [email] }), - }), + expect.objectContaining({ to: expect.arrayContaining([`<${email}>`]) }), ]), ) }) diff --git a/e2e/tests/pages/login.page.ts b/e2e/tests/pages/login.page.ts index 18ee5ac..e498ee6 100644 --- a/e2e/tests/pages/login.page.ts +++ b/e2e/tests/pages/login.page.ts @@ -17,15 +17,15 @@ class LoginPage { // Open WebMail await this.page.getByRole('button', { name: 'Abrir UCOWebMail' }).click() const webMailPage = await this.page.waitForEvent('popup') - await webMailPage.getByText('aulasoftwarelibre@uco.es').first().click() - - // Open login link await webMailPage - .frameLocator('#preview-html') - .getByRole('link', { name: 'VERIFICAR' }) + .getByRole('cell', { name: '' }) + .first() .click() - return await webMailPage.waitForEvent('popup') + // Open login link + await webMailPage.getByRole('link', { name: 'VERIFICAR' }).click() + + return webMailPage } } diff --git a/package.json b/package.json index 8e0ad83..eb5b9ab 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,9 @@ "test:ci": "NODE_ENV=test vitest --watch=false", "test:ui": "NODE_ENV=test vitest --ui --coverage.enabled=true", "pretest:e2e": "playwright install", - "test:e2e": "NODE_ENV=test playwright test", + "test:e2e": "rimraf playwright && NODE_ENV=test playwright test", "pretest:e2e:ui": "playwright install", - "test:e2e:ui": "NODE_ENV=test playwright test --ui", + "test:e2e:ui": "rimraf playwright && NODE_ENV=test playwright test --ui", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", "prisma:migrate": "prisma migrate dev",