From f3ac04ea8a2c3ae144c9eb6230b721b2eb8bb62b Mon Sep 17 00:00:00 2001 From: Hansanto Date: Tue, 26 Mar 2024 11:36:52 +0100 Subject: [PATCH] test: Prepare intervals tests --- tests/playwright-test/expect-to-pass.spec.ts | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/playwright-test/expect-to-pass.spec.ts b/tests/playwright-test/expect-to-pass.spec.ts index 2ad00e0ce7..a0b6c01136 100644 --- a/tests/playwright-test/expect-to-pass.spec.ts +++ b/tests/playwright-test/expect-to-pass.spec.ts @@ -260,3 +260,35 @@ test('should give priority to timeout parameter over timeout in config file', as 4 | await test.expect(() => { `.trim()); }); + +test('should respect intervals in config file when intervals parameter is not passed', async ({ runInlineTest }) => { + const result = await runInlineTest({ + 'playwright.config.js': `module.exports = { expect: { toPass: { intervals: [100, 200] } } }`, + 'a.spec.ts': ` + import { test, expect } from '@playwright/test'; + test('should fail', async () => { + await test.expect(() => { + expect(1).toBe(2); + }).toPass(); + }); + ` + }); + expect(result.exitCode).toBe('TODO'); + // TODO +}); + +test('should give priority to intervals parameter over intervals in config file', async ({ runInlineTest }) => { + const result = await runInlineTest({ + 'playwright.config.js': `module.exports = { expect: { toPass: { intervals: [100, 200] } } }`, + 'a.spec.ts': ` + import { test, expect } from '@playwright/test'; + test('should fail', async () => { + await test.expect(() => { + expect(1).toBe(2); + }).toPass({ intervals: [500] }); + }); + ` + }); + expect(result.exitCode).toBe('TODO'); + // TODO +});