Skip to content

Commit 0e8ab86

Browse files
committed
adds test for rope extension request
1 parent 8f8b752 commit 0e8ab86

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

features/rope-record/rope-details/request-extension.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ Feature: Rope Records
77
Scenario: User requests an extension for an In Service rope
88
Given I navigate to the Rope Detail Page for an In Service rope with Serial number 'CUCSNO168681'
99
And I provide the following information in the Request Extension form
10-
| Request by days | 4 |
11-
# Then I should be able to see the request in Extension history section
10+
| Request by days | 6 |
11+
Then I should be able to see the request in Extension history section

src/pages/EmailVerification.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Download, expect, Page } from '@playwright/test';
2+
3+
export class EmailVerification {
4+
private readonly page: Page;
5+
6+
constructor(page: Page) {
7+
this.page = page;
8+
}
9+
10+
verifyRequestExtensionEmailName(download: Download): void {
11+
const filename = download.suggestedFilename();
12+
expect(filename).toMatch(/^Request extension -.+\.eml$/);
13+
}
14+
}

src/steps/rope-record/rope-details/request-extension.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { DataTable, When } from '@cucumber/cucumber';
1+
import { DataTable, Then, When } from '@cucumber/cucumber';
2+
import { expect } from '@playwright/test';
23

34
import { CreateRopeRecord } from '../../../pages/CreateRopeRecord';
5+
import { EmailVerification } from '../../../pages/EmailVerification';
46
import { IHoistWorld } from '../../../support/hoist-world';
57

68
When(
@@ -18,6 +20,17 @@ When(
1820
const download1Promise = page.waitForEvent('download');
1921
await page.getByRole('button', { name: 'Confirm' }).click();
2022
const download1 = await download1Promise;
21-
console.log('downloading email', download1);
23+
const emailPage = new EmailVerification(this.page!);
24+
emailPage.verifyRequestExtensionEmailName(download1);
25+
},
26+
);
27+
28+
Then(
29+
'I should be able to see the request in Extension history section',
30+
async function (this: IHoistWorld) {
31+
await this.page?.getByRole('tab', { name: 'Rope information' }).click();
32+
const page = this.page!;
33+
const expectedValue = '6';
34+
await expect(page.getByText(`Requested: ${expectedValue} days`).first()).toBeVisible();
2235
},
2336
);

0 commit comments

Comments
 (0)