Skip to content

Commit 02c3ddb

Browse files
committed
update yml
1 parent 745d69e commit 02c3ddb

File tree

5 files changed

+132
-29
lines changed

5 files changed

+132
-29
lines changed

.azure/pipelines/blazor-daily-tests.yml

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,68 @@
44
# Daily Tests for Blazor
55
# These use Sauce Labs resources, hence they run daily rather than per-commit.
66

7-
# The only Daily Tests we have run in Sauce Labs and only need to run on one machine (because they just trigger SauceLabs)
8-
# Hence we use the 'default-build.yml' template because it represents a single phase
7+
# We just need one Windows machine because all it does is trigger SauceLabs.
98
variables:
9+
SAUCE_CONNECT_DOWNLOAD_ON_INSTALL: true
1010
E2ETESTS_SauceTest: true
11-
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
12-
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
11+
E2ETESTS_Sauce__TestName: 'Blazor Daily Tests'
1312
E2ETESTS_Sauce__TunnelIdentifier: 'blazor-e2e-sc-proxy-tunnel'
1413
E2ETESTS_Sauce__HostName: 'sauce.local'
1514
jobs:
1615
- template: jobs/default-build.yml
1716
parameters:
1817
buildDirectory: src/Components
19-
buildArgs: -test
2018
isTestingJob: true
2119
agentOs: Windows
22-
jobName: BlazorDailyTests
20+
jobName: BlazorDailyTests_Android_Chrome
2321
jobDisplayName: "Blazor Daily Tests"
22+
afterBuild:
23+
# macOS/Safari
24+
- script: 'dotnet test --filter "StandaloneAppTest"'
25+
workingDirectory: 'src/Components/test/E2ETest'
26+
displayName: 'Run Blazor tests - macOS/Safari'
27+
condition: succeededOrFailed()
28+
env:
29+
# Secrets need to be explicitly mapped to env variables.
30+
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
31+
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
32+
# Set platform/browser configuration.
33+
E2ETESTS_Sauce__PlatformName: 'macOS'
34+
E2ETESTS_Sauce__PlatformVersion: '10.14'
35+
E2ETESTS_Sauce__BrowserName: 'Safari'
36+
E2ETESTS_Sauce__BrowserVersion: 'latest'
37+
# Android/Chrome
38+
- script: 'dotnet test --filter "StandaloneAppTest"'
39+
workingDirectory: 'src/Components/test/E2ETest'
40+
displayName: 'Run Blazor tests - Android/Chrome'
41+
condition: succeededOrFailed()
42+
env:
43+
# Secrets need to be explicitly mapped to env variables.
44+
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
45+
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
46+
# Set platform/browser configuration.
47+
E2ETESTS_Sauce__PlatformName: 'Android'
48+
E2ETESTS_Sauce__PlatformVersion: '10.0'
49+
E2ETESTS_Sauce__BrowserName: 'Chrome'
50+
E2ETESTS_Sauce__DeviceName: 'Android GoogleAPI Emulator'
51+
E2ETESTS_Sauce__DeviceOrientation: 'portrait'
52+
E2ETESTS_Sauce__AppiumVersion: '1.9.1'
53+
# iOS/Safari
54+
- script: 'dotnet test --filter "StandaloneAppTest"'
55+
workingDirectory: 'src/Components/test/E2ETest'
56+
displayName: 'Run Blazor tests - iOS/Safari'
57+
condition: succeededOrFailed()
58+
env:
59+
# Secrets need to be explicitly mapped to env variables.
60+
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
61+
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
62+
# Set platform/browser configuration.
63+
E2ETESTS_Sauce__PlatformName: 'iOS'
64+
E2ETESTS_Sauce__PlatformVersion: '13.0'
65+
E2ETESTS_Sauce__BrowserName: 'Safari'
66+
E2ETESTS_Sauce__DeviceName: 'iPhone 11'
67+
E2ETESTS_Sauce__DeviceOrientation: 'portrait'
2468
artifacts:
2569
- name: Windows_Logs
2670
path: ../../artifacts/log/
27-
publishOnError: true
71+
publishOnError: true

src/Shared/E2ETesting/BrowserFixture.cs

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,59 @@ public async Task DisposeAsync()
157157

