-
Notifications
You must be signed in to change notification settings - Fork 285
Add Maui Mobile Testing to the perf repo (port from release/7.0 Test) #2813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
LoopedBard3
merged 5 commits into
dotnet:main
from
LoopedBard3:AddMauiMobileTestingMain
Jan 20, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b97a007
Add Maui Mobile Testing to the perf repo (port from release/7.0 testi…
LoopedBard3 0ef1134
Fix reporter.cs build error.
LoopedBard3 118fe95
Moved stopAppCmd so it is available even if there is an error beforeh…
LoopedBard3 8167f16
Fixed nitpicks including using proper function naming conventions, mi…
LoopedBard3 68a5509
Added in missing requests import and removed it from places it is no …
LoopedBard3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| <Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test"> | ||
|
|
||
| <Import Project="Scenarios.Common.props" /> | ||
|
|
||
| <PropertyGroup> | ||
| <IncludeXHarnessCli>true</IncludeXHarnessCli> | ||
| <MicrosoftDotNetXHarnessCLIVersion>1.0.0-prerelease.21566.2</MicrosoftDotNetXHarnessCLIVersion> | ||
| <XharnessPath>%HELIX_CORRELATION_PAYLOAD%\microsoft.dotnet.xharness.cli\$(MicrosoftDotNetXHarnessCLIVersion)\tools\net6.0\any\Microsoft.DotNet.XHarness.CLI.dll</XharnessPath> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <AfterPreparePayloadWorkItemCommand>$(Python) post.py</AfterPreparePayloadWorkItemCommand> | ||
| <PreparePayloadOutDirectoryName>scenarios_out</PreparePayloadOutDirectoryName> | ||
| <PreparePayloadWorkItemBaseDirectory Condition="'$(TargetsWindows)' == 'true'">$(CorrelationPayloadDirectory)$(PreparePayloadOutDirectoryName)\</PreparePayloadWorkItemBaseDirectory> | ||
| <PreparePayloadWorkItemBaseDirectory Condition="'$(TargetsWindows)' != 'true'">$(CorrelationPayloadDirectory)$(PreparePayloadOutDirectoryName)/</PreparePayloadWorkItemBaseDirectory> | ||
| </PropertyGroup> | ||
|
|
||
| <Target Name="RemoveDotnetFromCorrelationStaging" BeforeTargets="BeforeTest"> | ||
| <Message Text="Removing Dotnet Packs from Correlation Staging" Importance="high" /> | ||
| <RemoveDir Directories="$(CorrelationPayloadDirectory)dotnet\packs" /> | ||
| </Target> | ||
|
|
||
| <ItemDefinitionGroup> | ||
| <HelixWorkItem> | ||
| <Timeout>00:30</Timeout> | ||
| </HelixWorkItem> | ||
| </ItemDefinitionGroup> | ||
|
|
||
| <ItemGroup> | ||
| <MAUIAndroidScenario Include="Maui Android Default"> | ||
| <ScenarioDirectoryName>mauiandroid</ScenarioDirectoryName> | ||
| <PayloadDirectory>$(ScenariosDir)%(ScenarioDirectoryName)</PayloadDirectory> | ||
| <ApkName>com.companyname.mauiandroiddefault-Signed</ApkName> | ||
| <PackageName>com.companyname.mauiandroiddefault</PackageName> | ||
| </MAUIAndroidScenario> | ||
| <MAUIAndroidScenario Include="Maui Android Podcast"> | ||
| <ScenarioDirectoryName>mauiandroidpodcast</ScenarioDirectoryName> | ||
| <PayloadDirectory>$(ScenariosDir)%(ScenarioDirectoryName)</PayloadDirectory> | ||
| <ApkName>com.Microsoft.NetConf2021.Maui-Signed</ApkName> | ||
| <PackageName>com.Microsoft.NetConf2021.Maui</PackageName> | ||
| </MAUIAndroidScenario> | ||
| <MAUIAndroidScenario Include="Maui Blazor Android Default"> | ||
| <ScenarioDirectoryName>mauiblazorandroid</ScenarioDirectoryName> | ||
| <PayloadDirectory>$(ScenariosDir)%(ScenarioDirectoryName)</PayloadDirectory> | ||
| <ApkName>com.companyname.mauiblazorandroiddefault-Signed</ApkName> | ||
| <PackageName>com.companyname.mauiblazorandroiddefault</PackageName> | ||
| </MAUIAndroidScenario> | ||
| </ItemGroup> | ||
|
|
||
|
|
||
| <ItemGroup> | ||
| <PreparePayloadWorkItem Include="@(MAUIAndroidScenario)"> | ||
| <Command>$(Python) pre.py publish -f $(PERFLAB_Framework)-android -o $(PreparePayloadWorkItemBaseDirectory)%(PreparePayloadWorkItem.ScenarioDirectoryName) -r android-arm64 --self-contained</Command> | ||
| <WorkingDirectory>%(PreparePayloadWorkItem.PayloadDirectory)</WorkingDirectory> | ||
| </PreparePayloadWorkItem> | ||
| </ItemGroup> | ||
|
|
||
|
|
||
| <!-- We only run the android tests from Windows machines (at least for now) --> | ||
| <ItemGroup> | ||
| <HelixWorkItem Include="@(MAUIAndroidScenario -> 'SOD - %(Identity) APK Size')"> | ||
| <PreCommands>echo on; xcopy %HELIX_CORRELATION_PAYLOAD%\$(PreparePayloadOutDirectoryName)\%(HelixWorkItem.ScenarioDirectoryName) %HELIX_WORKITEM_ROOT%\pub\ /E /I /Y</PreCommands> | ||
| <Command>$(Python) test.py sod --scenario-name "%(Identity)"</Command> | ||
| </HelixWorkItem> | ||
| <HelixWorkItem Include="@(MAUIAndroidScenario -> 'SOD - %(Identity) Extracted Size')"> | ||
| <PreCommands>echo on; xcopy %HELIX_CORRELATION_PAYLOAD%\$(PreparePayloadOutDirectoryName)\%(HelixWorkItem.ScenarioDirectoryName) %HELIX_WORKITEM_ROOT%\pub\ /E /I /Y; ren %HELIX_WORKITEM_ROOT%\pub\%(HelixWorkItem.ApkName).apk %(HelixWorkItem.ApkName).zip; powershell.exe -nologo -noprofile -command "& {Expand-Archive %HELIX_WORKITEM_ROOT%\pub\%(HelixWorkItem.ApkName).zip -DestinationPath %HELIX_WORKITEM_ROOT%\pub\}"; del %HELIX_WORKITEM_ROOT%\pub\%(HelixWorkItem.ApkName).zip</PreCommands> | ||
| <Command>$(Python) test.py sod --scenario-name "%(Identity)"</Command> | ||
| </HelixWorkItem> | ||
| <HelixWorkItem Include="@(MAUIAndroidScenario -> 'Device Startup - %(Identity)')"> | ||
| <PreCommands>echo on; set XHARNESSPATH=$(XharnessPath); xcopy %HELIX_CORRELATION_PAYLOAD%\$(PreparePayloadOutDirectoryName)\%(HelixWorkItem.ScenarioDirectoryName) %HELIX_WORKITEM_ROOT%\pub\ /E /I /Y</PreCommands> | ||
| <Command>$(Python) test.py devicestartup --device-type android --package-path pub\%(HelixWorkItem.ApkName).apk --package-name %(HelixWorkItem.PackageName) --scenario-name "%(Identity)"</Command> | ||
| </HelixWorkItem> | ||
| <HelixWorkItem Include="@(MAUIAndroidScenario -> 'Device Startup - %(Identity) NoAnimation')"> | ||
| <PreCommands>echo on; set XHARNESSPATH=$(XharnessPath); xcopy %HELIX_CORRELATION_PAYLOAD%\$(PreparePayloadOutDirectoryName)\%(HelixWorkItem.ScenarioDirectoryName) %HELIX_WORKITEM_ROOT%\pub\ /E /I /Y</PreCommands> | ||
| <Command>$(Python) test.py devicestartup --device-type android --package-path pub\%(HelixWorkItem.ApkName).apk --package-name %(HelixWorkItem.PackageName) --scenario-name "%(Identity)" --disable-animations</Command> | ||
| </HelixWorkItem> | ||
| </ItemGroup> | ||
|
|
||
|
|
||
| <Import Project="PreparePayloadWorkItems.targets" /> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ''' | ||
| post cleanup script | ||
| ''' | ||
|
|
||
| from shared.postcommands import clean_directories | ||
| from performance.common import remove_directory | ||
|
|
||
| remove_directory("dotnet-podcasts") | ||
| clean_directories() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| ''' | ||
| pre-command | ||
| ''' | ||
| import subprocess | ||
| from performance.logger import setup_loggers, getLogger | ||
| from shared.precommands import PreCommands | ||
| from shared.mauisharedpython import remove_aab_files, install_versioned_maui | ||
| from shared.versionmanager import versions_write_json, get_version_from_dll_powershell | ||
| from shared import const | ||
|
|
||
| setup_loggers(True) | ||
| precommands = PreCommands() | ||
| install_versioned_maui(precommands) | ||
|
|
||
| branch = f'{precommands.framework[:6]}' | ||
| subprocess.run(['git', 'clone', 'https://github.com/microsoft/dotnet-podcasts.git', '-b', branch, '--single-branch', '--depth', '1']) | ||
| subprocess.run(['powershell', '-Command', r'Remove-Item -Path .\\dotnet-podcasts\\.git -Recurse -Force']) # Git files have permission issues, do their deletion separately | ||
|
|
||
| precommands.existing(projectdir='./dotnet-podcasts', projectfile='./src/Mobile/Microsoft.NetConf2021.Maui.csproj') | ||
|
|
||
| # Build the APK | ||
| precommands._restore() | ||
| precommands.execute(['--no-restore']) | ||
|
|
||
| # Remove the aab files as we don't need them, this saves space | ||
| output_dir = const.PUBDIR | ||
| if precommands.output: | ||
| output_dir = precommands.output | ||
| remove_aab_files(output_dir) | ||
|
|
||
| # Copy the MauiVersion to a file so we have it on the machine | ||
| maui_version = get_version_from_dll_powershell(rf".\{const.APPDIR}\obj\Release\{precommands.framework}\{precommands.runtime_identifier}\linked\Microsoft.Maui.dll") | ||
| version_dict = { "mauiVersion": maui_version } | ||
| versions_write_json(version_dict, rf"{output_dir}\versions.json") | ||
| print(f"Versions: {version_dict}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ''' | ||
| Mobile Maui App | ||
| ''' | ||
| from shared.const import PUBDIR | ||
| from shared.runner import TestTraits, Runner | ||
| from shared.versionmanager import versions_read_json_file_save_env | ||
|
|
||
| EXENAME = 'MauiAndroidPodcast' | ||
|
|
||
| if __name__ == "__main__": | ||
| versions_read_json_file_save_env(rf".\{PUBDIR}\versions.json") | ||
|
|
||
| traits = TestTraits(exename=EXENAME, | ||
| guiapp='false', | ||
| ) | ||
| Runner(traits).run() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.