generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create E2E tests for api page (#15709)
- Loading branch information
1 parent
1ba9021
commit eee3ae9
Showing
4 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
frontend-react/e2e/pages/public/developer-resources/api/api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { BasePage, BasePageTestArgs } from "../../../BasePage"; | ||
|
||
export class DeveloperResourcesApiPage extends BasePage { | ||
constructor(testArgs: BasePageTestArgs) { | ||
super( | ||
{ | ||
url: "/developer-resources/api", | ||
title: "Guide to connecting with ReportStream's API", | ||
heading: testArgs.page.getByRole("heading", { | ||
name: "ReportStream API", | ||
exact: true, | ||
}), | ||
}, | ||
testArgs, | ||
); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
frontend-react/e2e/pages/public/resources.ts → ...s/public/developer-resources/resources.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
frontend-react/e2e/spec/all/public/developer-resources/api/api.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { developerResourcesApiSideNav } from "../../../../../helpers/internal-links"; | ||
import { DeveloperResourcesApiPage } from "../../../../../pages/public/developer-resources/api/api"; | ||
import { test as baseTest, expect } from "../../../../../test.js"; | ||
|
||
export interface Fixtures { | ||
developerResourcesApiPage: DeveloperResourcesApiPage; | ||
} | ||
|
||
const test = baseTest.extend<Fixtures>({ | ||
developerResourcesApiPage: async ( | ||
{ | ||
page: _page, | ||
isMockDisabled, | ||
adminLogin, | ||
senderLogin, | ||
receiverLogin, | ||
storageState, | ||
isFrontendWarningsLog, | ||
frontendWarningsLogPath, | ||
}, | ||
use, | ||
) => { | ||
const page = new DeveloperResourcesApiPage({ | ||
page: _page, | ||
isMockDisabled, | ||
adminLogin, | ||
senderLogin, | ||
receiverLogin, | ||
storageState, | ||
isFrontendWarningsLog, | ||
frontendWarningsLogPath, | ||
}); | ||
await page.goto(); | ||
await use(page); | ||
}, | ||
}); | ||
|
||
test.describe( | ||
"Developer Resources / API page", | ||
{ | ||
tag: "@smoke", | ||
}, | ||
() => { | ||
test("has side nav", async ({ developerResourcesApiPage }) => { | ||
await developerResourcesApiPage.testSidenav(developerResourcesApiSideNav); | ||
}); | ||
|
||
test("pdf file download works", async ({ developerResourcesApiPage }) => { | ||
const downloadPromise = developerResourcesApiPage.page.waitForEvent("download"); | ||
await developerResourcesApiPage.page.getByRole("link", { name: "downloadable PDF" }).click(); | ||
const download = await downloadPromise; | ||
expect(download.suggestedFilename()).toMatch(/^.+\.pdf$/); | ||
await download.cancel(); | ||
}); | ||
|
||
test("has correct title + heading", async ({ developerResourcesApiPage }) => { | ||
await developerResourcesApiPage.testHeader(); | ||
}); | ||
|
||
test("footer", async ({ developerResourcesApiPage }) => { | ||
await developerResourcesApiPage.testFooter(); | ||
}); | ||
}, | ||
); |
4 changes: 2 additions & 2 deletions
4
...2e/spec/all/public/resources-page.spec.ts → ...eveloper-resources/resources-page.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters