From b3a8ccd064f89a0b01d885e180dd8a80db8aea6b Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Fri, 8 Oct 2021 09:20:41 +0200 Subject: [PATCH] test(test-runner): add test for relative outputDir (#9381) --- tests/playwright-test/test-output-dir.spec.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/playwright-test/test-output-dir.spec.ts b/tests/playwright-test/test-output-dir.spec.ts index a66940df4f..ccb8555b33 100644 --- a/tests/playwright-test/test-output-dir.spec.ts +++ b/tests/playwright-test/test-output-dir.spec.ts @@ -395,6 +395,27 @@ test('should accept a relative path for outputDir', async ({ runInlineTest }, te expect(result.exitCode).toBe(0); }); +test('should have output dir based on rootDir (cwd)', async ({ runInlineTest }, testInfo) => { + test.fixme(true, 'https://github.com/microsoft/playwright/issues/9380'); + const result = await runInlineTest({ + 'playwright.config.js': ` + const path = require('path'); + module.exports = { + testDir: path.join(__dirname, 'e2e'), + outputDir: 'test-results/', + };`, + 'e2e/example.spec.js': ` + const { test } = pwt; + const fs = require('fs'); + test('hello world', async ({ }, testInfo) => { + fs.writeFileSync(testInfo.outputPath('foo.txt'), 'hello'); + }); + `, + }, {}, {}, { usesCustomOutputDir: true }); + expect(result.exitCode).toBe(0); + expect(fs.existsSync(testInfo.outputPath('test-results', 'example-hello-world', 'hello'))); +}); + test('should allow nonAscii characters in the output dir', async ({ runInlineTest }, testInfo) => { const result = await runInlineTest({