Skip to content

Commit 9dbbddc

Browse files
committed
More changes
1 parent df74243 commit 9dbbddc

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
variables:
99
SAUCE_CONNECT_DOWNLOAD_ON_INSTALL: true
1010
E2ETESTS_SauceTest: true
11-
E2ETESTS_Sauce__TestName: 'Blazor Daily Tests'
1211
E2ETESTS_Sauce__TunnelIdentifier: 'blazor-e2e-sc-proxy-tunnel'
1312
E2ETESTS_Sauce__HostName: 'sauce.local'
1413
jobs:
@@ -17,9 +16,10 @@ jobs:
1716
buildDirectory: src/Components
1817
isTestingJob: true
1918
agentOs: Windows
20-
jobName: BlazorDailyTests_Android_Chrome
19+
jobName: BlazorDailyTests
2120
jobDisplayName: "Blazor Daily Tests"
2221
afterBuild:
22+
2323
# macOS/Safari
2424
- script: 'dotnet test --filter "StandaloneAppTest"'
2525
workingDirectory: 'src/Components/test/E2ETest'
@@ -30,9 +30,12 @@ jobs:
3030
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
3131
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
3232
# Set platform/browser configuration.
33+
E2ETESTS_Sauce__TestName: 'Blazor Daily Tests - macOS/Safari'
3334
E2ETESTS_Sauce__PlatformName: 'macOS 10.14'
34-
E2ETESTS_Sauce__BrowserName: 'safari'
35-
E2ETESTS_Sauce__BrowserVersion: 'latest'
35+
E2ETESTS_Sauce__BrowserName: 'Safari'
36+
# Need to explicitly set version here because some older versions don't support timeouts in Safari.
37+
E2ETESTS_Sauce__SeleniumVersion: '3.4.0'
38+
3639
# Android/Chrome
3740
- script: 'dotnet test --filter "StandaloneAppTest"'
3841
workingDirectory: 'src/Components/test/E2ETest'
@@ -43,6 +46,7 @@ jobs:
4346
E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
4447
E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
4548
# Set platform/browser configuration.
49+
E2ETESTS_Sauce__TestName: 'Blazor Daily Tests - Android/Chrome'
4650
E2ETESTS_Sauce__PlatformName: 'Android'
4751
E2ETESTS_Sauce__PlatformVersion: '10.0'
4852
E2ETESTS_Sauce__BrowserName: 'Chrome'

src/Components/Blazor/testassets/StandaloneApp/wwwroot/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8" />
5+
<!-- Forcing the device width here so that our automated tests work consistently on mobile browsers. -->
56
<meta name="viewport" content="width=1024">
67
<title>Blazor standalone</title>
78
<base href="/" />

src/Components/test/E2ETest/Tests/StandaloneAppTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ public void NavMenuHighlightsCurrentLocation()
5151
// Verify we start at home, with the home link highlighted
5252
Assert.Equal("Hello, world!", Browser.FindElement(mainHeaderSelector).Text);
5353
Assert.Collection(Browser.FindElements(activeNavLinksSelector),
54-
item => Assert.Equal("Home", item.Text));
54+
item => Assert.Equal("Home", item.Text.Trim()));
5555

5656
// Click on the "counter" link
5757
Browser.FindElement(By.LinkText("Counter")).Click();
5858

5959
// Verify we're now on the counter page, with that nav link (only) highlighted
6060
Assert.Equal("Counter", Browser.FindElement(mainHeaderSelector).Text);
6161
Assert.Collection(Browser.FindElements(activeNavLinksSelector),
62-
item => Assert.Equal("Counter", item.Text));
62+
item => Assert.Equal("Counter", item.Text.Trim()));
6363

6464
// Verify we can navigate back to home too
6565
Browser.FindElement(By.LinkText("Home")).Click();
6666
Assert.Equal("Hello, world!", Browser.FindElement(mainHeaderSelector).Text);
6767
Assert.Collection(Browser.FindElements(activeNavLinksSelector),
68-
item => Assert.Equal("Home", item.Text));
68+
item => Assert.Equal("Home", item.Text.Trim()));
6969
}
7070

7171
[Fact]

src/Shared/E2ETesting/BrowserFixture.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,11 @@ public async Task DisposeAsync()
183183
capabilities.SetCapability("accessKey", sauce.AccessKey);
184184
capabilities.SetCapability("tunnelIdentifier", sauce.TunnelIdentifier);
185185
capabilities.SetCapability("name", name);
186-
capabilities.SetCapability("browserName", sauce.BrowserName);
186+
187+
if (!string.IsNullOrEmpty(sauce.BrowserName))
188+
{
189+
capabilities.SetCapability("browserName", sauce.BrowserName);
190+
}
187191

188192
if (!string.IsNullOrEmpty(sauce.PlatformVersion))
189193
{
@@ -216,6 +220,11 @@ public async Task DisposeAsync()
216220
capabilities.SetCapability("appiumVersion", sauce.AppiumVersion);
217221
}
218222

223+
if (!string.IsNullOrEmpty(sauce.SeleniumVersion))
224+
{
225+
capabilities.SetCapability("seleniumVersion", sauce.SeleniumVersion);
226+
}
227+
219228
await SauceConnectServer.StartAsync(output);
220229

221230
var attempt = 0;
@@ -244,7 +253,7 @@ public async Task DisposeAsync()
244253

245254
} while (attempt < maxAttempts);
246255

247-
throw new InvalidOperationException("Couldn't create a SauceLabs remote driver client. The server is irresponsive");
256+
throw new InvalidOperationException("Couldn't create a SauceLabs remote driver client.");
248257
}
249258
}
250259
}

src/Shared/E2ETesting/SauceOptions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class SauceOptions
1515

1616
public string TestName { get; set; }
1717

18+
public bool IsRealDevice { get; set; }
19+
1820
public string PlatformName { get; set; }
1921

2022
public string PlatformVersion { get; set; }
@@ -28,5 +30,7 @@ public class SauceOptions
2830
public string DeviceOrientation { get; set; }
2931

3032
public string AppiumVersion { get; set; }
33+
34+
public string SeleniumVersion { get; set; }
3135
}
32-
}
36+
}

0 commit comments

Comments
 (0)