Skip to content

Commit

Permalink
Merge branch 'main' into mos379-main
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz committed Jul 19, 2023
2 parents 4e732bd + 71e6bb5 commit 2bf3d11
Showing 720 changed files with 11,938 additions and 6,906 deletions.
6 changes: 3 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -3,19 +3,19 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.1.0",
"version": "2.3.0",
"commands": [
"dotnet-cake"
]
},
"powershell": {
"version": "7.3.4",
"version": "7.3.6",
"commands": [
"pwsh"
]
},
"microsoft.dotnet.xharness.cli": {
"version": "8.0.0-prerelease.23307.1",
"version": "8.0.0-prerelease.23363.3",
"commands": [
"xharness"
]
10 changes: 3 additions & 7 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# Tizen
/Xamarin.Forms.ControlGallery.Tizen/ @rookiejava
/Stubs/Xamarin.Forms.Platform.Tizen/ @rookiejava
/Xamarin.Forms.Platform.Tizen/ @rookiejava
/Xamarin.Forms.Maps.Tizen/ @rookiejava
/EmbeddingTestBeds/Embedding.Tizen/ @rookiejava
/PagesGallery/PagesGallery.Tizen/ @rookiejava
/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific @rookiejava
**/Tizen @rookiejava @myroot @shyunmin @sung-su @JoonghyunCho
*.tizen.cs @rookiejava @myroot @shyunmin @sung-su @JoonghyunCho
*.Tizen.cs @rookiejava @myroot @shyunmin @sung-su @JoonghyunCho

# GTK
/Xamarin.Forms.ControlGallery.GTK/ @jsuarezruiz
54 changes: 36 additions & 18 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -2,45 +2,51 @@

This page contains steps to build and run the .NET MAUI repository from source. If you are looking to build apps with .NET MAUI please head over to the links in the [README](https://github.com/dotnet/maui/blob/main/README.md) to get started.

## Requirements

### Visual Studio
## Visual Studio
Follow the instructions here to install .NET MAUI with Visual Studio Stable:
- [Windows](https://learn.microsoft.com/dotnet/maui/get-started/installation?tabs=vswin)
- Select the 20348 SDK option inside Individual Components or [install 20348 manually](https://go.microsoft.com/fwlink/?linkid=2164145)
- If you know you have 20348 installed but are still getting an error around this SDK missing, trying uninstalling and reinstalling the SDK.
- [macOS](https://learn.microsoft.com/dotnet/maui/get-started/installation?tabs=vsmac)

### iOS / MacCatalyst
## iOS / MacCatalyst

iOS and MacCatalyst will require current stable Xcode. You can get this [here](https://developer.apple.com/download/more/?name=Xcode).

### Android
## Android

If you're missing any of the Android SDKs, Visual Studio should prompt you to install them. If it doesn't prompt you then use the [Android SDK Manager](https://learn.microsoft.com/xamarin/android/get-started/installation/android-sdk) to install the necessary SDKs.

### Opening the Repository
## Building the Build Tasks
Before opening the solution in Visual Studio you **MUST** build the build tasks. You have two options:

```dotnetcli
dotnet tool restore
dotnet cake --target=VS --workloads=global
```
- Do this to build the build tasks and launch Visual Studio, automatically opening the default solution:

```dotnetcli
dotnet tool restore
dotnet cake --target=VS --workloads=global
```

*NOTE*: Intellisense takes a decent amount of time to fully process your solution. It will eventually work through all the necessary tasks. If you are having intellisense issues, usually unloading/reloading the `maui.core` and `maui.controls` projects will resolve.
*NOTE*: `--workloads=global` means use the normal (globally installed) .NET workloads.

#### MacOS
- OR do this to just build the build tasks. You can then launch Visual Studio manually and open the solution of your choosing:

All of the above cake commands should work fine on `MacOS`.
```dotnetcli
dotnet tool restore
dotnet build ./Microsoft.Maui.BuildTasks.slnf
```

#### Solutions
## Available Solutions
- Microsoft.Maui.sln
- Kitchen sink solution. This includes all of the `Compatibility` projects and all of the platforms that we compile for. It is very unlikely you will need to use this solution for development.
- Microsoft.Maui-dev.sln
- `Microsoft.Maui.sln` but without the `Compatibility` projects. Because we can't detect solution filters inside `MSBuild` we had to create a separate `sln` without the `Compatibility` projects.
- Microsoft.Maui-mac.slnf
- `Microsoft.Maui-dev.sln` with all of the `Windows` targets filtered out
- Microsoft.Maui-windows.slnf
- `Microsoft.Maui-dev.sln` with all of the targets you can't build on `Windows` removed (GTK/Catalyst).
- `Microsoft.Maui-dev.sln` with all of the targets you can't build on `Windows` removed (GTK/Catalyst). Default solution on Windows.
- Microsoft.Maui-mac.slnf
- `Microsoft.Maui-dev.sln` with all of the `Windows` targets filtered out. Default solution on Mac.

*NOTE*: IntelliSense takes a decent amount of time to fully process your solution. It will eventually work through all the necessary tasks. If you are having IntelliSense issues, usually unloading/reloading the `maui.core` and `maui.controls` projects will resolve.

## What branch should I use?
- main
@@ -55,6 +61,7 @@ Always use main no matter what you are working on or where you are hoping your c
│ ├── samples
│ │ ├── Maui.Controls.Sample
│ │ ├── Maui.Controls.Sample.Sandbox
│ │ ├── Controls.Sample.UITests
├── Essentials
│ ├── samples
│ │ ├── Essentials.Sample
@@ -66,6 +73,7 @@ Always use main no matter what you are working on or where you are hoping your c

- *Maui.Controls.Sample*: Full gallery sample with all of the controls and features of .NET MAUI
- *Maui.Controls.Sample.Sandbox*: Empty project useful for testing reproductions or use cases
- *Contols.Sample.UITests*: Sample used for the automated UI tests
- *Essentials.Sample*: Full gallery demonstrating the library previously known as essentials. These are all the non UI related MAUI APIs.

### Device Test Projects
@@ -92,6 +100,16 @@ These are tests that will run on an actual device
- *Essentials.DeviceTests*: Visual Runner running all the .NET MAUI essentials xunit tests.
- *MauiBlazorWebView.DeviceTests*: Visual Runner for BlazorWebView tests.

### UI Test Projects

These are tests used for exercising the UI through accessibility layers to simulate user interactions

```
├── Controls
│ ├── tests
│ │ ├── UITests
```

### Unit Test Projects

These are tests that will not run on a device. This is useful for testing device independent logic.
@@ -174,7 +192,7 @@ public static int foo = 2130771968;

### Compile using a local `bin\dotnet`

This method ensures that the workloads installed by Visual Studio won't get changed. This is usually the best method to use if you want to preserve the global state of your machine. This method will also use the versions that are specific to the branch you are on which is a good way to ensure compatibility.
This method will use the .NET and workload versions that are specific to the branch you are on, which is a good way to ensure compatibility.

#### Cake

8 changes: 7 additions & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: .NET MAUI Community Support
url: https://docs.microsoft.com/answers/topics/dotnet-maui.html
url: https://learn.microsoft.com/answers/topics/dotnet-maui.html
about: Please ask and answer questions here.
- name: Bug report or feature request for Visual Studio for Windows and Mac
url: https://learn.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2022
about: Use Visual Studio's Report a Problem feature for issues and suggestions with Visual Studio tooling
- name: Bug report or feature request for Visual Studio Code (including C# Dev Kit)
url: https://github.com/microsoft/vscode-dotnettools/issues
about: Use the microsoft/vscode-dotnettools repo to report issues with Visual Studio Code
29 changes: 29 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,35 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 25
groups:
AndroidX:
patterns:
- "Xamarin.AndroidX.*"
- "Xamarin.Build.Download"
- "Xamarin.Google.Android.Material"
- "Xamarin.Google.Crypto.Tink.Android"
AspNetCore:
patterns:
- "Microsoft.AspNetCore.*"
- "Microsoft.JSInterop"
SkiaSharp:
patterns:
- "SkiaSharp.*"
- "Svg.*"
- "ShimSkiaSharp"
- "Fizzler"
MicrosoftExtensions:
patterns:
- "Microsoft.Extensions.*"
WindowsAppSDK:
patterns:
- "Microsoft.Graphics.Win2D"
- "Microsoft.Windows.SDK.BuildTools"
- "Microsoft.WindowsAppSDK"
xunit:
patterns:
- "xunit"
- "xunit.runner.*"
ignore:
- dependency-name: "MicrosoftMauiGraphicsVersion" # maestro
- dependency-name: "Microsoft.Maui.Graphics*" # maestro
Original file line number Diff line number Diff line change
@@ -15,7 +15,12 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
ref: main

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 8.x

- name: Run dotnet format
run: dotnet format .\Microsoft.Maui.sln --no-restore --exclude Templates/src BlazorWebView/src/SharedSource/BlazorWebViewDeveloperTools.cs BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs Graphics/src/Graphics.Win2D/W2DCanvas.cs Graphics/src/Graphics.Win2D/W2DExtensions.cs
@@ -40,4 +45,5 @@ jobs:
area/infrastructure 🏗️
assignees: rmarinho, jsuarezruiz
reviewers: rmarinho, jsuarezruiz
branch: housekeeping/fix-codeformatting
branch: housekeeping/fix-codeformatting
base: main
49 changes: 49 additions & 0 deletions .github/workflows/dotnet-format-daily-net7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Daily code format check net7.0 branch
on:
workflow_dispatch:
schedule:
- cron: 0 0 * * * # Every day at midnight (UTC)

permissions:
pull-requests: write
contents: write

jobs:
dotnet-format:
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: net7.0

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 7.0.304

- name: Run dotnet format
run: dotnet format .\Microsoft.Maui.sln --no-restore --exclude Templates/src BlazorWebView/src/SharedSource/BlazorWebViewDeveloperTools.cs BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs Graphics/src/Graphics.Win2D/W2DCanvas.cs Graphics/src/Graphics.Win2D/W2DExtensions.cs

- name: Commit files
if: steps.format.outputs.has-changes == 'true'
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -a -m 'Automated dotnet-format update'
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: '[housekeeping] Automated PR to fix formatting errors'
body: |
Automated PR to fix formatting errors
committer: GitHub <noreply@github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
labels: |
t/housekeeping ♻︎
area/infrastructure 🏗️
assignees: rmarinho, jsuarezruiz
reviewers: rmarinho, jsuarezruiz
branch: housekeeping/fix-codeformatting-net7.0
base: net7.0
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -159,6 +159,7 @@
<PackageOutputPath>$(MSBuildThisFileDirectory)artifacts</PackageOutputPath>
<LicenseFile>$(MSBuildThisFileDirectory)LICENSE.TXT</LicenseFile>
<PackageThirdPartyNoticesFile>$(MSBuildThisFileDirectory)THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile>
<ContinuousIntegrationBuild Condition=" '$(CI)' == 'true' ">true</ContinuousIntegrationBuild>
</PropertyGroup>
<!-- This target is replaced by GitInfo when restored. Allows Versions.targets to rely on it before restore. -->
<Target Name="GitVersion" />
5 changes: 4 additions & 1 deletion cSpell.json
Original file line number Diff line number Diff line change
@@ -6,7 +6,10 @@
"Skia",
"Resizetizer",
"nugets",
"netstandard"
"netstandard",
"Appium",
"XCUI",
"Automator"
],
"ignoreWords": [],
"patterns": [
93 changes: 93 additions & 0 deletions docs/design/UITesting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
UI Testing
===

# Introduction

Currently we are using [Appium](https://appium.io/docs/en/2.0/) to facilitate UI automation for Windows, Catalyst, iOS, and Android.
Appium relies on different implementations called `drivers` for each platform that have different behaviors/functions.
* Windows - [WinAppDriver](https://github.com/appium/appium-windows-driver)
* Catalyst - [mac2](https://github.com/appium/appium-mac2-driver)
* iOS - [XCUITest](https://github.com/appium/appium-xcuitest-driver)
* Android - [UIAutomator2](https://github.com/appium/appium-uiautomator2-driver)

## Creating a new test

### The sample project

The project that is used for UI Tests is located here: `src\Controls\samples\Controls.Sample.UITests\Controls.Sample.UITests.csproj`

There are two types of tests you can add, Issue and Gallery.

### Adding a new Issue

This will be the majority of new tests added which will be primarily for testing functionality and adding regression tests.

You will need to create some kind of UI to test against, which will go in the Controls.Sample.UITests project. Create a new class and attribute it with `[Issue]` and derive from `TestContentPage`.

Then in the Controls.AppiumTests project add a new class that derives from `_IssuesUITest` and add your test.

You can use the example for the sample project [here](https://github.com/dotnet/maui/blob/main/src/Controls/samples/Controls.Sample.UITests/Issues/RefreshViewPage.cs) and the example for the corresponding test [here](https://github.com/dotnet/maui/tree/main/src/Controls/tests/UITests/Tests/Issues/RefreshViewTests.cs).




### Adding a GalleryPage

Gallery tests are to make it easier to run the same set of tests on controls, if you are creating a new control you would want to add a new gallery page.

We have some base classes you can derive from to make setting this up easier: [CoreGalleryPage](https://github.com/dotnet/maui/blob/main/src/Controls/samples/Controls.Sample.UITests/CoreViews/CoreGalleryPage.cs) and [ContentViewGalleryPage](https://github.com/dotnet/maui/blob/main/src/Controls/samples/Controls.Sample.UITests/Elements/ContentViewGalleryPage.cs)

All controls you intend to interact with need to set the 'AutomationId' property as this will be what you use to query for the element.

Once you have created your GalleryPage, add it to [CorePageView](https://github.com/dotnet/maui/blob/5419846b1f20bdab1b5ce1dff40287edc5c38f12/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs#L45C41-L45C41) so that it will show up on the main page at launch.

### Adding the test

The project that hosts the tests is located here: `src\Controls\tests\UITests\Controls.AppiumTests.csproj`

This project is using [NUnit](https://nunit.org/)

All tests should derive from `UITestBase` and should override `FixtureSetup/FixtureTeardown` to navigate to the specific UI you want to test and navigate back when finished.

```csharp
protected override void FixtureSetup()
{
base.FixtureSetup();
App.NavigateToGallery(DragAndDropGallery);
}
```

```csharp
protected override void FixtureTeardown()
{
base.FixtureTeardown();
App.NavigateBack();
}
```

The test will have access to gestures/interactions through the `App` property.

```csharp
App.WaitForElement("btnLogin");
App.EnterText("entryUsername", "user@email.com");
App.EnterText("entryPassword", "Password");

App.Tap("btnLogin");
var lblStatus = App.WaitForElement("lblStatus").FirstOrDefault();
var text = lblStatus?.Text;

Assert.IsNotNull(text);
Assert.IsTrue(text.StartsWith("Logging in", StringComparison.CurrentCulture));
```

## Running tests

Please see the [wiki](https://github.com/dotnet/maui/wiki/UITests) for setting up/running tests.


## Adding new functionality

We are implementing the IApp interface from Xamarin UITests, the implementation of which is [here](https://github.com/dotnet/maui/blob/main/src/TestUtils/src/TestUtils.Appium.UITests/AppiumUITestApp.cs).

## Known Issues
- iOS doesn't support nested accessibility elements which will make some elements unreachable
Loading

0 comments on commit 2bf3d11

Please sign in to comment.