I want to assert that I am on the "Home Page" after the user is logged in the Home Page. I made a function 'onPage' to return me the contains of the URL.
Here is the code:
function onPage (secondPage, URL) {
if (secondPage === 'Home Page') {
return await
testController.expect(URL.textContent).contains('URL-of-the-Home-Page');
}
}
Then(THEN.THE_HOME_PAGE_IS_OPENED, async (secondPage) => {
await testController.expect(onPage(secondPage, URL)).eql(true);
}
And here is my BDD scenario:
Scenario Outline: User is logged in the
Given the <namePage> is opened
And the user populate <username>
And the user populate <password>
When the user clicks on Login button
Then he is on <secondPage>
Examples:
| namePage | username | password | secondPage |
| "Login Page" | "admin" | "admin" | "Home Page" |