Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: add debugging output for downloads tests (#5673)
Andrey Lushnikov850e3c5aa307
diff --git a/test/downloads-path.spec.ts b/test/downloads-path.spec.tsindex 1d64c42a3d..700c9e8414 100644--- a/test/downloads-path.spec.ts+++ b/test/downloads-path.spec.ts@@ -45,15 +45,20 @@ fixtures.persistentDownloadsContext.init(async ({ server, launchPersistent, testres.setHeader('Content-Disposition', 'attachment; filename=file.txt');res.end(`Hello world`);});+ console.log('--- launching persistent context ---');const { context, page } = await launchPersistent({downloadsPath: testInfo.outputPath(''),acceptDownloads: true});+ console.log('--- setting content for the page ---');await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);+ console.log('--- launching test ---');await test(context);+ console.log('--- closing context ---');await context.close();+ console.log('--- DONE ---');});const { it, expect } = fixtures.build();@@ -99,25 +104,49 @@ it('should report downloads in downloadsPath folder', async ({downloadsBrowser,});it('should accept downloads in persistent context', async ({persistentDownloadsContext, testInfo, server}) => {+ console.log('----- 1.1');const page = persistentDownloadsContext.pages()[0];+ console.log('----- 1.2');const [ download ] = await Promise.all([- page.waitForEvent('download'),- page.click('a')+ page.waitForEvent('download').then(d => {+ console.log('----- 1.3');+ return d;+ }),+ page.click('a').then(d => {+ console.log('----- 1.4');+ }),]);+ console.log('----- 1.5');expect(download.url()).toBe(`${server.PREFIX}/download`);+ console.log('----- 1.6');expect(download.suggestedFilename()).toBe(`file.txt`);+ console.log('----- 1.7');const path = await download.path();+ console.log('----- 1.8');expect(path.startsWith(testInfo.outputPath(''))).toBeTruthy();+ console.log('----- 1.9');});it('should delete downloads when persistent context closes', async ({persistentDownloadsContext}) => {+ console.log('----- 2.1');const page = persistentDownloadsContext.pages()[0];+ console.log('----- 2.2');const [ download ] = await Promise.all([- page.waitForEvent('download'),- page.click('a')+ page.waitForEvent('download').then(d => {+ console.log('----- 2.3');+ return d;+ }),+ page.click('a').then(() => {+ console.log('----- 2.4');+ }),]);+ console.log('----- 2.5');const path = await download.path();+ console.log('----- 2.6');expect(fs.existsSync(path)).toBeTruthy();+ console.log('----- 2.7');await persistentDownloadsContext.close();+ console.log('----- 2.8');expect(fs.existsSync(path)).toBeFalsy();+ console.log('----- 2.9');});