diff --git a/playwright.config.ts b/playwright.config.ts index 9369894a..0ed473bb 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -31,9 +31,14 @@ export default defineConfig({ dependencies: ['setup db'] }, { - name: 'user test', - testMatch: /(.+\.)?(test|spec)\.[jt]s/, - dependencies: ['setup db', 'login'] + name: 'company data', + testMatch: /companyData\.test\.ts/, + dependencies: ['login'] + }, + { + name: 'availability', + testMatch: /setAvailability\.test\.ts/, + dependencies: ['company data'] } ] }); diff --git a/tests/companyData.test.ts b/tests/companyData.test.ts index e8113167..d2cb11ce 100644 --- a/tests/companyData.test.ts +++ b/tests/companyData.test.ts @@ -1,6 +1,8 @@ import { expect, test } from '@playwright/test'; import { login, ENTREPENEUR } from './utils'; +test.describe.configure({ mode: 'serial' }); + test('Set company data, incomplete 1', async ({ page }) => { await login(page, ENTREPENEUR); await expect(page.getByRole('heading', { name: 'Stammdaten Ihres Unternehmens' })).toBeVisible(); @@ -57,7 +59,7 @@ test('Set company data, complete and consistent', async ({ page }) => { await page.getByLabel('Name').fill('Taxi Weißwasser'); await page .getByLabel('Unternehmenssitz') - .fill('Werner-Seelenbinder-Straße 70A, 02943 Weißwasser/Oberlausitz'); + .fill('Werner-Seelenbinder-Strasse 70A, 02943 Weißwasser/Oberlausitz'); await page.waitForTimeout(250); await page.getByLabel('Pflichtfahrgebiet').selectOption({ label: 'Weißwasser' }); await page.getByLabel('Gemeinde').selectOption({ label: 'Weißwasser/O.L.' }); @@ -68,7 +70,7 @@ test('Set company data, complete and consistent', async ({ page }) => { const checkData = async () => { await expect(page.getByLabel('Name')).toHaveValue('Taxi Weißwasser'); await expect(page.getByLabel('Unternehmenssitz')).toHaveValue( - 'Werner-Seelenbinder-Straße 70A, 02943 Weißwasser/Oberlausitz' + 'Werner-Seelenbinder-Strasse 70A, 02943 Weißwasser/Oberlausitz' ); await expect(page.getByLabel('Pflichtfahrgebiet')).toHaveValue('2' /* Görlitz */); await expect(page.getByLabel('Gemeinde')).toHaveValue('85' /* Weißwasser */); diff --git a/tests/db.setup.ts b/tests/db.setup.ts index 45aa71ed..12911174 100644 --- a/tests/db.setup.ts +++ b/tests/db.setup.ts @@ -30,18 +30,16 @@ setup('setup db', async () => { await migrator.migrateToLatest(); - await Promise.all([ - db.deleteFrom('zone').execute(), - db.deleteFrom('company').execute(), - db.deleteFrom('vehicle').execute(), - db.deleteFrom('tour').execute(), - db.deleteFrom('availability').execute(), - db.deleteFrom('auth_user').execute(), - db.deleteFrom('user_session').execute(), - db.deleteFrom('event').execute(), - db.deleteFrom('address').execute(), - db.deleteFrom('request').execute() - ]); + await db.deleteFrom('user_session').executeTakeFirstOrThrow(); + await db.deleteFrom('auth_user').executeTakeFirstOrThrow(); + await db.deleteFrom('availability').executeTakeFirstOrThrow(); + await db.deleteFrom('event').executeTakeFirstOrThrow(); + await db.deleteFrom('request').executeTakeFirstOrThrow(); + await db.deleteFrom('tour').executeTakeFirstOrThrow(); + await db.deleteFrom('vehicle').executeTakeFirstOrThrow(); + await db.deleteFrom('company').executeTakeFirstOrThrow(); + await db.deleteFrom('address').executeTakeFirstOrThrow(); + await db.deleteFrom('zone').executeTakeFirstOrThrow(); const zonesSqlPath = path.join(__dirname, '../test_data/default/zone.sql'); const zonesQuery = fs.readFileSync(zonesSqlPath).toString();