adding pilot page and pilot drawer

This commit is contained in:
2024-05-30 22:13:20 -05:00
parent 13b408287f
commit 3a2feba8c9
17 changed files with 726 additions and 31 deletions

View File

@@ -0,0 +1,31 @@
import { ICustomWorld } from '../support/world';
import { Given, When, Then } from '@cucumber/cucumber';
import { config } from '../support/config';
import { expect } from '@playwright/test';
import { CommonPage } from '../pages/common.page';
Given('the user is on the homepage', async function (this: ICustomWorld) {
const commonPage = new CommonPage(this.page!);
await commonPage.goto();
});
When(
'the user clicks the {string} navbar link',
async function (this: ICustomWorld, navbarLinkName: string) {
const commonPage = new CommonPage(this.page!);
await commonPage.clickNavbarLink(navbarLinkName);
}
);
Then(
'the user is on the {string} page',
async function (this: ICustomWorld, pageHeadingText: string) {
const commonPage = new CommonPage(this.page!);
await expect(
commonPage.pageHeading.filter({ hasText: pageHeadingText })
).toHaveText('Pilots');
}
);

View File

@@ -0,0 +1,35 @@
import { ICustomWorld } from '../support/world';
import { Given, Then, When } from '@cucumber/cucumber';
import { config } from '../support/config';
import { expect } from '@playwright/test';
import { PilotsPage } from '../pages/pilots.page';
When('the user clicks the New button', async function (this: ICustomWorld) {
const pilotsPage = new PilotsPage(this.page!);
await pilotsPage.clickNewButton();
});
When(
'the user clicks the pilot drawer cancel button',
async function (this: ICustomWorld) {
const pilotsPage = new PilotsPage(this.page!);
await pilotsPage.clickPilotDrawerCancelButton();
}
);
Then('the pilot drawer is visible', async function (this: ICustomWorld) {
const pilotsPage = new PilotsPage(this.page!);
await expect(pilotsPage.pilotDrawer).toBeVisible();
});
Then(
'the pilot drawer is no longer visible',
async function (this: ICustomWorld) {
const pilotsPage = new PilotsPage(this.page!);
await expect(pilotsPage.pilotDrawer).not.toBeVisible();
}
);