From 5f551a2dd9f178b5272c54d0b29af18d55a43f77 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 9 Mar 2021 23:07:34 +0100 Subject: [PATCH] Make integration tests ordered. --- build/XUnit.props | 18 ++++++------- .../Avalonia.IntegrationTests.Win32.csproj | 1 + .../ButtonTests.cs | 26 +++++++------------ .../ComboBoxTests.cs | 26 +++++++------------ .../DefaultCollection.cs | 9 +++++++ .../TestAppCollection.cs | 9 ------- 6 files changed, 39 insertions(+), 50 deletions(-) create mode 100644 tests/Avalonia.IntegrationTests.Win32/DefaultCollection.cs delete mode 100644 tests/Avalonia.IntegrationTests.Win32/TestAppCollection.cs diff --git a/build/XUnit.props b/build/XUnit.props index a75e1bac86..17ead91aa3 100644 --- a/build/XUnit.props +++ b/build/XUnit.props @@ -1,14 +1,14 @@  - - - - - - - - - + + + + + + + + + diff --git a/tests/Avalonia.IntegrationTests.Win32/Avalonia.IntegrationTests.Win32.csproj b/tests/Avalonia.IntegrationTests.Win32/Avalonia.IntegrationTests.Win32.csproj index 0967944e19..f38f8b0ce1 100644 --- a/tests/Avalonia.IntegrationTests.Win32/Avalonia.IntegrationTests.Win32.csproj +++ b/tests/Avalonia.IntegrationTests.Win32/Avalonia.IntegrationTests.Win32.csproj @@ -7,6 +7,7 @@ + diff --git a/tests/Avalonia.IntegrationTests.Win32/ButtonTests.cs b/tests/Avalonia.IntegrationTests.Win32/ButtonTests.cs index e8548430f3..b0d300e9fe 100644 --- a/tests/Avalonia.IntegrationTests.Win32/ButtonTests.cs +++ b/tests/Avalonia.IntegrationTests.Win32/ButtonTests.cs @@ -3,17 +3,23 @@ using Xunit; namespace Avalonia.IntegrationTests.Win32 { - [Collection("IntegrationTestApp collection")] + [Collection("Default")] public class ButtonTests { private WindowsDriver _session; - public ButtonTests(TestAppFixture fixture) => _session = fixture.Session; + + public ButtonTests(TestAppFixture fixture) + { + _session = fixture.Session; + + var tabs = _session.FindElementByAccessibilityId("MainTabs"); + var tab = tabs.FindElementByName("Button"); + tab.Click(); + } [Fact] public void DisabledButton() { - SelectTab(); - var button = _session.FindElementByAccessibilityId("DisabledButton"); Assert.Equal("Disabled Button", button.Text); @@ -23,8 +29,6 @@ namespace Avalonia.IntegrationTests.Win32 [Fact] public void BasicButton() { - SelectTab(); - var button = _session.FindElementByAccessibilityId("BasicButton"); Assert.Equal("Basic Button", button.Text); @@ -34,19 +38,9 @@ namespace Avalonia.IntegrationTests.Win32 [Fact] public void ButtonWithTextBlock() { - SelectTab(); - var button = _session.FindElementByAccessibilityId("ButtonWithTextBlock"); Assert.Equal("Button with TextBlock", button.Text); } - - private WindowsElement SelectTab() - { - var tabs = _session.FindElementByAccessibilityId("MainTabs"); - var tab = tabs.FindElementByName("Button"); - tab.Click(); - return (WindowsElement)tab; - } } } diff --git a/tests/Avalonia.IntegrationTests.Win32/ComboBoxTests.cs b/tests/Avalonia.IntegrationTests.Win32/ComboBoxTests.cs index 95ca1ed14a..6764343c02 100644 --- a/tests/Avalonia.IntegrationTests.Win32/ComboBoxTests.cs +++ b/tests/Avalonia.IntegrationTests.Win32/ComboBoxTests.cs @@ -3,17 +3,23 @@ using Xunit; namespace Avalonia.IntegrationTests.Win32 { - [Collection("IntegrationTestApp collection")] + [Collection("Default")] public class ComboBoxTests { private WindowsDriver _session; - public ComboBoxTests(TestAppFixture fixture) => _session = fixture.Session; + + public ComboBoxTests(TestAppFixture fixture) + { + _session = fixture.Session; + + var tabs = _session.FindElementByAccessibilityId("MainTabs"); + var tab = tabs.FindElementByName("ComboBox"); + tab.Click(); + } [Fact] public void UnselectedComboBox() { - SelectTab(); - var comboBox = _session.FindElementByAccessibilityId("UnselectedComboBox"); Assert.Equal(string.Empty, comboBox.Text); @@ -27,8 +33,6 @@ namespace Avalonia.IntegrationTests.Win32 [Fact] public void SelectedIndex0ComboBox() { - SelectTab(); - var comboBox = _session.FindElementByAccessibilityId("SelectedIndex0ComboBox"); Assert.Equal("Foo", comboBox.Text); @@ -37,19 +41,9 @@ namespace Avalonia.IntegrationTests.Win32 [Fact] public void SelectedIndex1ComboBox() { - SelectTab(); - var comboBox = _session.FindElementByAccessibilityId("SelectedIndex1ComboBox"); Assert.Equal("Bar", comboBox.Text); } - - private WindowsElement SelectTab() - { - var tabs = _session.FindElementByAccessibilityId("MainTabs"); - var tab = tabs.FindElementByName("ComboBox"); - tab.Click(); - return (WindowsElement)tab; - } } } diff --git a/tests/Avalonia.IntegrationTests.Win32/DefaultCollection.cs b/tests/Avalonia.IntegrationTests.Win32/DefaultCollection.cs new file mode 100644 index 0000000000..1c8f09a430 --- /dev/null +++ b/tests/Avalonia.IntegrationTests.Win32/DefaultCollection.cs @@ -0,0 +1,9 @@ +using Xunit; + +namespace Avalonia.IntegrationTests.Win32 +{ + [CollectionDefinition("Default")] + public class DefaultCollection : ICollectionFixture + { + } +} diff --git a/tests/Avalonia.IntegrationTests.Win32/TestAppCollection.cs b/tests/Avalonia.IntegrationTests.Win32/TestAppCollection.cs deleted file mode 100644 index 6461e14596..0000000000 --- a/tests/Avalonia.IntegrationTests.Win32/TestAppCollection.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Xunit; - -namespace Avalonia.IntegrationTests.Win32 -{ - [CollectionDefinition("IntegrationTestApp collection")] - public class TestAppCollection : ICollectionFixture - { - } -}