Git Product home page Git Product logo

plugin.maui.uitesthelpers's Introduction

Plugin.Maui.UITestHelpers

Plugin.Maui.UITestHelpers provides a set of helpers to support UI testing your .NET MAUI app with Appium and migration from Xamarin.UITest to Appium. It consists of three packages, see below for more information.

The set of helpers are extracted from the .NET MAUI codebase (here, the folders prefixed UITest) this code can help with writing UI tests with Appium and/or transition your existing Xamarin.UITest tests to Appium.

Warning

At this time this project is not officially supported and experimental. Feel free to let us know your feedback and provide pull requests to make it even better. There is no guarantee this will become something more official.

But if you like what you see and help make it better... It might!

Install Plugin

This project consists of three packages. please find the details below. All packages are available on NuGet.

Package Name Description NuGet Package
Plugin.Maui.UITestHelpers.Core Shared, core types that are used across the different projects NuGet Version
Plugin.Maui.UITestHelpers.Appium This package contains code specific to UI testing with Appium. It's filled with helpers that will make writing UI tests easier, as well as methods that (mostly) mimic Xamarin.UITest to make transitioning your current UI tests easier NuGet Version
Plugin.Maui.UITestHelpers.NUnit This package contains helpers that will make it easier to write UI tests based on NUnit NuGet Version

Install with the dotnet CLI, for example: dotnet add package Plugin.Maui.UITestHelpers.Appium, or through the NuGet Package Manager in Visual Studio.

Supported Platforms

All platforms that are supported by the cross section of the support of Appium and .NET MAUI.

Acknowledgements

This project could not have came to be without these projects and people, thank you! <3

The original source was extracted from the .NET MAUI codebase so all credit goes out to that team, namely @sbanni, @mattleibow, @PureWeen, @MartyIX, @jsuarezruiz, @jfversluis and @rmarinho.

plugin.maui.uitesthelpers's People

Contributors

jfversluis avatar pictos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

plugin.maui.uitesthelpers's Issues

Make CI actually run UI Tests

Now that #3 has been resolved, set up a pipeline where the UI tests actually run on the build hosts with emulators/Simulators

Exception is thrown when trying to call CloseApp on all platforms other than Windows

When running UI tests on other targets than Windows the following exception will be thrown when trying to close an App with the App.CloseApp method:

System.MissingMethodException : Method not found: 'Void OpenQA.Selenium.Appium.AppiumDriver.CloseApp()'

This problem has already been fixed in the MAUI version of the code. Fixes can be found here:

https://github.com/dotnet/maui/blob/776dad91553c96ead0622da41b4c1ea8325b9fd0/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs#L64-L71 and here
https://github.com/dotnet/maui/blob/776dad91553c96ead0622da41b4c1ea8325b9fd0/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs#L148-L154

Even though the given code path is never actually run on Android, it seems like it trying to use reflection to verify the CloseApp method exist on the AppiumDriver, which it only does on the Windows implementation.

Currently I'm using this method to make sure the app is restarted between each of my test cases, as I have not been able to find a way to do it by parsing native Appium options through this test framework

How to always restart app between each individual UI test?

By looking at the code and behavior of this library, it seems like it is designed to run every test using the same app instance and navigate between different test pages. Is it possible to achieve, that it restarts the app between every test? Atm. if I close the app after each test it will make an assert in the teardown method here

[TearDown]
public void UITestBaseTearDown()
{
if (App.AppState == ApplicationState.NotRunning)
{
SaveDeviceDiagnosticInfo();
Reset();
FixtureSetup();
// Assert.Fail will immediately exit the test which is desirable as the app is not
// running anymore so we can't capture any UI structures or any screenshots
Assert.Fail("The app was expected to be running still, investigate as possible crash");
}
because it expect the app has unexpectedly crashed and then it tries to restart the app and fails the given test because of the assert.

I'm pretty new to using Appium UI tests as I'm only starting to migrate our existing UI tests from Xamarin.UITest so I might have missed something

On MacOS UIAutomation doesn't end

When running on macOS seems the UIAutomation keeps running after the tests are finished. This is special an issue if the agent is not recreated every time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.