Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I ignore HTTPS errors for devices in playwright?

I am writing playwright tests and testing them on my local machine, which has SSL but the cert is often giving errors.

I want to ignore all HTTPS-related errors when developing on my local machine. (I will do final testing in the cloud with a valid cert.)

For browsers, you can add ignoreHTTPSErrors to contextOptions like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

const config: PlaywrightTestConfig = {
  projects: [
    {
      name: 'Safari MacBook Air',
      use: {
        browserName: 'webkit',
        viewport: {
          width: 2560,
          height: 1620,
        },
        contextOptions: {
          ignoreHTTPSErrors: true,
        },
      },
    },

However, I can’t find a similar option for devices:

{
  name: 'iPhone 6/7/8',
  use: devices['iPhone 8'],
},

How can I ignore HTTPS errors with a device?

>Solution :

Haven’t actually tried, but as I see it, can’t you use it as well in your mobile project?

For example, in your config:

    /* Test against mobile viewports. */
    {
      name: 'Mobile Chrome',
      use: {
        ...devices['Pixel 5'],
        contextOptions: {
          ignoreHTTPSErrors: true
        },
      },
    },
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading