From 423485e0a4122b7e407e7e7e00adf81dc1cee6d0 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Sat, 26 Sep 2020 14:16:22 -0700 Subject: [PATCH] chore: split playwright.fixtures into files (5) (#3986) --- test/playwright.fixtures.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test/playwright.fixtures.ts b/test/playwright.fixtures.ts index a927915973..5e7fc7e46b 100644 --- a/test/playwright.fixtures.ts +++ b/test/playwright.fixtures.ts @@ -108,18 +108,13 @@ defineWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, test await browser.close(); }); -defineTestFixture('testOutputDir', async ({ testInfo }, runTest) => { - const relativePath = path.relative(config.testDir, testInfo.file).replace(/\.spec\.[jt]s/, ''); +defineTestFixture('testOutputDir', async ({ testInfo, browserName }, runTest) => { + const relativePath = path.relative(config.testDir, testInfo.file) + .replace(/\.spec\.[jt]s/, '') + .replace(/\.test\.[jt]s/, ''); const sanitizedTitle = testInfo.title.replace(/[^\w\d]+/g, '_'); - const testOutputDir = path.join(config.outputDir, relativePath, sanitizedTitle); - await fs.promises.mkdir(testOutputDir, { recursive: true }); + const testOutputDir = path.join(config.outputDir, relativePath, sanitizedTitle, browserName); await runTest(testOutputDir); - const files = await fs.promises.readdir(testOutputDir); - if (!files.length) { - // Do not leave an empty useless directory. - // This might throw. See https://github.com/GoogleChrome/puppeteer/issues/2778 - await removeFolderAsync(testOutputDir).catch(e => {}); - } }); defineTestFixture('context', async ({ browser, testOutputDir }, runTest) => {