Context menu
Two kinds of right-click menu: the browser's own, and one drawn by the page.
What to practise
- Open the link in a new tab through the browser's menu, switch to it and read "Opened by: context".
- Right-click the grey area, choose an item from the page's menu and read the result.
In VAF: LetsSelectOptionFromRightClickMenu(1) for the browser's menu, LetsRightClick()
for the page's menu.
Tested in VAF-Demo
A test of this page from VAF-Demo: the whole VAF chain, from the page to the element, is in the test.
[Test]
public void PageMenuOpensOnRightClick()
{
SharedContext.App.Should().HaveSection<ContextMenuPage.PageMenu>()
.That.Should().HaveElement<ContextMenuPage.PageMenu.Area>()
.That.LetsRightClick();
SharedContext.App.Should().HaveSection<ContextMenuPage.PageMenu>()
.That.Should().HaveElement<ContextMenuPage.PageMenu.Rename>()
.That.AsButton().LetsClick()
.AndAlso().Should().HaveElement<ContextMenuPage.PageMenu.Result>()
.That.AsLabelText().Should().HaveValue("Rename");
}
On GitHub (opens in a new tab)
-
Page object
—
ContextMenuPage.cs: the locators of this page -
Native tests
—
ContextMenuTests.cs: the whole VAF chain in each test - The whole project and its README Latest test run (GitHub Actions)