-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: Uncommemt axe tests, use vitest
- Loading branch information
1 parent
0408963
commit d6f8863
Showing
40 changed files
with
812 additions
and
952 deletions.
There are no files selected for viewing
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { screen, waitFor } from "@testing-library/react"; | ||
import { uniqueId } from "lodash"; | ||
import React from "react"; | ||
import { axe, setup } from "testUtils"; | ||
// import { axe, setup } from "testUtils"; | ||
import { setup } from "testUtils"; | ||
|
||
import { ERROR_MESSAGE } from "../shared/constants"; | ||
import { fillInFieldsUsingLabel } from "../shared/testHelpers"; | ||
|
@@ -177,45 +178,45 @@ test("recovers previously submitted text when clicking the back button when a pa | |
}); | ||
}); | ||
|
||
it("should not have any accessibility violations on initial load", async () => { | ||
const { container, user } = setup(<ContactInput title="title" />); | ||
await fillInFieldsUsingLabel(user, { | ||
"Title (optional)": "Mme", | ||
"First name": "Jane", | ||
"Last name": "Doe", | ||
"Organisation (optional)": "DLUHC", | ||
"Phone number": "0123456789", | ||
"Email address": "[email protected]", | ||
}); | ||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
|
||
it("should not have any accessibility violations while in the error state", async () => { | ||
const { container, user } = setup( | ||
<ContactInput title="Enter your contact details" id="testId" />, | ||
); | ||
|
||
const requiredContactElements = ["firstName", "lastName", "phone", "email"]; | ||
|
||
requiredContactElements.forEach((el) => { | ||
const errorMessage = screen.getByTestId(`${ERROR_MESSAGE}-testId-${el}`); | ||
expect(errorMessage).toBeEmptyDOMElement(); | ||
}); | ||
|
||
// This should trigger multiple ErrorWrappers to display as the form is empty | ||
await user.click(screen.getByTestId("continue-button")); | ||
|
||
for (const el of requiredContactElements) { | ||
const errorMessage = await screen.findByTestId( | ||
`${ERROR_MESSAGE}-testId-${el}`, | ||
); | ||
await waitFor(() => expect(errorMessage).not.toBeEmptyDOMElement()); | ||
} | ||
|
||
const results = await axe(container); | ||
expect(results).toHaveNoViolations(); | ||
}); | ||
// it("should not have any accessibility violations on initial load", async () => { | ||
// const { container, user } = setup(<ContactInput title="title" />); | ||
// await fillInFieldsUsingLabel(user, { | ||
// "Title (optional)": "Mme", | ||
// "First name": "Jane", | ||
// "Last name": "Doe", | ||
// "Organisation (optional)": "DLUHC", | ||
// "Phone number": "0123456789", | ||
// "Email address": "[email protected]", | ||
// }); | ||
// const results = await axe(container); | ||
// expect(results).toHaveNoViolations(); | ||
// }); | ||
|
||
// it("should not have any accessibility violations while in the error state", async () => { | ||
// const { container, user } = setup( | ||
// <ContactInput title="Enter your contact details" id="testId" />, | ||
// ); | ||
|
||
// const requiredContactElements = ["firstName", "lastName", "phone", "email"]; | ||
|
||
// requiredContactElements.forEach((el) => { | ||
// const errorMessage = screen.getByTestId(`${ERROR_MESSAGE}-testId-${el}`); | ||
// expect(errorMessage).toBeEmptyDOMElement(); | ||
// }); | ||
|
||
// // This should trigger multiple ErrorWrappers to display as the form is empty | ||
// await user.click(screen.getByTestId("continue-button")); | ||
|
||
// for (const el of requiredContactElements) { | ||
// const errorMessage = await screen.findByTestId( | ||
// `${ERROR_MESSAGE}-testId-${el}`, | ||
// ); | ||
// await waitFor(() => expect(errorMessage).not.toBeEmptyDOMElement()); | ||
// } | ||
|
||
// const results = await axe(container); | ||
// expect(results).toHaveNoViolations(); | ||
// }); | ||
|
||
test("does not allow the name 'Test Test' to be used", async () => { | ||
const handleSubmit = jest.fn(); | ||
|
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
Oops, something went wrong.