Skip to content

Commit

Permalink
Merge pull request #35 from unoplatform/dev/dr/Edge
Browse files Browse the repository at this point in the history
feat(EdgeSupport): Add support for the chromium edge
  • Loading branch information
nickrandolph committed Aug 10, 2023
2 parents 64c6cac + bfdca37 commit 9669fd2
Show file tree
Hide file tree
Showing 20 changed files with 662 additions and 343 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
launchSettings.json

# Build results
[Dd]ebug[-\w]*/
Expand Down
21 changes: 5 additions & 16 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,11 @@ jobs:
displayName: Use GitVersion

- task: UseDotNet@2
displayName: 'Use .NET Core SDK 5.0.101'
inputs:
packageType: sdk
version: 5.0.101

- task: UseDotNet@2
displayName: 'Use .NET Core SDK 6.0.401'
displayName: 'Use .NET SDK'
retryCountOnTaskFailure: 3
inputs:
packageType: sdk
version: 6.0.401
version: 7.0.302

- task: MSBuild@1
inputs:
Expand Down Expand Up @@ -110,16 +104,11 @@ jobs:
clean: true

- task: UseDotNet@2
displayName: 'Use .NET Core SDK 5.0.101'
inputs:
packageType: sdk
version: 5.0.101

- task: UseDotNet@2
displayName: 'Use .NET Core SDK 6.0.401'
displayName: 'Use .NET SDK'
retryCountOnTaskFailure: 3
inputs:
packageType: sdk
version: 6.0.401
version: 7.0.302

- bash: |
chmod +x build/wasm-uitest-run.sh
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<!-- Force embedded roslyn generators -->
<UnoUIUseRoslynSourceGenerators>true</UnoUIUseRoslynSourceGenerators>
<!--<LangVersion>10.0</LangVersion>-->
</PropertyGroup>

<Choose>
Expand Down
3 changes: 3 additions & 0 deletions src/Sample/Sample.UITests/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using Uno.UITest.Helpers.Queries;
using Uno.UITests.Helpers;

namespace Sample.UITests
{
Expand All @@ -15,5 +16,7 @@ public class Constants
public readonly static string iOSDeviceNameOrId = "iPad Pro (12.9-inch) (5th generation)";

public readonly static Platform CurrentPlatform = Platform.Browser;

public readonly static Browser WebAssemblyBrowser = Browser.Chrome;
}
}
2 changes: 2 additions & 0 deletions src/Sample/Sample.UITests/DragCoordinates_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class DragCoordinates_Tests : TestBase
[Test]
public void DragBorder01()
{
App.Screenshot("home screen");

Query testSelector = q => q.Marked("DragCoordinates 01");

Query rootCanvas = q => q.Marked("rootCanvas");
Expand Down
1 change: 0 additions & 1 deletion src/Sample/Sample.UITests/Sample.UITests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>net47</TargetFramework>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Sample/Sample.UITests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static void InitializeTestEnvrionment()
AppInitializer.TestEnvironment.AndroidAppName = Constants.AndroidAppName;
AppInitializer.TestEnvironment.iOSDeviceNameOrId = Constants.iOSDeviceNameOrId;
AppInitializer.TestEnvironment.CurrentPlatform = Constants.CurrentPlatform;
AppInitializer.TestEnvironment.WebAssemblyBrowser = Constants.WebAssemblyBrowser;

#if DEBUG
AppInitializer.TestEnvironment.WebAssemblyHeadless = false;
Expand Down
5 changes: 4 additions & 1 deletion src/Sample/Sample.Wasm/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Sample.Wasm": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"launchUrl": "http://localhost:55932/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
}
}
}
}
76 changes: 41 additions & 35 deletions src/Sample/Sample.Wasm/Sample.Wasm.csproj
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<WasmHead>true</WasmHead>
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
<NoWarn>NU1701</NoWarn>
<UnoUIUseRoslynSourceGenerators>true</UnoUIUseRoslynSourceGenerators>
</PropertyGroup>
<PropertyGroup>
<IsUiAutomationMappingEnabled>true</IsUiAutomationMappingEnabled>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Sample.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
<Content Include="Fonts\winjs-symbols.woff2" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmCSS\Fonts.css" />
<EmbeddedResource Include="WasmScripts\AppManifest.js" />
</ItemGroup>
<ItemGroup>
<LinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<!--
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<WasmHead>true</WasmHead>
<DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
<NoWarn>NU1701</NoWarn>
<UnoUIUseRoslynSourceGenerators>true</UnoUIUseRoslynSourceGenerators>
</PropertyGroup>
<PropertyGroup>
<IsUiAutomationMappingEnabled>true</IsUiAutomationMappingEnabled>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<MonoRuntimeDebuggerEnabled>true</MonoRuntimeDebuggerEnabled>
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Sample.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
<Content Include="Fonts\winjs-symbols.woff2" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WasmCSS\Fonts.css" />
<EmbeddedResource Include="WasmScripts\AppManifest.js" />
</ItemGroup>
<ItemGroup>
<LinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<!--
This item group is required by the project templace because of the
new SDK-Style project, otherwise some files are not aded automatically.
You can safely remove this ItemGroup completely.
-->
<Compile Remove="Program.cs" />
<Compile Include="Program.cs" />
<Content Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI.WebAssembly" Version="3.7.6" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="7.0.20" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="7.0.20" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.1" />
</ItemGroup>
<Import Project="..\Sample.Shared\Sample.Shared.projitems" Label="Shared" Condition="Exists('..\Sample.Shared\Sample.Shared.projitems')" />
<Compile Remove="Program.cs" />
<Compile Include="Program.cs" />
<Content Include="LinkerConfig.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Uno.UI.WebAssembly" Version="3.7.6" />
<PackageReference Include="Uno.Wasm.Bootstrap" Version="7.0.20" />
<PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="7.0.20" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.1" />
</ItemGroup>
<Import Project="..\Sample.Shared\Sample.Shared.projitems" Label="Shared" Condition="Exists('..\Sample.Shared\Sample.Shared.projitems')" />
</Project>
29 changes: 19 additions & 10 deletions src/Uno.UITest.Helpers/AppInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,29 +179,38 @@ private static IApp CreateBrowserApp(bool alreadyRunningApp)
{
var configurator = Uno.UITest.Selenium.ConfigureApp
.WebAssembly
.Uri(new Uri(TestEnvironment.WebAssemblyDefaultUri));

.Uri(new Uri(TestEnvironment.WebAssemblyDefaultUri))
.UsingBrowser(TestEnvironment.WebAssemblyBrowser.ToString());

if(!string.IsNullOrEmpty(TestEnvironment.ChromeDriverPath))
{
configurator = configurator.ChromeDriverLocation(
Path.Combine(TestContext.CurrentContext.TestDirectory,
TestEnvironment.ChromeDriverPath.Replace('\\', Path.DirectorySeparatorChar)));
var driverPath = Path.Combine(
TestContext.CurrentContext.TestDirectory,
TestEnvironment.ChromeDriverPath.Replace('\\', Path.DirectorySeparatorChar));
configurator = configurator.DriverPath(driverPath);
}
else if(!string.IsNullOrEmpty(TestEnvironment.SeleniumDriverPath))
{
var driverPath = Path.Combine(
TestContext.CurrentContext.TestDirectory,
TestEnvironment.SeleniumDriverPath.Replace('\\', Path.DirectorySeparatorChar));
configurator = configurator.DriverPath(driverPath);
}

if(!TestEnvironment.WebAssemblyHeadless)
if(TestEnvironment.WebAssemblyHeadless)
{
configurator = configurator
.Headless(false)
.SeleniumArgument("--remote-debugging-port=9222");
.Headless(true);
}
else
{
configurator = configurator
.Headless(true);
.Headless(false)
.SeleniumArgument("--remote-debugging-port=9222");
}

_currentApp = configurator.ScreenShotsPath(TestContext.CurrentContext.TestDirectory)
_currentApp = configurator
.ScreenShotsPath(TestContext.CurrentContext.TestDirectory)
.StartApp();

return _currentApp;
Expand Down
17 changes: 17 additions & 0 deletions src/Uno.UITest.Helpers/AppInitializerEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,26 @@ internal AppInitializerEnvironment()
/// </remarks>
public string ChromeDriverPath { get; set; }

/// <summary>
/// Defines the location of selenium driver.
/// </summary>
/// <remarks>
/// If not defined, the test engine will select the version based on
/// the currently installed browsers version.
/// </remarks>
public string SeleniumDriverPath { get; set; }

/// <summary>
/// Defines if the browser tests are running in chrome without a window.
/// </summary>
public bool WebAssemblyHeadless { get; set; } = true;

/// <summary>
/// Defines the browser to use for the Web platform. Cf. remarks about compatibility
/// </summary>
/// <remarks>
/// Note that all browser does not supports all options defined here. For instance Edge does support only the <see cref="SeleniumDriverPath"/>.
/// </remarks>
public Browser WebAssemblyBrowser { get; set; } = Browser.Chrome;
}
}
18 changes: 18 additions & 0 deletions src/Uno.UITest.Helpers/Browser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Linq;

namespace Uno.UITests.Helpers
{
/// <summary>
/// Supported web browsers for UI tests
/// </summary>
public enum Browser
{
Chrome,

/// <summary>
/// The **CHROMIUM Based** Edge web browser
/// </summary>
Edge
}
}
64 changes: 0 additions & 64 deletions src/Uno.UITest.Puppeteer/ChromeAppConfigurator.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/Uno.UITest.Puppeteer/ConfigureApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Uno.UITest.Selenium
{
public static class ConfigureApp
{
public static ChromeAppConfigurator WebAssembly =>
new ChromeAppConfigurator();
public static SeleniumAppConfigurator WebAssembly => new SeleniumAppConfigurator();
}
}
Loading

0 comments on commit 9669fd2

Please sign in to comment.