Forum Xamarin.Forms

Hamburger menu AutomationId for UI Testing.

toyinstoyins USMember ✭✭✭

I'm trying to run a UI Test on a page (About.xaml).
Below are the steps to get to the page when the application loads.
1. Launch the Login Screen
2. User enters username
3. User enters password
4. User clicks on the Login Button
5. User lands on the Home Page in an AppShell.
6. User clicks on the Hamburger menu
7. User clicks on the About Menu in the Flyout Menu Items.

My question is, how do I set the Automation Id for the Hamburger Menu (Flyout Menu) of the AppShell?

Here's the UI Test Case.

    public async Task AboutPage_UITest()

        app.EnterText("UsernameEntryId", "user1");
        app.EnterText("PasswordEntryId", "[email protected]");

        app.Tap(x => x.Marked("LoginButtonId"));

        app.Tap(x => x.Marked("AppShellId"));
        //app.Tap(c => c.Class("OverflowMenuButton"));  I tried this as well but no luck.
        await Task.Delay(30000);

        app.Tap(x => x.Marked("AboutId"));


        var appResult = app.Query("EmailId").First(result => result.Text == "[email protected]");
        Assert.IsTrue(appResult != null, "Label is not displaying the right result!");

        app.Screenshot("About Page");

In the AppShell.xaml, here's the top section.

            <Shell xmlns=""
                     Shell.ItemTemplate="{StaticResource FlyoutTemplate}"
                     Shell.MenuItemTemplate="{StaticResource FlyoutTemplate}"
Sign In or Register to comment.