3 changed files with 165 additions and 94 deletions
@ -1,98 +1,139 @@ |
|||||
<Window xmlns="https://github.com/avaloniaui" |
<Window |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
x:Class="IntegrationTestApp.MainWindow" |
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
xmlns="https://github.com/avaloniaui" |
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
x:Class="IntegrationTestApp.MainWindow" |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
Title="IntegrationTestApp"> |
Title="IntegrationTestApp" |
||||
<NativeMenu.Menu> |
d:DesignHeight="450" |
||||
<NativeMenu> |
d:DesignWidth="800" |
||||
<NativeMenuItem Header="File"> |
mc:Ignorable="d"> |
||||
|
<NativeMenu.Menu> |
||||
<NativeMenu> |
<NativeMenu> |
||||
<NativeMenuItem Header="Open..."/> |
<NativeMenuItem Header="File"> |
||||
|
<NativeMenu> |
||||
|
<NativeMenuItem Header="Open..." /> |
||||
|
</NativeMenu> |
||||
|
</NativeMenuItem> |
||||
|
<NativeMenuItem Header="View"> |
||||
|
<NativeMenu /> |
||||
|
</NativeMenuItem> |
||||
</NativeMenu> |
</NativeMenu> |
||||
</NativeMenuItem> |
</NativeMenu.Menu> |
||||
<NativeMenuItem Header="View"> |
<DockPanel> |
||||
<NativeMenu/> |
<NativeMenuBar DockPanel.Dock="Top" /> |
||||
</NativeMenuItem> |
|
||||
</NativeMenu> |
|
||||
</NativeMenu.Menu> |
|
||||
<DockPanel> |
|
||||
<NativeMenuBar DockPanel.Dock="Top"/> |
|
||||
|
|
||||
<TabControl TabStripPlacement="Left" Name="MainTabs"> |
<TabControl Name="MainTabs" TabStripPlacement="Left"> |
||||
<TabItem Header="Automation"> |
<TabItem Header="Automation"> |
||||
<StackPanel> |
<StackPanel> |
||||
<TextBlock Name="TextBlockWithName">TextBlockWithName</TextBlock> |
<TextBlock Name="TextBlockWithName">TextBlockWithName</TextBlock> |
||||
<TextBlock Name="NotTheAutomationId" AutomationProperties.AutomationId="TextBlockWithNameAndAutomationId"> |
<TextBlock Name="NotTheAutomationId" AutomationProperties.AutomationId="TextBlockWithNameAndAutomationId"> |
||||
TextBlockWithNameAndAutomationId |
TextBlockWithNameAndAutomationId |
||||
</TextBlock> |
</TextBlock> |
||||
<TextBlock Name="TextBlockAsLabel">Label for TextBox</TextBlock> |
<TextBlock Name="TextBlockAsLabel">Label for TextBox</TextBlock> |
||||
<TextBox Name="LabeledByTextBox" AutomationProperties.LabeledBy="{Binding #TextBlockAsLabel}"> |
<TextBox Name="LabeledByTextBox" AutomationProperties.LabeledBy="{Binding #TextBlockAsLabel}"> |
||||
Foo |
Foo |
||||
</TextBox> |
</TextBox> |
||||
</StackPanel> |
</StackPanel> |
||||
</TabItem> |
</TabItem> |
||||
|
|
||||
<TabItem Header="Button" Name="buttons"> |
<TabItem Name="buttons" Header="Button"> |
||||
<StackPanel> |
<StackPanel> |
||||
<Button Name="DisabledButton" IsEnabled="False"> |
<Button Name="DisabledButton" IsEnabled="False"> |
||||
Disabled Button |
Disabled Button |
||||
</Button> |
</Button> |
||||
<Button Name="BasicButton"> |
<Button Name="BasicButton"> |
||||
Basic Button |
Basic Button |
||||
</Button> |
</Button> |
||||
<Button Name="ButtonWithTextBlock"> |
<Button Name="ButtonWithTextBlock"> |
||||
<TextBlock>Button with TextBlock</TextBlock> |
<TextBlock>Button with TextBlock</TextBlock> |
||||
</Button> |
</Button> |
||||
<Button Name="ButtonWithAcceleratorKey" HotKey="Ctrl+B">Button with Accelerator Key</Button> |
<Button Name="ButtonWithAcceleratorKey" HotKey="Ctrl+B">Button with Accelerator Key</Button> |
||||
<RepeatButton Name="RepeatButton"> |
<RepeatButton Name="RepeatButton"> |
||||
<TextBlock Name="RepeatButtonTextBlock" Text="Repeat Button: 0" /> |
<TextBlock Name="RepeatButtonTextBlock" Text="Repeat Button: 0" /> |
||||
</RepeatButton> |
</RepeatButton> |
||||
</StackPanel> |
</StackPanel> |
||||
</TabItem> |
</TabItem> |
||||
|
|
||||
<TabItem Header="CheckBox"> |
<TabItem Header="CheckBox"> |
||||
<StackPanel> |
<StackPanel> |
||||
<CheckBox Name="UncheckedCheckBox">Unchecked</CheckBox> |
<CheckBox Name="UncheckedCheckBox">Unchecked</CheckBox> |
||||
<CheckBox Name="CheckedCheckBox" IsChecked="True">Checked</CheckBox> |
<CheckBox Name="CheckedCheckBox" IsChecked="True">Checked</CheckBox> |
||||
<CheckBox Name="ThreeStateCheckBox" IsThreeState="True" IsChecked="{x:Null}">ThreeState</CheckBox> |
<CheckBox |
||||
</StackPanel> |
Name="ThreeStateCheckBox" |
||||
</TabItem> |
IsChecked="{x:Null}" |
||||
|
IsThreeState="True"> |
||||
|
ThreeState |
||||
|
</CheckBox> |
||||
|
</StackPanel> |
||||
|
</TabItem> |
||||
|
|
||||
<TabItem Header="ComboBox"> |
<TabItem Header="ComboBox"> |
||||
<StackPanel> |
<StackPanel> |
||||
<ComboBox Name="BasicComboBox"> |
<ComboBox Name="BasicComboBox"> |
||||
<ComboBoxItem>Item 0</ComboBoxItem> |
<ComboBoxItem>Item 0</ComboBoxItem> |
||||
<ComboBoxItem>Item 1</ComboBoxItem> |
<ComboBoxItem>Item 1</ComboBoxItem> |
||||
</ComboBox> |
</ComboBox> |
||||
<Button Name="ComboBoxSelectionClear">Clear Selection</Button> |
<Button Name="ComboBoxSelectionClear">Clear Selection</Button> |
||||
<Button Name="ComboBoxSelectFirst">Select First</Button> |
<Button Name="ComboBoxSelectFirst">Select First</Button> |
||||
</StackPanel> |
</StackPanel> |
||||
</TabItem> |
</TabItem> |
||||
|
|
||||
<TabItem Header="ListBox"> |
<TabItem Header="ContextMenu"> |
||||
<DockPanel> |
<TextBlock Name="ContextMenuTb" Text="Right click me"> |
||||
<StackPanel DockPanel.Dock="Bottom"> |
<TextBlock.ContextMenu> |
||||
<Button Name="ListBoxSelectionClear">Clear Selection</Button> |
<ContextMenu Name="ContextMenuTest"> |
||||
</StackPanel> |
<MenuItem Header="Standard _Menu Item" InputGesture="Ctrl+A" /> |
||||
<ListBox Name="BasicListBox" Items="{Binding ListBoxItems}" SelectionMode="Multiple"/> |
<MenuItem |
||||
</DockPanel> |
Header="_Disabled Menu Item" |
||||
</TabItem> |
InputGesture="Ctrl+D" |
||||
|
IsEnabled="False" /> |
||||
|
<Separator /> |
||||
|
<MenuItem Name="RootMenuItem2" Header="Menu with _Submenu"> |
||||
|
<MenuItem Header="Submenu _1"> |
||||
|
<MenuItem Header="Submenu" /> |
||||
|
</MenuItem> |
||||
|
<MenuItem Header="Submenu _2" /> |
||||
|
</MenuItem> |
||||
|
<MenuItem Header="Menu Item that won't close on click" StaysOpenOnClick="True" /> |
||||
|
</ContextMenu> |
||||
|
</TextBlock.ContextMenu> |
||||
|
</TextBlock> |
||||
|
|
||||
<TabItem Header="Menu"> |
</TabItem> |
||||
<DockPanel> |
|
||||
<Menu DockPanel.Dock="Top"> |
<TabItem Header="ListBox"> |
||||
<MenuItem Name="RootMenuItem" Header="_Root"> |
<DockPanel> |
||||
<MenuItem Name="Child1MenuItem" Header="_Child 1" InputGesture="Ctrl+O" Click="MenuClicked"/> |
<StackPanel DockPanel.Dock="Bottom"> |
||||
<MenuItem Name="Child2MenuItem" Header="_Child 1"> |
<Button Name="ListBoxSelectionClear">Clear Selection</Button> |
||||
<MenuItem Name="GrandchildMenuItem" Header="_Grandchild" Click="MenuClicked"/> |
</StackPanel> |
||||
</MenuItem> |
<ListBox |
||||
</MenuItem> |
Name="BasicListBox" |
||||
</Menu> |
Items="{Binding ListBoxItems}" |
||||
<TextBlock Name="ClickedMenuItem">None</TextBlock> |
SelectionMode="Multiple" /> |
||||
</DockPanel> |
</DockPanel> |
||||
</TabItem> |
</TabItem> |
||||
</TabControl> |
|
||||
</DockPanel> |
<TabItem Header="Menu"> |
||||
|
<DockPanel> |
||||
|
<Menu DockPanel.Dock="Top"> |
||||
|
<MenuItem Name="RootMenuItem" Header="_Root"> |
||||
|
<MenuItem |
||||
|
Name="Child1MenuItem" |
||||
|
Click="MenuClicked" |
||||
|
Header="_Child 1" |
||||
|
InputGesture="Ctrl+O" /> |
||||
|
<MenuItem Name="Child2MenuItem" Header="_Child 1"> |
||||
|
<MenuItem |
||||
|
Name="GrandchildMenuItem" |
||||
|
Click="MenuClicked" |
||||
|
Header="_Grandchild" /> |
||||
|
</MenuItem> |
||||
|
</MenuItem> |
||||
|
</Menu> |
||||
|
<TextBlock Name="ClickedMenuItem">None</TextBlock> |
||||
|
</DockPanel> |
||||
|
</TabItem> |
||||
|
</TabControl> |
||||
|
</DockPanel> |
||||
</Window> |
</Window> |
||||
|
|||||
@ -0,0 +1,31 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using OpenQA.Selenium.Appium; |
||||
|
using OpenQA.Selenium.Interactions; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Avalonia.IntegrationTests.Appium |
||||
|
{ |
||||
|
[Collection("Default")] |
||||
|
public class ContextMenuTests |
||||
|
{ |
||||
|
private readonly AppiumDriver<AppiumWebElement> _session; |
||||
|
|
||||
|
public ContextMenuTests(TestAppFixture fixture) |
||||
|
{ |
||||
|
_session = fixture.Session; |
||||
|
|
||||
|
var tabs = _session.FindElementByAccessibilityId("MainTabs"); |
||||
|
var tab = tabs.FindElementByName("ContextMenu"); |
||||
|
tab.Click(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void ContextMenu_Click() |
||||
|
{ |
||||
|
var rootMenuItem = _session.FindElementByAccessibilityId("ContextMenuTb"); |
||||
|
rootMenuItem.Click(); |
||||
|
new Actions(rootMenuItem.WrappedDriver).ContextClick().Perform(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue