2021-04-12 13:32:25 +00:00
|
|
|
import React from "react";
|
2022-03-28 18:50:20 +00:00
|
|
|
import { render, screen } from "@testing-library/react";
|
2016-11-16 16:58:25 +00:00
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
import RegistrationForm from "components/forms/RegistrationForm";
|
2016-11-16 16:58:25 +00:00
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
describe("RegistrationForm - component", () => {
|
|
|
|
|
it("renders AdminDetails and header on the first page", () => {
|
2022-03-28 18:50:20 +00:00
|
|
|
const { container } = render(<RegistrationForm page={1} />);
|
2016-11-16 16:58:25 +00:00
|
|
|
|
2022-03-28 18:50:20 +00:00
|
|
|
expect(
|
|
|
|
|
container.querySelectorAll(".user-registration__container--admin").length
|
|
|
|
|
).toEqual(1);
|
|
|
|
|
expect(screen.getByText("Setup user")).toBeInTheDocument();
|
2016-11-16 16:58:25 +00:00
|
|
|
});
|
|
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
it("renders OrgDetails on the second page", () => {
|
2022-03-28 18:50:20 +00:00
|
|
|
const { container } = render(<RegistrationForm page={2} />);
|
2016-11-16 16:58:25 +00:00
|
|
|
|
2022-03-28 18:50:20 +00:00
|
|
|
expect(
|
|
|
|
|
container.querySelectorAll(".user-registration__container--org").length
|
|
|
|
|
).toEqual(1);
|
|
|
|
|
expect(screen.getByText("Organization details")).toBeInTheDocument();
|
2016-11-16 16:58:25 +00:00
|
|
|
});
|
|
|
|
|
|
2021-06-11 00:01:18 +00:00
|
|
|
it("renders FleetDetails on the third page", () => {
|
2022-03-28 18:50:20 +00:00
|
|
|
const { container } = render(<RegistrationForm page={3} />);
|
2016-11-16 16:58:25 +00:00
|
|
|
|
2022-03-28 18:50:20 +00:00
|
|
|
expect(
|
|
|
|
|
container.querySelectorAll(".user-registration__container--fleet").length
|
|
|
|
|
).toEqual(1);
|
|
|
|
|
expect(screen.getByText("Set Fleet URL")).toBeInTheDocument();
|
2016-11-16 16:58:25 +00:00
|
|
|
});
|
|
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
it("renders ConfirmationPage on the fourth page", () => {
|
2022-03-28 18:50:20 +00:00
|
|
|
const { container } = render(<RegistrationForm page={4} />);
|
2016-11-16 16:58:25 +00:00
|
|
|
|
2022-03-28 18:50:20 +00:00
|
|
|
expect(
|
|
|
|
|
container.querySelectorAll(".user-registration__container--confirmation")
|
|
|
|
|
.length
|
|
|
|
|
).toEqual(1);
|
2022-05-18 17:03:00 +00:00
|
|
|
expect(screen.getByText("Confirm configuration")).toBeInTheDocument();
|
2016-11-16 16:58:25 +00:00
|
|
|
});
|
|
|
|
|
});
|