antfu-collective / vitesse-webext

⚡️ WebExtension Vite Starter Template
MIT License
2.92k stars 225 forks source link

e2e basic tests fails #159

Closed Norfeldt closed 11 months ago

Norfeldt commented 11 months ago

Describe the bug

Changed nothing. Only did a degit of the repo and pnpm i and npx playwright install

❯ pnpm i
Lockfile is up to date, resolution step is skipped
Packages: +950
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 950, reused 949, downloaded 0, added 950, done

devDependencies:
+ @antfu/eslint-config 0.36.0
+ @ffflorian/jszip-cli 3.4.1
+ @iconify/json 2.2.61
+ @playwright/test 1.33.0
+ @types/fs-extra 11.0.1
+ @types/node 18.16.5
+ @types/webextension-polyfill 0.10.0
+ @typescript-eslint/eslint-plugin 5.59.2
+ @unocss/reset 0.51.12
+ @vitejs/plugin-vue 4.2.1
+ @vue/compiler-sfc 3.2.47
+ @vue/test-utils 2.3.2
+ @vueuse/core 10.1.2
+ chokidar 3.5.3
+ cross-env 7.0.3
+ crx 5.0.1
+ eslint 8.40.0
+ esno 0.16.3
+ fs-extra 11.1.1
+ jsdom 21.1.2
+ kolorist 1.8.0
+ lint-staged 13.2.2
+ npm-run-all 4.1.5
+ rimraf 4.4.1
+ simple-git-hooks 2.8.1
+ typescript 4.9.5
+ unocss 0.51.12
+ unplugin-auto-import 0.15.3
+ unplugin-icons 0.16.1
+ unplugin-vue-components 0.24.1
+ vite 4.3.5
+ vitest 0.31.0
+ vue 3.2.47
+ vue-demi 0.14.0
+ web-ext 7.6.2
+ webext-bridge 6.0.1
+ webextension-polyfill 0.10.0

> vitesse-webext@0.0.1 postinstall /Users/norfeldt/Desktop/github-reactions-extension
> simple-git-hooks

[INFO] Successfully set the pre-commit with command: pnpm lint-staged
[INFO] Successfully set all git hooks

Done in 10.3s
❯ npx playwright install
npm WARN cli npm v10.2.5 does not support Node.js v18.16.0. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.
Removing unused browser at /Users/norfeldt/Library/Caches/ms-playwright/chromium-1084
Removing unused browser at /Users/norfeldt/Library/Caches/ms-playwright/ffmpeg-1009
Removing unused browser at /Users/norfeldt/Library/Caches/ms-playwright/firefox-1425
Removing unused browser at /Users/norfeldt/Library/Caches/ms-playwright/webkit-1921
Downloading Chromium 113.0.5672.53 (playwright build v1060) from https://playwright.azureedge.net/builds/chromium/1060/chromium-mac.zip
128.8 Mb [====================] 100% 0.0s
Chromium 113.0.5672.53 (playwright build v1060) downloaded to /Users/norfeldt/Library/Caches/ms-playwright/chromium-1060
Downloading FFMPEG playwright build v1008 from https://playwright.azureedge.net/builds/ffmpeg/1008/ffmpeg-mac.zip
1.1 Mb [====================] 100% 0.0s
FFMPEG playwright build v1008 downloaded to /Users/norfeldt/Library/Caches/ms-playwright/ffmpeg-1008
Downloading Firefox 112.0 (playwright build v1403) from https://playwright.azureedge.net/builds/firefox/1403/firefox-mac-11.zip
76 Mb [====================] 100% 0.0s
Firefox 112.0 (playwright build v1403) downloaded to /Users/norfeldt/Library/Caches/ms-playwright/firefox-1403
Downloading Webkit 16.4 (playwright build v1837) from https://playwright.azureedge.net/builds/webkit/1837/webkit-mac-12.zip
62.5 Mb [====================] 100% 0.0s
Webkit 16.4 (playwright build v1837) downloaded to /Users/norfeldt/Library/Caches/ms-playwright/webkit-1837
❯ pnpm test:e2e

> vitesse-webext@0.0.1 test:e2e /Users/norfeldt/Desktop/github-reactions-extension
> playwright test

