generated from Arquisoft/dede_0
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from Arquisoft/Testing
Testing - adding test of address form
- Loading branch information
Showing
3 changed files
with
83 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { screen, render, queryByText, waitForElementToBeRemoved } from "@testing-library/react"; | ||
|
||
import AddressForm from './AddressForm'; | ||
|
||
import userEvent from "@testing-library/user-event"; | ||
|
||
import { ReactNotifications } from "react-notifications-component"; | ||
/** | ||
* Chek that the CheckoutItem component is working as expected with a product. | ||
*/ | ||
|
||
|
||
test('Check alert is shown when an address field is missing', async () => { | ||
|
||
render(<div><ReactNotifications/><div><AddressForm/></div></div>); | ||
expect(screen.getByTestId("street-input")).toBeInTheDocument(); | ||
expect(screen.getByTestId("locality-input")).toBeInTheDocument(); | ||
expect(screen.getByTestId("zipcode-input")).toBeInTheDocument(); | ||
expect(screen.getByTestId("country-input")).toBeInTheDocument(); | ||
expect(screen.getByText("Example: Valdés Salas.")).toBeInTheDocument(); | ||
expect(screen.getByText("Example: Oviedo.")).toBeInTheDocument(); | ||
expect(screen.getByText("Example: 33007.")).toBeInTheDocument(); | ||
expect(screen.getByText("Example: Spain.")).toBeInTheDocument(); | ||
expect(screen.getByText('Set Address')).toBeInTheDocument(); | ||
userEvent.click(screen.getByText('Set Address')); | ||
expect(screen.getByText('Attention!')).toBeInTheDocument(); | ||
expect(screen.getByText('Please, fill all form fields.')).toBeInTheDocument(); | ||
|
||
}) |
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