Skip to content

Fix chrome/selenium tests #25330

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

Merged
merged 7 commits into from
Sep 11, 2020
Merged

Fix chrome/selenium tests #25330

merged 7 commits into from
Sep 11, 2020

Conversation

JunTaoLuo
Copy link
Contributor

Fixes #25322

@JunTaoLuo JunTaoLuo requested review from dougbu, SteveSandersonMS and a team as code owners August 27, 2020 22:11
@JunTaoLuo JunTaoLuo added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Aug 27, 2020
Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#yolo

@javiercn

@dougbu
Copy link
Contributor

dougbu commented Aug 27, 2020

🤞

@dougbu
Copy link
Contributor

dougbu commented Aug 27, 2020

Just noticed the base branch. This is test-only and, if possible, we should have the Selenium tests running for 5.0

@JunTaoLuo
Copy link
Contributor Author

I was planning on trying things out in master before back-porting the fixes to release/5.0.

<SeleniumWebDriverMicrosoftDriverPackageVersion>17.17134.0</SeleniumWebDriverMicrosoftDriverPackageVersion>
<SeleniumWebDriverChromeDriverPackageVersion>2.43.0</SeleniumWebDriverChromeDriverPackageVersion>
<SeleniumWebDriverPackageVersion>3.12.1</SeleniumWebDriverPackageVersion>
<SeleniumWebDriverChromeDriverPackageVersion>85.0.4183.8300</SeleniumWebDriverChromeDriverPackageVersion>
Copy link
Member

@captainsafia captainsafia Aug 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty big jump. Did something change with the way the package is versioned?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, they moved to use versions matching Chrome versions. There as a jump from v.2.46.0 to v.71.0.3578.137 a while back.

In addition, we were almost 2 years out-of-date in using v2.43.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. That makes sense.

How does this mesh with the fact that we don't control what version of Chrome is downloaded with the installer (AFAIK)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should mean we can be proactive. Whenever a dev notices their Chrome installation wants to be restarted, they can check whether it's a new major version and update this particular package version. Or, @sebastienros could add a reminder to check the Selenium versions in his ops rotation invites every few (10?) rotations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could, I am afraid I will forget ;) I would suggest to update the operations book, and let's say "if your rotation happens on the first Tuesday of the month then you should ..."

Mondays are frequently skipped due to holidays

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dougbu
Copy link
Contributor

dougbu commented Aug 27, 2020

I was planning on trying things out in master before back-porting the fixes to release/5.0.

Makes sense.

Looks like you have at least one breaking change to handle. But, it's not that bad considering how far out of date we were.

@Pilchie
Copy link
Member

Pilchie commented Aug 27, 2020

👀

@dougbu
Copy link
Contributor

dougbu commented Aug 28, 2020

@JunTaoLuo I suggest copying #25323 into the 'release/3.1' branch if possible (@Pilchie and @wtgodbe is that branch open for test-only changes at this point❔). Eventually we'll want this fix there too because it also uses Selenium and our InstallGoogleChrome.ps1 script. E.g. some of the errors in my attempted validation of #25217 mention cannot find Chrome binary.

@captainsafia other validation problems w/ #25217 require your #25324 fix i.e. everyone will need to include your commit in their 3.1 PRs or validations are just busted. Sooner it can go in (too), the better. But, again, only if branch is open.

Copy link
Member

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thanks for figuring this out, @JunTaoLuo!

@wtgodbe
Copy link
Member

wtgodbe commented Aug 28, 2020

(@wtgodbe is that branch open for test-only changes at this point❔)

3.1 isn't open for anything until we ship 3.1.8

@JunTaoLuo
Copy link
Contributor Author

Sounds like there's no rush to unblock 3.1 right now. I'll just continue with making fixes here and cherry-pick them to release/5.0 and 3.1 when it's done.

@JunTaoLuo
Copy link
Contributor Author

I've updated the APIs but I'll work with @ajaybhargavb's to test it on Monday.

@dougbu
Copy link
Contributor

dougbu commented Aug 30, 2020

@JunTaoLuo how far are we from having a commit we can cherry-pick into 3.1 PRs to see if they're ready to go❔

@BrennanConroy
Copy link
Member

This PR is failing the exact same way as before, unable to launch chrome and hanging.

@ajaybhargavb
Copy link
Contributor

