Browse Source

Added failing test for #9565.

And another (passing) test for checking that window order is correct when a child window is shown in fullscreen.
pull/9566/head
Steven Kirk 3 years ago
parent
commit
f480455131
  1. 7
      samples/IntegrationTestApp/MainWindow.axaml
  2. 3
      samples/IntegrationTestApp/MainWindow.axaml.cs
  3. 74
      tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

7
samples/IntegrationTestApp/MainWindow.axaml

@ -17,11 +17,15 @@
</NativeMenuItem>
<NativeMenuItem Header="View">
<NativeMenu/>
</NativeMenuItem>
</NativeMenuItem>
</NativeMenu>
</NativeMenu.Menu>
<DockPanel>
<NativeMenuBar DockPanel.Dock="Top"/>
<StackPanel DockPanel.Dock="Bottom" Margin="4" Orientation="Horizontal">
<TextBlock Margin="0,0,4,0">WindowState:</TextBlock>
<TextBlock Name="WindowState" Text="{Binding WindowState}"/>
</StackPanel>
<TabControl TabStripPlacement="Left" Name="MainTabs">
<TabItem Header="Automation">
@ -136,6 +140,7 @@
</ComboBox>
<Button Name="ShowWindow">Show Window</Button>
<Button Name="SendToBack">Send to Back</Button>
<Button Name="EnterFullscreen">Enter Fullscreen</Button>
<Button Name="ExitFullscreen">Exit Fullscreen</Button>
<Button Name="RestoreAll">Restore All</Button>
</StackPanel>

3
samples/IntegrationTestApp/MainWindow.axaml.cs

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
@ -178,6 +179,8 @@ namespace IntegrationTestApp
ShowWindow();
if (source?.Name == "SendToBack")
SendToBack();
if (source?.Name == "EnterFullscreen")
WindowState = WindowState.FullScreen;
if (source?.Name == "ExitFullscreen")
WindowState = WindowState.Normal;
if (source?.Name == "RestoreAll")

74
tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Avalonia.Controls;
using Avalonia.Utilities;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Interactions;
@ -114,6 +115,79 @@ namespace Avalonia.IntegrationTests.Appium
Assert.Equal(1, secondaryWindowIndex);
}
}
[PlatformFact(TestPlatforms.MacOS)]
public void WindowOrder_Owned_Dialog_Stays_InFront_Of_FullScreen_Parent()
{
var mainWindow = _session.FindElementByAccessibilityId("MainWindow");
// Enter fullscreen
mainWindow.FindElementByAccessibilityId("EnterFullscreen").Click();
// Wait for fullscreen transition.
Thread.Sleep(1000);
// Make sure we entered fullscreen.
var windowState = mainWindow.FindElementByAccessibilityId("WindowState");
Assert.Equal("FullScreen", windowState.Text);
// Open child window.
using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Owned, WindowStartupLocation.Manual))
{
mainWindow.SendClick();
var secondaryWindowIndex = GetWindowOrder("SecondaryWindow");
Assert.Equal(1, secondaryWindowIndex);
}
// Exit fullscreen by menu shortcut Command+R
mainWindow.FindElementByAccessibilityId("ExitFullscreen").Click();
// Wait for restore transition.
Thread.Sleep(1000);
// Make sure we exited fullscreen.
mainWindow = _session.FindElementByAccessibilityId("MainWindow");
windowState = mainWindow.FindElementByAccessibilityId("WindowState");
Assert.Equal("Normal", windowState.Text);
}
[PlatformFact(TestPlatforms.MacOS)]
public void Does_Not_Switch_Space_From_FullScreen_To_Main_Desktop_When_FullScreen_Window_Clicked()
{
// Issue #9565
var mainWindow = _session.FindElementByAccessibilityId("MainWindow");
AppiumWebElement windowState;
// Open child window.
using (OpenWindow(new PixelSize(200, 100), ShowWindowMode.Owned, WindowStartupLocation.Manual))
{
// Enter fullscreen
mainWindow.FindElementByAccessibilityId("EnterFullscreen").Click();
// Wait for fullscreen transition.
Thread.Sleep(1000);
// Make sure we entered fullscreen.
mainWindow = _session.FindElementByAccessibilityId("MainWindow");
windowState = mainWindow.FindElementByAccessibilityId("WindowState");
Assert.Equal("FullScreen", windowState.Text);
// Click on main window
mainWindow.Click();
// Failed here due to #9565: main window is no longer visible as the main space is now shown instead
// of the fullscreen space.
mainWindow.FindElementByAccessibilityId("ExitFullscreen").Click();
// Wait for restore transition.
Thread.Sleep(1000);
}
// Make sure we exited fullscreen.
mainWindow = _session.FindElementByAccessibilityId("MainWindow");
windowState = mainWindow.FindElementByAccessibilityId("WindowState");
Assert.Equal("Normal", windowState.Text);
}
[PlatformFact(TestPlatforms.MacOS)]
public void WindowOrder_NonOwned_Window_Does_Not_Stay_InFront_Of_Parent()

Loading…
Cancel
Save