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
66.4k stars 3.63k forks source link

[BUG] #27592

Closed lateek35 closed 1 year ago

lateek35 commented 1 year ago

System info

Config file

// playwright.config.ts
// @ts-check
import { defineConfig, devices } from "@playwright/test";
import dotenv from 'dotenv';
dotenv.config();

const APP_CLIENT = process.env.APP_CLIENT;

const config = require(`./configs/${APP_CLIENT}.ts`);

const userAgentStrings = [
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.2227.0 Safari/537.36",
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.3497.92 Safari/537.36",
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
];

/**
 * @see https://playwright.dev/docs/test-configuration
 */
module.exports = defineConfig({
  testDir: "./tests",
  /* Run tests in files in parallel */
  fullyParallel: true,
  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,
  timeout: 45 * 1000,
  /* Retry on CI only */
  retries: process.env.CI ? 2 : 0,
  /* Opt out of parallel tests on CI. */
  workers: process.env.CI ? 1 : 1,
  // timeout: 2 * 60 * 1000,
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: [
    ['html'],
    ['json', {  outputFile: 'playwright-report/test-results.json' }]
  ],
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  globalSetup: require.resolve("./global-setup"),
  use: {
    baseURL: config.BASE_URL,
    trace: 'on-first-retry',
  },

  /* Configure projects for major browsers */
  projects: [
    {
      name: "setup",
      use: {
        ...devices["Desktop Chrome"],
      },
      testMatch: /.*\.setup\.ts/,
    },
    {
      name: "chromium",
      use: {
        ...devices["Desktop Chrome"],
        userAgent: userAgentStrings[Math.floor(Math.random() * userAgentStrings.length)],
        storageState: {
          "cookies": [],
          "origins": [
            {
              "origin": `${config.BASE_URL}`,
              "localStorage": [
                {
                  "name": "e2e",
                  "value": '{ "newsletter": "false" }'
                }
              ]
            },
          ]
        }
      },
      testIgnore: /.*\.logged\.spec\.ts/,
      testMatch: /.*\.spec\.ts/,
    },
  ],
});

Steps

Expected

I expect my test to start, and complete /or fail giving me revelant information.

Actual

My test immediately fails (it was working fine yesterday) and point to an import which absolutly correct with an error that mention a file that I didn't have control of :

Running 1 test using 1 worker
  1) [chromium] › resale/resale-x32.spec.ts:56:7 › I can add more than one item to sell cart 

    Error: ENOENT: no such file or directory, open '/var/folders/4l/025bhv0n53d2fnsjwj8077600000gn/T/playwright-transform-cache-501/49/Consent_4917612e01561eea77dd7b2a1d7550fb38e705ca.js'

      2 |
      3 | import { test, expect } from "../../fixtures/coverage/baseFixtures";
    > 4 | import { Consent } from "../../utilities/Consent"; // this path is correct, and had been working nicely since multiple months
        | ^
      5 | import URL from "../../libs/previewUrlTransform";
      6 | import { Locator, Page } from "@playwright/test";
      7 |

It seems to be caching issues, but not the of the way to get out of it.

EDIT: Just seen from your discord that 4 other people seem to had the same issue.

JimmFly commented 1 year ago

Hello, I have encountered the same issue. It was working yesterday but not today, with the same Playwright version being 1.38.1. However, I’ve resolved this issue by upgrading to version 1.39.0. I hope this can help you.

viraxslot commented 1 year ago

Same issue for me. Resolved with the update to 1.39.0 version.

Playwright Version: 1.38.1
Operating System: macOS Sonoma 14.0
Browser: Chromium
Other info: node 18.18

Error message:

  1) [chromium] › **.spec.ts:15:9 › ** suite @smoke › Common checks › should show **

    Error: ENOENT: no such file or directory, open '/var/folders/ng/khzg222s79l64r0g7grc21qr0000gq/T/playwright-transform-cache-503/41/drugReportlocators_41b3dc0f10faca63cfc4b6286786d6dfbd9644aa.js'

       at ../lib/page-objects/common-widgets/table.ts:2

      1 | import { Locator } from "@playwright/test";
    > 2 | import { REPORT_LOCATORS } from "../../../locators/components/pages/report/locators";
        | ^
dgozman commented 1 year ago

cc @sand4rt

sidharthv96 commented 11 months ago

I was having this issue in 1.39.0 also. Removing the /var/folders/<path>/playwright-transform-cache-501 folder fixed it for me.

Waiting for 1.40.0 for proper fix.

amanUrRahman commented 7 months ago

I was also experiencing a weird time with a similar error and removing the /var/folders/g3/53p2r2293bx02823n4_0v4s40000gq/T/playwright-transform-cache-503 fixed it for me.

Version working on: "1.38.1"