From c15462d44cfd654b9b4351c3cedb1eb1f708f8d1 Mon Sep 17 00:00:00 2001 From: Ross Wollman Date: Tue, 3 May 2022 06:18:16 -0700 Subject: [PATCH] chore: remove defunct GlobalInfo.attach test (#13895) --- tests/playwright-test/reporter-raw.spec.ts | 52 ---------------------- 1 file changed, 52 deletions(-) diff --git a/tests/playwright-test/reporter-raw.spec.ts b/tests/playwright-test/reporter-raw.spec.ts index c38ec87866..427e59f497 100644 --- a/tests/playwright-test/reporter-raw.spec.ts +++ b/tests/playwright-test/reporter-raw.spec.ts @@ -238,58 +238,6 @@ test(`testInfo.attach should save attachments via inline attachment`, async ({ r } }); -test(`GlobalInfo.attach works`, async ({ runInlineTest }, testInfo) => { - const result = await runInlineTest({ - 'globalSetup.ts': ` - import fs from 'fs'; - import { FullConfig, GlobalInfo } from '@playwright/test'; - - async function globalSetup(config: FullConfig, globalInfo: GlobalInfo) { - const external = 'external.txt'; - await fs.promises.writeFile(external, 'external'); - await globalInfo.attach('inline.txt', { body: Buffer.from('inline'), contentType: 'text/plain' }); - await globalInfo.attach('external.txt', { path: external, contentType: 'text/plain' }); - // The attach call above should have saved it to a safe place - await fs.promises.unlink(external); - }; - - export default globalSetup; - `, - 'playwright.config.ts': ` - import path from 'path'; - const config = { - globalSetup: path.join(__dirname, './globalSetup'), - } - - export default config; - `, - 'example.spec.ts': ` - const { test } = pwt; - test('sample', async ({}) => { expect(2).toBe(2); }); - `, - }, { reporter: 'dot,' + kRawReporterPath, workers: 1 }, {}, { usesCustomOutputDir: true }); - - expect(result.exitCode).toBe(0); - const outputPath = testInfo.outputPath('test-results', 'report', 'project.report'); - const json = JSON.parse(fs.readFileSync(outputPath, 'utf-8')); - { - const attachment = json.attachments[0]; - expect(attachment.name).toBe('inline.txt'); - expect(attachment.contentType).toBe('text/plain'); - expect(attachment.path).toBeUndefined(); - expect(Buffer.from(attachment.body, 'base64').toString()).toEqual('inline'); - } - { - const attachment = json.attachments[1]; - expect(attachment.name).toBe('external.txt'); - expect(attachment.contentType).toBe('text/plain'); - const contents = fs.readFileSync(attachment.path); - expect(attachment.path.startsWith(path.join(testInfo.outputDir, 'attachments')), 'Attachment should be in our output directory.').toBeTruthy(); - expect(contents.toString()).toEqual('external'); - expect(attachment.body).toBeUndefined(); - } -}); - test('dupe project names', async ({ runInlineTest }, testInfo) => { await runInlineTest({ 'playwright.config.ts': `