Windows and tabs
A link that opens a new tab and a button that opens a new window. The page that opens has its own title and address.
- Title of the new page
Practice: child window — Vision Automation Framework- Address
/practice/windows/child?from=linkor?from=button- On the page
- "Opened by: link" or "Opened by: button" (id
opened-by)
What to practise
- Open the tab, switch to it by title, by address or by its number, read it and close it.
- Switch back to this page and go on; check that the closed tab is gone.
- Open the window with the button; it can close itself with its own button.
In VAF: LetsSwitchToWindow, LetsSwitchToWindowByURL, LetsCheckIfWindowExists,
LetsCloseTab, LetsOpenNewTab.
Tested in VAF-Demo
A test of this page from VAF-Demo, written with shared steps: the test says what the user does, the steps hold the VAF chains.
[Test]
public void NewTabIsFoundReadAndClosed()
{
WindowsSteps.LetsOpenTheChildInANewTab();
WindowsSteps.LetsCheckTheChildWasOpenedBy("link");
WindowsSteps.LetsCloseTheChild();
Assert.That(WindowsSteps.LetsCheckIfTheChildIsOpen(), Is.False);
}
On GitHub (opens in a new tab)
-
Page object
—
WindowsPage.cs: the locators of this page -
Native tests
—
WindowsTests.cs: the whole VAF chain in each test -
Shared steps
—
WindowsSteps.cs: the steps the test above calls -
Shared steps tests
—
WindowsStepsTests.cs: the tests of this page written with steps - The whole project and its README Latest test run (GitHub Actions)