Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser mode showing blank page #5308

Closed
6 tasks done
guansss opened this issue Feb 28, 2024 · 6 comments
Closed
6 tasks done

Browser mode showing blank page #5308

guansss opened this issue Feb 28, 2024 · 6 comments

Comments

@guansss
Copy link

guansss commented Feb 28, 2024

Describe the bug

When using browser mode, the browser window pops up with a blank page regardless of the test status.

image

I guess it's because the iframe's src assignment was removed in this PR?

Reproduction

It's just a basic setup so I'm just pasting the files here:

{
  "name": "vitest-ui-bug",
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "test": "vitest"
  },
  "devDependencies": {
    "vitest": "^1.3.1"
  }
}
import { test, expect } from 'vitest';

test('foo', () => {
  expect(window.innerWidth).toBeGreaterThan(0);
});
npx vitest --browser=chrome

The test passed normally.

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400 @ 2.60GHz
    Memory: 3.48 GB / 15.80 GB
  Binaries:
    Node: 18.19.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\scoop\apps\yarn\current\bin\yarn.CMD
    npm: 10.2.5 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (121.0.2277.128)
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    vitest: ^1.3.1 => 1.3.1

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

Did you try passing down --ui flag?

@guansss
Copy link
Author

guansss commented Feb 29, 2024

I just tried and it opened the UI in my default browser (Edge), this might not be the expected behavior because in previous Vitest
versions the UI would be opened in the same browser that runs tests.

Previously I was using Vitest v1.0.1 and it worked fine without passing the --ui flag.

@luin
Copy link

luin commented Mar 15, 2024

Hope I will have time later to provide more information, but the current issue is that after upgrading from 1.1.3 to 1.3.1, sometimes the blank screen issue occurs. It seems there are no errors in the console, but the body is empty.

@jaens
Copy link

jaens commented Apr 18, 2024

I can reproduce this easily with the latest version, just run any browser test, with browser eg. "chrome".

The cause is the <iframe id="vitest-ui"> having height set to 100% and always pushing the results iframe off the screen.

Note that this (still) happens when the UI is disabled.

This probably also causes #5568.

image

@jaens
Copy link

jaens commented Apr 18, 2024

I am guessing this might be because 4f40177 changed the position where the test container is rendered, so it is always after the UI iframe (previously it was just rendered... wherever, I suppose).

cc @sheremet-va

@NavalSu
Copy link

NavalSu commented Apr 19, 2024

code
I looked into it, and does the final packaging relate to this 'index.html' file? Can it be adjusted?

@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants