Skip to content

Run Blazor E2E tests on SauceLabs #18456

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 5 commits into from
Jan 28, 2020

Conversation

ajaybhargavb
Copy link
Contributor

Fixes #17013

This PR sets up a remote web driver that connects to SauceLabs using a proxy.

  • Added a script that will be launched as a separate process that launches a persistent proxy connection with SauceLabs
  • Added necessary options to E2ETestOptions to accomodate SauceLabs configs
  • Updated server test fixtures to use a custom hostname as the server url instead of directly pointing to 127.0.0.1

Copy link
Contributor Author

@ajaybhargavb ajaybhargavb left a comment

Choose a reason for hiding this comment

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

I've verified this works manually.

Things to do:

  • Provide a config to customize which browser/platform to run on
  • Add a way to report test pass/fail status to SauceLabs (right now it shows unknown)
  • Setup an azure pipeline and add a .yml file for the blazor e2e tests

In the meantime, @javiercn @SteveSandersonMS can you take a look at this PR?


namespace Microsoft.AspNetCore.E2ETesting
{
public class SauceConnectServer : IDisposable
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of this file is copy-paste from SeleniumStandaloneServer

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 room to consolidate the two types? It might be difficult to remember to update both types if we change the code in the other.

@javiercn javiercn added the area-blazor Includes: Blazor, Razor Components label Jan 21, 2020
@@ -0,0 +1,82 @@
import { EOL } from "os";
Copy link
Member

Choose a reason for hiding this comment

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

Why is this a typescript file? There's nothing typescript specific here and we shouldn't need typescript for something as simple as this.

Can we change this to be a plain JavaScript file? Any recent version of node will handle modern javascript.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took the easy path as we do similar things in SignalR which is in typescript. IMO there is no downside to using typescript for this. It is nicer :)

Copy link
Member

@javiercn javiercn left a comment

Choose a reason for hiding this comment

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

Looks like a promising start!

A couple of things to take into account.

We likely want to run the tests on saucelabs in addition to running them locally on the CI. Does this change make that possible? It seems to me that it replaces one server with the other.

If we wanted to run them in both places we would have to have some extra step on the CI to do that, which I'm fine with, just want you to think about it.

Other than that, this is definitely going on the right direction. Great job so far!

@ajaybhargavb
Copy link
Contributor Author

We likely want to run the tests on saucelabs in addition to running them locally on the CI. Does this change make that possible? It seems to me that it replaces one server with the other.

Yes, that is the goal. I know this is currently hardcoded to true but this will actually come from msbuild.

If we wanted to run them in both places we would have to have some extra step on the CI to do that, which I'm fine with, just want you to think about it.

Yes, I am adding a .yml file similar to https://github.com/dotnet/aspnetcore/blob/master/.azure/pipelines/signalr-daily-tests.yml. This will set all the necessary env vars and run build with testing on SauceLabs enabled.

@ajaybhargavb ajaybhargavb force-pushed the ajbaaska/multi-device-testing branch 2 times, most recently from 3313670 to dc8dd35 Compare January 22, 2020 03:30
@ajaybhargavb ajaybhargavb marked this pull request as ready for review January 22, 2020 03:32
@ajaybhargavb ajaybhargavb force-pushed the ajbaaska/multi-device-testing branch 2 times, most recently from e0cce92 to ef5129b Compare January 22, 2020 08:59
@ajaybhargavb
Copy link
Contributor Author

Updated.

@ajaybhargavb ajaybhargavb requested a review from pranavkm January 22, 2020 09:08
@ajaybhargavb ajaybhargavb force-pushed the ajbaaska/multi-device-testing branch 2 times, most recently from c92f4e5 to e3bbb7e Compare January 23, 2020 00:15
jobDisplayName: "Blazor Daily Tests"
afterBuild:
# macOS/Chrome
- script: 'dotnet test --filter "StandaloneAppTest"'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy to start with this, but is there a limitation that requires this?

@@ -461,7 +461,7 @@ async Task GetDetails(int msg_id, int object_id, CancellationToken token, string
{
result = var_list
});
} catch (Exception e) {
} catch (Exception) {
Copy link
Contributor

Choose a reason for hiding this comment

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

no beuno. We should fix this in Mono and flow it through. But given how small these changes are, I think we can live with this for now.


namespace Microsoft.AspNetCore.E2ETesting
{
public class SauceConnectServer : IDisposable
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 room to consolidate the two types? It might be difficult to remember to update both types if we change the code in the other.

@ajaybhargavb ajaybhargavb force-pushed the ajbaaska/multi-device-testing branch 3 times, most recently from 6b9d5ff to bbdccab Compare January 23, 2020 21:35
@ajaybhargavb ajaybhargavb force-pushed the ajbaaska/multi-device-testing branch from bbdccab to fae2886 Compare January 27, 2020 23:50
@ajaybhargavb ajaybhargavb force-pushed the ajbaaska/multi-device-testing branch from fae2886 to 9dbbddc Compare January 28, 2020 01:18
@ajaybhargavb
Copy link
Contributor Author

Merging this. Real device testing on iPhones is currently blocked on a saucelabs subscription issue. I'll send a separate PR to enable that.

@ajaybhargavb ajaybhargavb merged commit 24be299 into blazor-wasm Jan 28, 2020
@ajaybhargavb ajaybhargavb deleted the ajbaaska/multi-device-testing branch January 28, 2020 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants