question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to increase page lookup timing

See original GitHub issue

Migrating from puppeteer to playwright I have noticed an increase in the time to load a simple page using page.goto. Take the example below…

// testing.test.ts
import { test, expect } from '@playwright/test';

test('Testing page.goto', async ({ page }) => {
  await page.goto('https://google.com');
  expect(true).toBe(true);
});
image

The html reporting shows it takes ~2s for the goto step to complete. Comparing this to puppeteer times on the order of 300ms.

To my understanding, a new page is created for each test and seems like a necessary tradeoff to enable parallelism. That said I am curious if this time is typical or if there is something I can configure or even a custom fixture, to increase this speed?

My full playwright config
// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const isCI = process.env.CI === 'true';

const config: PlaywrightTestConfig = {
  use: {
    headless: true,
    locale: 'en-us',
    viewport: { width: 785, height: 600 },
    trace: 'off',
    screenshot: 'off', // already testing screenshots
    video: 'retain-on-failure',
    launchOptions: {
      ignoreDefaultArgs: ['--hide-scrollbars'],
      args: ['--use-gl=egl'],
    },
  },
  reporter: [['html', { open: 'never', outputFolder: 'html_report' }], isCI ? ['line'] : ['list']],
  expect: {
    toMatchSnapshot: {
      threshold: 0,
      maxDiffPixels: 4,
    },
  },
  forbidOnly: isCI,
  timeout: 10 * 1000,
  preserveOutput: 'failures-only',
  snapshotDir: 'screenshots',
  testDir: 'tests',
  outputDir: 'test_failures',
  fullyParallel: true,
  projects: [
    {
      name: 'chrome',
      use: {
        browserName: 'chromium',
      },
    },
  ],
};

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
dgozmancommented, May 3, 2022

Good to know, I’ll take a look at using a single page between tests. So if this context creation is not for parallelism, I should be able to reuse a single page across tests even with fullyParallel enabled, correct?

Not really. If you mark your suite as serial, tests in that suite will run in order. There is no way to reuse the page between tests that literally run in parallel at the same time 😄 If you manually split your tests into files/suites, and only reuse the page inside each suite, you’ll have full control of what can run in parallel.

1reaction
dgozmancommented, May 9, 2022

Closing since there doesn’t seem to be any action item here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is DNS Lookup Time & How to Reduce It? - Sematext
The average DNS lookup time is between 20 and 120 milliseconds. Anything between that and under is generally considered very good. How to...
Read more >
8 Tips on How to Reduce DNS Lookups and Speed Them Up
But it can improve your DNS lookup times by choosing a TTL that coincides with how often changes are made on your site....
Read more >
Best Practices for Speeding Up Your Web Site
This is the most important guideline for improving performance for first time visitors. As described in Tenni Theurer's blog post Browser Cache ...
Read more >
Creating support cases and case management - AWS Support
Account and billing support cases are available to all AWS customers. You can get help with billing and account questions. Service limit increase...
Read more >
Schedule Appointment - Home Page
Available for purchase at our online store. Confidently and securely access your upcoming appointments, lab results, and more with a free MyQuest ®...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found