Running 3 tests using 1 worker

  ✘  1 basic.spec.ts:3:5 › example test (3.1s)
  ✘  2 basic.spec.ts:3:5 › example test (retry #1) (2.8s)
  ✘  3 basic.spec.ts:3:5 › example test (retry #2) (2.8s)
  ✓  4 basic.spec.ts:12:5 › popup page (3.2s)
  ✓  5 basic.spec.ts:17:5 › options page (3.1s)

  1) basic.spec.ts:3:5 › example test ──────────────────────────────────────────────────────────────

    Error: page.goto: net::ERR_NAME_NOT_RESOLVED at https://example.com/
    =========================== logs ===========================
    navigating to "https://example.com/", waiting until "load"
    ============================================================

      4 |   testInfo.skip(!isDevArtifact(), 'contentScript is in closed ShadowRoot mode')
      5 |
    > 6 |   await page.goto('https://example.com')
        |              ^
      7 |
      8 |   await page.locator(`#${name} button`).click()
      9 |   await expect(page.locator(`#${name} h1`)).toHaveText('Vitesse WebExt')

        at /Users/norfeldt/Desktop/github-reactions-extension/e2e/basic.spec.ts:6:14

    Retry #1 ───────────────────────────────────────────────────────────────────────────────────────

    Error: page.goto: net::ERR_NAME_NOT_RESOLVED at https://example.com/
    =========================== logs ===========================
    navigating to "https://example.com/", waiting until "load"
    ============================================================

      4 |   testInfo.skip(!isDevArtifact(), 'contentScript is in closed ShadowRoot mode')
      5 |
    > 6 |   await page.goto('https://example.com')
        |              ^
      7 |
      8 |   await page.locator(`#${name} button`).click()
      9 |   await expect(page.locator(`#${name} h1`)).toHaveText('Vitesse WebExt')

        at /Users/norfeldt/Desktop/github-reactions-extension/e2e/basic.spec.ts:6:14

    Retry #2 ───────────────────────────────────────────────────────────────────────────────────────

    Error: page.goto: net::ERR_NAME_NOT_RESOLVED at https://example.com/
    =========================== logs ===========================
    navigating to "https://example.com/", waiting until "load"
    ============================================================

      4 |   testInfo.skip(!isDevArtifact(), 'contentScript is in closed ShadowRoot mode')
      5 |
    > 6 |   await page.goto('https://example.com')
        |              ^
      7 |
      8 |   await page.locator(`#${name} button`).click()
      9 |   await expect(page.locator(`#${name} h1`)).toHaveText('Vitesse WebExt')

        at /Users/norfeldt/Desktop/github-reactions-extension/e2e/basic.spec.ts:6:14

  1 failed
    basic.spec.ts:3:5 › example test ───────────────────────────────────────────────────────────────
  2 passed (17.1s)
 ELIFECYCLE  Command failed with exit code 1.

Reproduction

https://github.com/Norfeldt/demo-bug-vitesse-webext

System Info

❯ npx envinfo --system --binaries --browsers
npm WARN cli npm v10.2.5 does not support Node.js v18.16.0. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.
Need to install the following packages:
envinfo@7.11.0
Ok to proceed? (y) y

  System:
    OS: macOS 14.2.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 261.89 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/.volta/tools/image/node/18.16.0/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 10.2.5 - ~/.volta/tools/image/npm/10.2.5/bin/npm
    pnpm: 8.3.1 - ~/.volta/tools/image/node/18.16.0/bin/pnpm
    bun: 1.0.1 - /usr/local/bin/bun
    Watchman: 2023.08.28.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 120.0.6099.129
    Edge: 120.0.2210.91
    Safari: 17.2.1

Used Package Manager

pnpm

Validations

tmkx commented 11 months ago
Error: page.goto: net::ERR_NAME_NOT_RESOLVED at https://example.com/

seems like a network error, try replacing https://example.com/ with https://www.google.com/ or any webpage that you can visit?

Norfeldt commented 10 months ago

@tmkx you were absolutely right. Sorry for that

Screenshot 2024-01-09 at 20 11 20