This PR is failing the exact same way as before, unable to launch chrome and hanging.

Looks like it is still trying to use the old chrome driver (2.43.xxx) instead of the new 85.0.xxx. I wonder where it is picking that from. cc @JunTaoLuo

 OpenQA.Selenium.WebDriverException : unknown error: cannot find Chrome binary\n  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17763 x86_64)

@JunTaoLuo JunTaoLuo force-pushed the johluo/reenable-chrome-tests branch from b34bd79 to 150fd53 Compare September 1, 2020 21:54
@ajaybhargavb
Copy link
Contributor

ajaybhargavb commented Sep 1, 2020

@JunTaoLuo's latest commit fixed the Chrome not being found issue but it is now throwing a null-ref,

System.NullReferenceException : Object reference not set to an instance of an object.
   at OpenQA.Selenium.Remote.HttpCommandExecutor.HttpRequestInfo..ctor(Uri serverUri, Command commandToExecute, CommandInfo commandInfo)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteLogs.GetLog(String logKind)
   at OpenQA.Selenium.WebDriverExtensions.GetBrowserLogs(IWebDriver driver, LogLevel level) in /_/src/Shared/E2ETesting/WebDriverExtensions.cs:line 20
   at Microsoft.AspNetCore.E2ETesting.WaitAssert.WaitAssertCore[TResult](IWebDriver driver, Func`1 assertion, TimeSpan timeout) in /_/src/Shared/E2ETesting/WaitAssert.cs:line 120
   at Microsoft.AspNetCore.E2ETesting.WaitAssert.Exists(IWebDriver driver, By finder, TimeSpan timeout) in /_/src/Shared/E2ETesting/WaitAssert.cs:line 64
   at Microsoft.AspNetCore.E2ETesting.WaitAssert.Exists(IWebDriver driver, By finder) in /_/src/Shared/E2ETesting/WaitAssert.cs:line 51
   at Templates.Test.BlazorWasmTemplateTest.TestBasicNavigation(String appName, Boolean usesAuth, Boolean skipFetchData) in /_/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs:line 525
   at Templates.Test.BlazorWasmTemplateTest.BlazorWasmStandaloneTemplate_Works() in /_/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs:line 73

Also only a subset of the tests failed. @captainsafia @pranavkm could these be test specific issues?

@JunTaoLuo
Copy link
Contributor Author

Turns out that getting browser logs is broken: SeleniumHQ/selenium#7342. Seems like the issue is fixed in 4.0.0-alpha3 so I'll try that version and see what happens.

@JunTaoLuo
Copy link
Contributor Author

Okay this got even further but now I'm seeing actual test failures in blazor templates and component e2e tests.

@JunTaoLuo
Copy link
Contributor Author

JunTaoLuo commented Sep 2, 2020

Hey @javiercn, you've been recommended to take a look at the test failures. Can you investigate and see what's causing the test failures. Note that this is blocking us from turning the E2ETests on in 5.0-rc1

break;
default:
throw new InvalidOperationException($"Browser name {sauce.BrowserName} not recognized");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? We ended up not going this route @ajaybhargavb isn't that the case?

We only need chrome I believe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need Chrome for local and CI tests. But we use other browsers when running in SauceLabs. We need to pass in the correct options to SauceLabs in that case. DesiredCapabilities used to be enough but that is now obsoleted in the newer version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajaybhargavb but do we actually run in SauceLabs? I thought we discarded that idea. That's why I'm asking.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still want to. What we discarded was the idea to do real device testing on SauceLabs.

@JunTaoLuo
Copy link
Contributor Author

JunTaoLuo commented Sep 2, 2020

FYI, let's backport this fix to 5.0-rc2 only once we are done fixing it in master, turns out it's too late for RC1.

Actually I'll defer to @mkArtakMSFT in terms of assigning an investigator and which release this goes into.

Current status:

I'm seeing several Component.E2ETests and BlazorWasm template test failures with different Assert errors. It's unclear to me if these are caused by issues with the tests, issues with the product or something else.

For example BlazorWasmStandaloneTemplate_Works fails without any error messages in its console log whereas BlazorWasmHostedPwaTemplate_Works fails at the same TestBasicNavigation step but there are messages in the console log saying An unknown error occurred while processing the certificate. At this point I think someone familiar with what these browser based tests are trying to do should investigate since I can't find a common pattern in the failures that point to an issue with the infrastructure.

@dougbu
Copy link
Contributor

dougbu commented Sep 2, 2020

FYI, let's backport this fix to 5.0-rc2 only once we are done fixing it in master, turns out it's too late for RC1.

Agreed but we also want to fix Selenium tests in release/3.1. The same-site fixes in @BrennanConroy and @captainsafia's #25324 aren't enough. Would rather not back-port #25323 into a servicing branch due to the loss of code coverage.

@halter73
Copy link
Member

halter73 commented Sep 9, 2020

@mkArtakMSFT Do we still need to assign an investigator for this?

@dougbu
Copy link
Contributor

dougbu commented Sep 9, 2020

Do we still need to assign an investigator for this?

We urgently need an investigator because we're seeing the same issues in release/3.1 and that has a short timeline. @javiercn do you have time to help w/ the WASM template tests❔

@JunTaoLuo
Copy link
Contributor Author

I'll take a look tonight and see if I can find anything or at least narrow down the issue we're seeing. Also I'm curious if #25689 might contain some of the fixes that'll get this working.

@dougbu
Copy link
Contributor

dougbu commented Sep 9, 2020

I'm curious if #25689 might contain some of the fixes that'll get this working.

@SteveSandersonMS❔❔

@JunTaoLuo
Copy link
Contributor Author

Seems like those didn't affect the test failures seen in this PR. I'll try to pin down the cause a little more clearly tomorrow.

@SteveSandersonMS
Copy link
Member

I'm curious if #25689 might contain some of the fixes that'll get this working.

@SteveSandersonMS❔❔

I hope so! The changes in #25689 are enough to make all the Components E2E tests pass for me locally. I don't know about the templates tests though - that's a separate thing.

@JunTaoLuo
Copy link
Contributor Author

It didn't seem to fix the Components.E2ETests actually, I'm going to look into why today.

@JunTaoLuo JunTaoLuo force-pushed the johluo/reenable-chrome-tests branch from d50f283 to a24de39 Compare September 10, 2020 17:02
@JunTaoLuo
Copy link
Contributor Author

Turns out the browser logs are not working. I might just disable the specific tests that checks logs to unblock the rest of the tests enabled by this PR while I investigate.

@JunTaoLuo JunTaoLuo merged commit 91c8c9b into master Sep 11, 2020
@JunTaoLuo JunTaoLuo deleted the johluo/reenable-chrome-tests branch September 11, 2020 23:24
@JunTaoLuo
Copy link
Contributor Author

@dougbu @mkArtakMSFT I suppose we want these fixes in rc2 as well?

@Pilchie
Copy link
Member

Pilchie commented Sep 11, 2020

@dougbu Doug Bunting FTE @mkArtakMSFT Artak Mkrtchyan FTE I suppose we want these fixes in rc2 as well?

Yes, please!

@dougbu
Copy link
Contributor

dougbu commented Sep 11, 2020

And, release/3.1 if possible ❕

JunTaoLuo pushed a commit that referenced this pull request Sep 12, 2020
* Revert "Disable failing/hanging tests due to Chrome/Selenium issue (#25323)"

This reverts commit 332f150.

* Update Selenium to latest

* Update API

* Try specifying a version

* Update Selenium to 4.0.0-beta5

* Disable browser log tests

* Fix components e2e tests and disable blazor standalone template test
JunTaoLuo pushed a commit that referenced this pull request Sep 15, 2020
* Fix chrome/selenium tests (#25330)

* Revert "Disable failing/hanging tests due to Chrome/Selenium issue (#25323)"

This reverts commit 332f150.

* Update Selenium to latest

* Update API

* Try specifying a version

* Update Selenium to 4.0.0-beta5

* Disable browser log tests

* Fix components e2e tests and disable blazor standalone template test

* Disable tests using browser log

* Disable template test

* Avoid using .NET formatted strings in tests

* Annotate BasicTestApp suggesting that it needs the all globalization data

* Culture specific formatting relies on the ICU data carried by the OS. This
causes issues in our tests if WebAssembly carries a different set than the OS. Instead
updating these tests to use hardcoded strings.

* Additionally fixing an issue where some projects in the solution were using tasks from
the .dotnet SDK rather than the local copy of the SDK. This was causing issues building locally.

Co-authored-by: Pranav K <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failures and hangs due to Selenium/Chrome issues