-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added WinUI InfoBar support and ability to maximise Windows application
- Loading branch information
1 parent
b39c6f5
commit decd6e9
Showing
23 changed files
with
178 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
2 changes: 0 additions & 2 deletions
2
samples/XamlControlsGallery/Pages/MenusAndToolbars/MenuBarPage.cs
This file contains 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 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 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
27 changes: 27 additions & 0 deletions
27
samples/XamlControlsGallery/Pages/StatusAndInfo/InfoBarPage.cs
This file contains 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,27 @@ | ||
namespace XamlControlsGallery.Pages.StatusAndInfo | ||
{ | ||
using Legerity.Pages; | ||
using Legerity.Windows.Elements.WinUI; | ||
using Legerity.Windows.Extensions; | ||
using OpenQA.Selenium; | ||
|
||
/// <summary> | ||
/// Defines the InfoBar page of the XAML Controls Gallery application. | ||
/// </summary> | ||
public class InfoBarPage : BasePage | ||
{ | ||
private readonly By closableBarWithOptsQuery = ByExtensions.AutomationId("TestInfoBar1"); | ||
|
||
/// <summary> | ||
/// Gets a given trait of the page to verify that the page is in view. | ||
/// </summary> | ||
protected override By Trait => By.XPath(".//*[@Name='InfoBar'][@AutomationId='TitleTextBlock']"); | ||
|
||
public InfoBarPage CloseClosableBarWithOptions() | ||
{ | ||
InfoBar closeableBarWithOpts = this.WindowsApp.FindElement(this.closableBarWithOptsQuery); | ||
closeableBarWithOpts.Close(); | ||
return this; | ||
} | ||
} | ||
} |
This file contains 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 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 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 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
5 changes: 0 additions & 5 deletions
5
samples/XamlControlsGallery/Tests/MenusAndToolbars/MenuBarTests.cs
This file contains 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 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
25 changes: 25 additions & 0 deletions
25
samples/XamlControlsGallery/Tests/StatusAndInfo/InfoBarTests.cs
This file contains 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,25 @@ | ||
namespace XamlControlsGallery.Tests.StatusAndInfo | ||
{ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Pages; | ||
using Pages.StatusAndInfo; | ||
|
||
[TestClass] | ||
public class InfoBarTests : BaseTestClass | ||
{ | ||
private static InfoBarPage InfoBarPage { get; set; } | ||
|
||
[TestInitialize] | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
InfoBarPage = new NavigationMenu().GoToInfoBarPage(); | ||
} | ||
|
||
[TestMethod] | ||
public void CloseClosableBarWithOptions() | ||
{ | ||
InfoBarPage.CloseClosableBarWithOptions(); | ||
} | ||
} | ||
} |
This file contains 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 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 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,90 @@ | ||
namespace Legerity.Windows.Elements.WinUI | ||
{ | ||
using Core; | ||
using Extensions; | ||
using OpenQA.Selenium.Appium; | ||
using OpenQA.Selenium.Appium.Windows; | ||
|
||
/// <summary> | ||
/// Defines a <see cref="WindowsElement"/> wrapper for the WinUI InfoBar control. | ||
/// </summary> | ||
public class InfoBar : WindowsElementWrapper | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InfoBar"/> class. | ||
/// </summary> | ||
/// <param name="element"> | ||
/// The <see cref="WindowsElement"/> reference. | ||
/// </param> | ||
public InfoBar(WindowsElement element) | ||
: base(element) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Gets the title of the info bar. | ||
/// </summary> | ||
public string Title => this.TitleTextBlock.Text; | ||
|
||
/// <summary> | ||
/// Gets the message of the info bar. | ||
/// </summary> | ||
public string Message => this.MessageTextBlock.Text; | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether the info bar is open. | ||
/// </summary> | ||
public bool IsOpen => !bool.Parse(this.Element.GetAttribute("IsOffscreen")); | ||
|
||
/// <summary> | ||
/// Gets the element associated with the title <see cref="TextBlock"/>. | ||
/// </summary> | ||
public TextBlock TitleTextBlock => this.FindElement(ByExtensions.AutomationId("Title")); | ||
|
||
/// <summary> | ||
/// Gets the element associated with the message <see cref="TextBlock"/>. | ||
/// </summary> | ||
public TextBlock MessageTextBlock => this.FindElement(ByExtensions.AutomationId("Message")); | ||
|
||
/// <summary> | ||
/// Gets the element associated with the close <see cref="Button"/>. | ||
/// </summary> | ||
public Button CloseButton => this.FindElement(ByExtensions.AutomationId("CloseButton")); | ||
|
||
/// <summary> | ||
/// Allows conversion of a <see cref="WindowsElement"/> to the <see cref="InfoBar"/> without direct casting. | ||
/// </summary> | ||
/// <param name="element"> | ||
/// The <see cref="WindowsElement"/>. | ||
/// </param> | ||
/// <returns> | ||
/// The <see cref="InfoBar"/>. | ||
/// </returns> | ||
public static implicit operator InfoBar(WindowsElement element) | ||
{ | ||
return new InfoBar(element); | ||
} | ||
|
||
/// <summary> | ||
/// Allows conversion of a <see cref="AppiumWebElement"/> to the <see cref="InfoBar"/> without direct casting. | ||
/// </summary> | ||
/// <param name="element"> | ||
/// The <see cref="AppiumWebElement"/>. | ||
/// </param> | ||
/// <returns> | ||
/// The <see cref="InfoBar"/>. | ||
/// </returns> | ||
public static implicit operator InfoBar(AppiumWebElement element) | ||
{ | ||
return new InfoBar(element as WindowsElement); | ||
} | ||
|
||
/// <summary> | ||
/// Closes the info bar. | ||
/// </summary> | ||
public void Close() | ||
{ | ||
this.CloseButton.Click(); | ||
} | ||
} | ||
} |
This file contains 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 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
Oops, something went wrong.