Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions

Jump to navigation Jump to search
m
Line 1,533: Line 1,533:


=== Screenshots and Videos ===
=== Screenshots and Videos ===
In Code
<nowiki>
await page.screenshot({ path: "screenshots/formsLayoutsPage.png" })
const buffer = await page.screenshot()
console.log(buffer.toString('base64'))
await page.locator("nb-card", {hasText: "Inline form" }).screenshot({ path: "screenshots/inlineForm.png" })</nowiki>
In file <code>playwright.config.ts</code>
<nowiki>
export default defineConfig({
  ...
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  use: {
    ...
    video: 'on',
    .. or ..
    video: {
      mode: "on",
      size: { width: 1920, height: 1080 },
    },
  },
  /* Configure projects for major browsers */
  projects: [
    {
      name: "chromium",
      use: {
        ...devices["Desktop Chrome"],
        viewport: { width: 1920, height: 1080 },
      },
    },
  ...</nowiki>
=== Environment Variables ===
=== Environment Variables ===
=== Configuration File ===
=== Configuration File ===

Navigation menu