Skip to content

Feature: Display test pages in testing app for single experiment head #67

@michael-hawker

Description

@michael-hawker

Describe the feature

When developing tests, it can be beneficial to see the test page to develop it, just like any other sample.

May also make debugging tests easier if a failure is happening and you want to see what the page looks like for the setup of a test.

The feature would be about adding additional tabs to the TabbedPage interface when running a component in the single-head mode for that component alone (wouldn't be included or do anything when run all-up as the all component mode).

Desired behavior

When running the single component head, you'd be able to open each test page like you do samples. (Eventually we may need better organization of the tabs here as components get more complex or add many samples/tests.)

When clicking on the tab, it'd just load the test page.

We wouldn't necessarily need to connect the driving test code to this, though it may be required to include the whole test project if more than just code for a page is used for testing, we wouldn't know the full implementation details.

Basically in the App.Head.props file we should include the component's test shared project code in this item group:

<ItemGroup Condition="'$(IsSingleExperimentHead)' == 'true' or '$(IsProjectTemplateHead)' == 'true'">
<!-- These are also included in the Samples props file, but added here to workaround https://github.com/unoplatform/uno/issues/2502 -->
<Content Include="$(MSBuildProjectDirectory)\..\..\samples\**\*.md" Exclude="$(MSBuildProjectDirectory)\..\..\samples\obj\**\*.md;$(MSBuildProjectDirectory)\..\..\samples\bin\**\*.md;$(MSBuildProjectDirectory)\..\..\**\SourceAssets\**\*.md" Link="SourceAssets/%(RecursiveDir)%(FileName)%(Extension)"/>
<Content Include="$(MSBuildProjectDirectory)\..\..\samples\**\*.xaml" Exclude="$(MSBuildProjectDirectory)\..\..\samples\obj\**\*.xaml;$(MSBuildProjectDirectory)\..\..\samples\bin\**\*.xaml;$(MSBuildProjectDirectory)\..\..\**\SourceAssets\**\*.xaml" Link="SourceAssets/%(RecursiveDir)%(FileName)%(Extension)"/>
<!-- Link/.dat is a workaround for https://github.com/unoplatform/uno/issues/8649 -->
<Content Include="$(MSBuildProjectDirectory)\..\..\samples\**\*.cs" Exclude="$(MSBuildProjectDirectory)\..\..\samples\obj\**\*.cs;$(MSBuildProjectDirectory)\..\..\samples\bin\**\*.cs">
<Link>SourceAssets/%(RecursiveDir)%(FileName)%(Extension).dat</Link>
</Content>
<!-- Include markdown files from all samples so the head can access them in the source generator -->
<AdditionalFiles Include="$(MSBuildProjectDirectory)\..\..\samples\*.md" Exclude="$(MSBuildProjectDirectory)\..\..\**\obj\**\*.md;$(MSBuildProjectDirectory)\..\..\**\bin\**\*.md"/>
</ItemGroup>

We'd also need to include the Log and VisualUITestBase classes that the test code may reference (we can't just include the test shared project as it has the App.xaml test head which would conflict with our app head code).

Ideally, we'd use a source generator again here to detect and index these test pages like we do for samples, then the TabbedPage would just get another bucket of pages and a template in order to show them. (We should probably define a class/record for passing info to the TabbedPage over the tuple we have now.)

Screenshots

No response

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Additional context

In the future, we could investigate a way to trigger running a test method against the page that it has been linked to in order to facilitate reproducing tests while being able to watch them or better interact with visual tree tools, etc... (this would probably require more information from a source generator to generate a look-up that's easier/faster to reference)

Help us help you

Yes, but only if others can assist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions