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

Can not run tests against WASM head: Chrome does not start #60

Open
marcelwgn opened this issue Jun 5, 2021 · 7 comments
Open

Can not run tests against WASM head: Chrome does not start #60

marcelwgn opened this issue Jun 5, 2021 · 7 comments

Comments

@marcelwgn
Copy link
Contributor

I'm submitting a...

  • Bug report (I searched for similar issues and did not find one) -->

Current behavior

When creating a new App and adding the Uno.UITest projects, I would expect to be able to run a test against the WASM head. However Chrome never gets started. Updating the Uno.UITest.* dependencies to the latest pre-release does not fix this.

For some reason. cloning this repository and running tests agains the SampleApp work fine though, are the packages and the source code that different?

Expected behavior

Running against WASM should work.

Minimal reproduction of the problem with instructions

  1. Create a new project
  2. Add Uno.UITest project
  3. Deploy app
  4. Update Constants.cs
  5. Try to run tests against WASM -> Chrome does not start
  6. Update to 1.1.0-dev24 versions
  7. Try to run tests again -> Chrome does not start

Environment

Package Version(s): 

Uno.UITest.* : 1.1.0-dev11 or 1.1.0-dev24 (both failed)



Visual Studio
- [x] 2019 (version: 16.10.0)
- [ ] 2019 Preview (version: )
- [ ] for Mac (version: )
@jeromelaban
Copy link
Member

Thanks for the report. Does it not start, or does it start headless ? What's the error you're getting?

@marcelwgn
Copy link
Contributor Author

Chrome does not start at all (I wasn't able to see any chrome process in TaskManager). Unfortunately, I am not getting any errors, instead once I access the App object, I get a NullReferenceException.

@jeromelaban
Copy link
Member

Looks like it may be related to the path used to find chrome:

var chromePath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}\Google\Chrome\Application\chrome.exe";

Maybe your installation is now found somehow ?

@marcelwgn
Copy link
Contributor Author

The strange thing is that Chrome is actually in that folder (after manually copying):

Screenshot of Chrome being inside the Program Files x86 folder

@mrlacey
Copy link
Contributor

mrlacey commented Jun 16, 2021

The strange thing is that Chrome is actually in that folder (after manually copying):

Did you just copy the exe to that folder? Based on dependencies, I think that is unlikely to work.
Did you try changing the path in the code to point to where the exe was originally?
Can you run the app in chrome from within VS? (if so, what's the path to the exe it's using?)
Have you tried changing the AppInitializer.TestEnvironment.WebAssemblyHeadless option so it doesn't try and run headless?
What's the output from the test?
If you enable diagnostic debug output and run the test in debug, is there anything in the output to indicate a/the problem?

@marcelwgn
Copy link
Contributor Author

marcelwgn commented Jun 16, 2021

The strange thing is that Chrome is actually in that folder (after manually copying):

Did you just copy the exe to that folder? Based on dependencies, I think that is unlikely to work.

Copied the entire folder and running the Chrome.exe file works fine.

Did you try changing the path in the code to point to where the exe was originally?

Doesn't seem to make a difference.

Can you run the app in chrome from within VS? (if so, what's the path to the exe it's using?)
Have you tried changing the AppInitializer.TestEnvironment.WebAssemblyHeadless option so it doesn't try and run headless?
What's the output from the test?

There is none, the test just fails and the log doesn't show anything.

If you enable diagnostic debug output and run the test in debug, is there anything in the output to indicate a/the problem?

Still there is not much output here. Here is the dump: https://gist.github.com/chingucoding/29ea15b3cadbe0097c9485fb55bd0bef

@afust003
Copy link

I had a similar issue, doing the following 2 things solved my issue:

  1. adding the following inside static method TestBase() resulted in Chrome window launching in non-headless mode and I noticed my issues was that the URI "localhost://5001" needed to be set to "https://localhost:5001/"; it appears "regular chrome" redirects but the one launched by Uno does not :/
    AppInitializer.TestEnvironment.WebAssemblyHeadless = false;
    Note: Make sure you have launched your application via Ctrl+F5 as outlined here before you run your tests
    https://github.com/unoplatform/Uno.UITest
  2. setting the "correct" WebAssemblyDefaultUri solved my problem
    WebAssemblyDefaultUri = "https://localhost:5001/";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants