microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
67.11k stars 3.69k forks source link

[BUG]When using browser from beforeAll the recorded video is not attaching to the final HTML report even though videos is kept on in config file #33720

Open mitrananda opened 11 hours ago

mitrananda commented 11 hours ago

When using browser from beforeAll the recorded video is not attaching to the final HTML report even though videos is kept on in config file

Note: I see someone raising this issue and confirmed it as bug, what is the bug fix u r giving please let me know https://stackoverflow.com/questions/78170953/playwright-is-not-generating-videos-when-we-create-our-own-context

code:

import { test } from '@playwright/test'; import { GLOBAL_VARIABLES } from '../../Utility/ENVIRONMENT_VARIABLES.js'; import { login } from '../../Pages/UserCredentials.js';

test.describe(' App Tests', () => { let page, context;

// Before all tests, login once test.beforeAll(async ({ browser }) => { context = await browser.newContext(); page = await context.newPage();

await page.goto(GLOBAL_VARIABLES.baseURL); await page.waitForLoadState('networkidle'); await login(page, GLOBAL_VARIABLES.username, GLOBAL_VARIABLES.password);

});

// After all tests, close the page test.afterAll(async () => { await page.close(); });

test ('creating app ', async ({ }, testInfo) => { test.setTimeout(100000) // Navigate to Apps await page.click('#userMenu'); //The user clicks on the "Create App" button to initiate the app creation process. await page.locator("//span[normalize-space()=' Apps']").click();

const generateRandomAppName = () => Questions_${Math.floor(Math.random() * 1000) + 1};

let appName = generateRandomAppName(); const appDescription = 'This is an exam for Java';

await page.getByTestId('createapp.button').click();

}); });