test: fix broken GlobalInfo.attach Windows test (#13441)

This commit is contained in:
Ross Wollman 2022-04-08 17:48:01 -07:00 committed by GitHub
parent f6ccd4847e
commit cdb68448e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,14 +239,13 @@ test(`testInfo.attach should save attachments via inline attachment`, async ({ r
}); });
test(`GlobalInfo.attach works`, async ({ runInlineTest }, testInfo) => { test(`GlobalInfo.attach works`, async ({ runInlineTest }, testInfo) => {
const external = testInfo.outputPath('external.txt');
const result = await runInlineTest({ const result = await runInlineTest({
'globalSetup.ts': ` 'globalSetup.ts': `
import fs from 'fs'; import fs from 'fs';
import { FullConfig, GlobalInfo } from '@playwright/test'; import { FullConfig, GlobalInfo } from '@playwright/test';
async function globalSetup(config: FullConfig, globalInfo: GlobalInfo) { async function globalSetup(config: FullConfig, globalInfo: GlobalInfo) {
const external = '${external}'; const external = 'external.txt';
await fs.promises.writeFile(external, 'external'); await fs.promises.writeFile(external, 'external');
await globalInfo.attach('inline.txt', { body: Buffer.from('inline'), contentType: 'text/plain' }); await globalInfo.attach('inline.txt', { body: Buffer.from('inline'), contentType: 'text/plain' });
await globalInfo.attach('external.txt', { path: external, contentType: 'text/plain' }); await globalInfo.attach('external.txt', { path: external, contentType: 'text/plain' });