Skip to content

Commit e3bbb7e

Browse files
committed
update yml
1 parent 745d69e commit e3bbb7e

File tree

5 files changed

+123
-26
lines changed

5 files changed

+123
-26
lines changed

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

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,68 @@
77
# The only Daily Tests we have run in Sauce Labs and only need to run on one machine (because they just trigger SauceLabs)
88
# Hence we use the 'default-build.yml' template because it represents a single phase
99
variables:
10+
SAUCE_CONNECT_DOWNLOAD_ON_INSTALL: true
1011
E2ETESTS_SauceTest: true
11-
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
12-
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
12+
E2ETESTS_Sauce__TestName: 'Blazor Daily Tests'
1313
E2ETESTS_Sauce__TunnelIdentifier: 'blazor-e2e-sc-proxy-tunnel'
1414
E2ETESTS_Sauce__HostName: 'sauce.local'
1515
jobs:
1616
- template: jobs/default-build.yml
1717
parameters:
1818
buildDirectory: src/Components
19-
buildArgs: -test
2019
isTestingJob: true
2120
agentOs: Windows
22-
jobName: BlazorDailyTests
21+
jobName: BlazorDailyTests_Android_Chrome
2322
jobDisplayName: "Blazor Daily Tests"
23+
afterBuild:
24+
# macOS/Chrome
25+
- script: 'dotnet test --filter "StandaloneAppTest"'
26+
workingDirectory: 'src/Components/test/E2ETest'
27+
displayName: 'Run Blazor tests - macOS/Chrome'
28+
condition: succeededOrFailed()
29+
env:
30+
# Secrets need to be explicitly mapped to env variables.
31+
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
32+
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
33+
# Set platform/browser configuration.
34+
E2ETESTS_Sauce__PlatformName: 'macOS'
35+
E2ETESTS_Sauce__PlatformVersion: '10.14'
36+
E2ETESTS_Sauce__BrowserName: 'Chrome'
37+
E2ETESTS_Sauce__BrowserVersion: 'latest'
38+
# Android/Chrome
39+
- script: 'dotnet test --filter "StandaloneAppTest"'
40+
workingDirectory: 'src/Components/test/E2ETest'
41+
displayName: 'Run Blazor tests - Android/Chrome'
42+
condition: succeededOrFailed()
43+
env:
44+
# Secrets need to be explicitly mapped to env variables.
45+
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
46+
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
47+
# Set platform/browser configuration.
48+
E2ETESTS_Sauce__PlatformName: 'Android'
49+
E2ETESTS_Sauce__PlatformVersion: '10.0'
50+
E2ETESTS_Sauce__BrowserName: 'Chrome'
51+
E2ETESTS_Sauce__DeviceName: 'Android GoogleAPI Emulator'
52+
E2ETESTS_Sauce__DeviceOrientation: 'portrait'
53+
E2ETESTS_Sauce__AppiumVersion: '1.9.1'
54+
# iOS/Safari
55+
- script: 'dotnet test --filter "StandaloneAppTest"'
56+
workingDirectory: 'src/Components/test/E2ETest'
57+
displayName: 'Run Blazor tests - iOS/Safari'
58+
condition: succeededOrFailed()
59+
env:
60+
# Secrets need to be explicitly mapped to env variables.
61+
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
62+
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
63+
# Set platform/browser configuration.
64+
E2ETESTS_Sauce__PlatformName: 'iOS'
65+
E2ETESTS_Sauce__PlatformVersion: '13.0'
66+
E2ETESTS_Sauce__BrowserName: 'Safari'
67+
E2ETESTS_Sauce__BrowserVersion: 'latest'
68+
E2ETESTS_Sauce__DeviceName: 'iPhone 11 Simulator'
69+
E2ETESTS_Sauce__DeviceOrientation: 'portrait'
70+
E2ETESTS_Sauce__AppiumVersion: '1.15.0'
2471
artifacts:
2572
- name: Windows_Logs
2673
path: ../../artifacts/log/
27-
publishOnError: true
74+
publishOnError: true

src/Shared/E2ETesting/BrowserFixture.cs

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,50 @@ 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+
if (sauce == null)
162+
{
163+
throw new InvalidOperationException("SauceLabs environment variables not set.");
164+
}
165+
166+
167+
168+
var name = sauce.TestName;
161169
if (!string.IsNullOrEmpty(context))
162170
{
163171
name = $"{name} - {context}";
164172
}
165173

166174
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);
175+
176+
// Required config
177+
capabilities.SetCapability("username", sauce.Username);
178+
capabilities.SetCapability("accessKey", sauce.AccessKey);
179+
capabilities.SetCapability("tunnelIdentifier", sauce.TunnelIdentifier);
170180
capabilities.SetCapability("name", name);
181+
capabilities.SetCapability("platformName", sauce.PlatformName);
182+
capabilities.SetCapability("browserName", sauce.BrowserName);
183+
capabilities.SetCapability("browserVersion", sauce.BrowserVersion);
184+
185+
if (!string.IsNullOrEmpty(sauce.PlatformVersion))
186+
{
187+
capabilities.SetCapability("platformVersion", sauce.PlatformVersion);
188+
}
171189

172-
capabilities.SetCapability("browserName", "Chrome");
173-
capabilities.SetCapability("platform", "macOS 10.13");
174-
capabilities.SetCapability("version", "latest");
190+
if (!string.IsNullOrEmpty(sauce.DeviceName))
191+
{
192+
capabilities.SetCapability("deviceName", sauce.DeviceName);
193+
}
194+
195+
if (!string.IsNullOrEmpty(sauce.DeviceOrientation))
196+
{
197+
capabilities.SetCapability("deviceOrientation", sauce.DeviceOrientation);
198+
}
199+
200+
if (!string.IsNullOrEmpty(sauce.AppiumVersion))
201+
{
202+
capabilities.SetCapability("appiumVersion", sauce.AppiumVersion);
203+
}
175204

176205
await SauceConnectServer.StartAsync(output);
177206

@@ -201,7 +230,7 @@ public async Task DisposeAsync()
201230

202231
} while (attempt < maxAttempts);
203232

204-
throw new InvalidOperationException("Couldn't create a Selenium remote driver client. The server is irresponsive");
233+
throw new InvalidOperationException("Couldn't create a SauceLabs remote driver client. The server is irresponsive");
205234
}
206235
}
207236
}

src/Shared/E2ETesting/E2ETestOptions.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,5 @@ static E2ETestOptions()
6060
public bool SauceTest { get; set; } = false;
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)