158158
private async Task<(IWebDriver browser, ILogs log)> CreateSauceBrowserAsync(string context, ITestOutputHelper output)
159159
{
160-
var name = "Blazor E2E tests";
160+
var sauce = E2ETestOptions.Instance.Sauce;
161+
162+
if (sauce == null ||
163+
string.IsNullOrEmpty(sauce.TestName) ||
164+
string.IsNullOrEmpty(sauce.Username) ||
165+
string.IsNullOrEmpty(sauce.AccessKey) ||
166+
string.IsNullOrEmpty(sauce.TunnelIdentifier) ||
167+
string.IsNullOrEmpty(sauce.PlatformName) ||
168+
string.IsNullOrEmpty(sauce.BrowserName))
169+
{
170+
throw new InvalidOperationException("Required SauceLabs environment variables not set.");
171+
}
172+
173+
var name = sauce.TestName;
161174
if (!string.IsNullOrEmpty(context))
162175
{
163176
name = $"{name} - {context}";
164177
}
165178

166179
var capabilities = new DesiredCapabilities();
167-
capabilities.SetCapability("username", E2ETestOptions.Instance.Sauce.Username);
168-
capabilities.SetCapability("accessKey", E2ETestOptions.Instance.Sauce.AccessKey);
169-
capabilities.SetCapability("tunnelIdentifier", E2ETestOptions.Instance.Sauce.TunnelIdentifier);
180+
181+
// Required config
182+
capabilities.SetCapability("username", sauce.Username);
183+
capabilities.SetCapability("accessKey", sauce.AccessKey);
184+
capabilities.SetCapability("tunnelIdentifier", sauce.TunnelIdentifier);
170185
capabilities.SetCapability("name", name);
186+
capabilities.SetCapability("platformName", sauce.PlatformName);
187+
capabilities.SetCapability("browserName", sauce.BrowserName);
188+
189+
if (!string.IsNullOrEmpty(sauce.BrowserVersion))
190+
{
191+
capabilities.SetCapability("browserVersion", sauce.BrowserVersion);
192+
}
171193

172-
capabilities.SetCapability("browserName", "Chrome");
173-
capabilities.SetCapability("platform", "macOS 10.13");
174-
capabilities.SetCapability("version", "latest");
194+
if (!string.IsNullOrEmpty(sauce.PlatformVersion))
195+
{
196+
capabilities.SetCapability("platformVersion", sauce.PlatformVersion);
197+
}
198+
199+
if (!string.IsNullOrEmpty(sauce.DeviceName))
200+
{
201+
capabilities.SetCapability("deviceName", sauce.DeviceName);
202+
}
203+
204+
if (!string.IsNullOrEmpty(sauce.DeviceOrientation))
205+
{
206+
capabilities.SetCapability("deviceOrientation", sauce.DeviceOrientation);
207+
}
208+
209+
if (!string.IsNullOrEmpty(sauce.AppiumVersion))
210+
{
211+
capabilities.SetCapability("appiumVersion", sauce.AppiumVersion);
212+
}
175213

176214
await SauceConnectServer.StartAsync(output);
177215

@@ -201,7 +239,7 @@ public async Task DisposeAsync()
201239

202240
} while (attempt < maxAttempts);
203241

204-
throw new InvalidOperationException("Couldn't create a Selenium remote driver client. The server is irresponsive");
242+
throw new InvalidOperationException("Couldn't create a SauceLabs remote driver client. The server is irresponsive");
205243
}
206244
}
207245
}

src/Shared/E2ETesting/E2ETestOptions.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,8 @@ static E2ETestOptions()
5757

5858
public double DefaultAfterFailureWaitTimeoutInSeconds { get; set; } = 3;
5959

60-
public bool SauceTest { get; set; } = false;
60+
public bool SauceTest { get; set; }
6161

6262
public SauceOptions Sauce { get; set; }
63-
64-
public class SauceOptions
65-
{
66-
public string Username { get; set; }
67-
68-
public string AccessKey { get; set; }
69-
70-
public string TunnelIdentifier { get; set; }
71-
72-
public string HostName { get; set; }
73-
}
7463
}
7564
}

src/Shared/E2ETesting/SauceConnectServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public class SauceConnectServer : IDisposable
2828
private Process _sentinelProcess;
2929
private static IMessageSink _diagnosticsMessageSink;
3030

31-
// 1h 30 min
32-
private static int SauceConnectProcessTimeout = 3600;
31+
// 2h
32+
private static int SauceConnectProcessTimeout = 7200;
3333

3434
public SauceConnectServer(IMessageSink diagnosticsMessageSink)
3535
{

src/Shared/E2ETesting/SauceOptions.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
namespace Microsoft.AspNetCore.E2ETesting
5+
{
6+
public class SauceOptions
7+
{
8+
public string Username { get; set; }
9+
10+
public string AccessKey { get; set; }
11+
12+
public string TunnelIdentifier { get; set; }
13+
14+
public string HostName { get; set; }
15+
16+
public string TestName { get; set; }
17+
18+
public string PlatformName { get; set; }
19+
20+
public string PlatformVersion { get; set; }
21+
22+
public string BrowserName { get; set; }
23+
24+
public string BrowserVersion { get; set; }
25+
26+
public string DeviceName { get; set; }
27+
28+
public string DeviceOrientation { get; set; }
29+
30+
public string AppiumVersion { get; set; }
31+
}
32+
}

0 commit comments

Comments
 (0)