Skip to content

[Templating][Components] Unify and improve E2E testing infrastructure #8188

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 1 commit into from
Mar 11, 2019

Conversation

javiercn
Copy link
Member

@javiercn javiercn commented Mar 4, 2019

  • Unify the Templating and Components testing infrastructure.
  • Enable test project discovery in the components E2E tests.

@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- Shared testing infrastructure for running E2E tests using selenium -->
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.props" />
Copy link
Member Author

Choose a reason for hiding this comment

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

This import and the targets import below is all that's needed to bring in Selenium E2E tests

@javiercn javiercn requested a review from ryanbrandenburg March 4, 2019 20:58
@javiercn javiercn requested a review from dougbu as a code owner March 4, 2019 22:19
Copy link
Contributor

@ryanbrandenburg ryanbrandenburg left a comment

Choose a reason for hiding this comment

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

These changes seem fine. You had talked about improving error detection and spiting tests into parts, I assume that's coming at a later date?

@javiercn javiercn force-pushed the javiercn/test-infrastructure-flakyness branch from 7462f4b to 47e0624 Compare March 4, 2019 23:27
@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 5, 2019
@javiercn javiercn force-pushed the javiercn/test-infrastructure-flakyness branch 2 times, most recently from c47ef93 to 6c96b8a Compare March 5, 2019 07:42
@@ -42,9 +47,12 @@ private void TestApplication(bool publish)

private void TestBasicNavigation()
{
// Give components.server enough time to load so that it can replace
// the prerendered content before we start making assertions.
Thread.Sleep(5000);
Copy link
Member

Choose a reason for hiding this comment

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

This seems a bit sketchy. It might be OK temporarily, but maybe we should extend the connected/disconnected APIs that @pranavkm was working on to provide a connection status value so it can be determined directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, ideally what I need is some API to know that components.server.js finished initializing so that I can do ((IJavasScriptExecutor)Browser).Execute("snippet") and determine it's done initializing.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could register a circuitHandler and wait for onConnectionUp to complete.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a crazy amount of work for these tests, and wouldn't work for Blazor in the future. We should let people know when we are done initializing stuff by for example, simply saving the boot promise inside the window[Blazor] object.

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.

Looks great to me! I'd be interested to know about whether this can now run cross-platform.

@javiercn
Copy link
Member Author

javiercn commented Mar 5, 2019

Looks great to me! I'd be interested to know about whether this can now run cross-platform.

I'm looking to see if I can make it run on OS X (and potentially linux)

@@ -42,9 +47,12 @@ private void TestApplication(bool publish)

private void TestBasicNavigation()
{
// Give components.server enough time to load so that it can replace
// the prerendered content before we start making assertions.
Thread.Sleep(5000);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could register a circuitHandler and wait for onConnectionUp to complete.


<!-- JAVA -->
<Message Importance="High" Text="Ensuring JAVA is available" />
<Exec Command="java -version" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we capture the exit code and print a message that says what needs to be done resolve this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not <Exec Command="${JAVA_HOME}/bin/java.exe -version"/> ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because this needs to run cross-platform and needs to be on the PATH for https://github.com/aspnet/AspNetCore/pull/8188/files?utf8=%E2%9C%93&diff=unified#diff-4035093707e8bfd6d9ba2a44912dce70R9 to work

@javiercn javiercn force-pushed the javiercn/test-infrastructure-flakyness branch 2 times, most recently from c6a8453 to 79b4480 Compare March 6, 2019 15:10
@@ -123,6 +123,10 @@ jobs:
- ${{ if and(eq(parameters.installJdk, 'true'), eq(parameters.agentOs, 'Windows')) }}:
- powershell: ./eng/scripts/InstallJdk.ps1 '11.0.1'
displayName: Install JDK 11
- powershell: Write-Host "##vso[task.prependpath]$env:JAVA_HOME\bin"
displayName: Prepend JAVA bin folder to the PATH.
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't change $env:Path globally. Java is only needed in a few places.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason this is super problematic? It's only building on the CI (so local builds aren't affected) and goes away once the build finishes.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not "super problematic" but it's a break from how the build currently works and broader than seemed necessary. If we go this route (rather than, say, creating a yarn.bat script), should clean up the Gradlew script and anything else that updates $env:Path for Java on Windows.


<!-- JAVA -->
<Message Importance="High" Text="Ensuring JAVA is available" />
<Exec Command="java -version" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not <Exec Command="${JAVA_HOME}/bin/java.exe -version"/> ?

@javiercn javiercn force-pushed the javiercn/test-infrastructure-flakyness branch 4 times, most recently from f14fb59 to 3772540 Compare March 7, 2019 00:31
@javiercn javiercn requested a review from dougbu March 7, 2019 09:38
@javiercn
Copy link
Member Author

javiercn commented Mar 7, 2019

@dougbu This is blocked on you.

The requirements have been explained. Can you please withdrawn your request for changes? We want to get this in ASAP as we haven't been running these tests regularly in a long time and has caused us issues.

@@ -123,6 +123,10 @@ jobs:
- ${{ if and(eq(parameters.installJdk, 'true'), eq(parameters.agentOs, 'Windows')) }}:
- powershell: ./eng/scripts/InstallJdk.ps1 '11.0.1'
displayName: Install JDK 11
- powershell: Write-Host "##vso[task.prependpath]$env:JAVA_HOME\bin"
displayName: Prepend JAVA bin folder to the PATH.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not "super problematic" but it's a break from how the build currently works and broader than seemed necessary. If we go this route (rather than, say, creating a yarn.bat script), should clean up the Gradlew script and anything else that updates $env:Path for Java on Windows.

@dougbu
Copy link
Contributor

dougbu commented Mar 7, 2019

Note

should clean up the Gradlew script and anything else that updates $env:Path for Java on Windows

isn't urgent and doesn't need to be included in this PR. If you don't include it, please file an issue.

@ryanbrandenburg
Copy link
Contributor

Any chance we could get this in today? I'd like to see if it fixes any of the the flakiness for SPA template tests.

@SteveSandersonMS
Copy link
Member

Javier mentioned he preferred to merge this on Monday, so he could be around to watch for any possible flakiness.

* Unify the Templating and Components testing infrastructure.
* Enable test project discovery in the components E2E tests.
@javiercn javiercn force-pushed the javiercn/test-infrastructure-flakyness branch from 3772540 to c7770a5 Compare March 11, 2019 15:32
@javiercn
Copy link
Member Author

@aspnet/brt
image

I've seen this failing several times.

@ryanbrandenburg
Copy link
Contributor

@javiercn javiercn merged commit d7a9606 into master Mar 11, 2019
@natemcmaster natemcmaster deleted the javiercn/test-infrastructure-flakyness branch May 3, 2019 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants