CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 06:06:18 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=069a001e290777158a21be62fd97f1352b482f5a63dc70ad78054c470cb464f7a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22ArH4DS9MvFqTLdKdAQNphpi2YaKVMmRj%22%3B%7D; HttpOnly; Path=/
cf-ray: 98cc2bb20db1d3d4-BLR
import test, { expect } from "playwright/test";import { UiTester } from "@/tes - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import test, { expect } from "playwright/test";
- import { UiTester } from "@/test/fd-test-ui-tester/ui-tester";
- import {
- editPoClickSaveButton,
- editPoSetInputValue,
- editPoToggleBooleanField,
- editPoWaitForUrl,
- } from "@/test/meta/fd-meta-tester-ui/page-objects/edit-po";
- import { listPoGoTo } from "@/test/meta/fd-meta-tester-ui/page-objects/list-po";
- import { tablePoClickEditButton } from "@/test/meta/fd-meta-tester-ui/page-objects/table-po";
- import { resourceNames, personProps, routes, elementSuffixes, withIdProps } from "@fernir2/saas-kit";
- import { login } from "@/test/ui-tests/auth/login-po";
- import { getUiTestPage } from "@/test/fd-test-ui-tester/global-ui-test";
- import { selectWorkspacePoSelectWorkspace } from "@/test/meta/fd-meta-tester-ui/page-objects/select-workspace-po";
- import { getResourceById, getCurrentWorkspaceId } from "@fernir2/saas-kit/server";
- import { SeedTestData, seedTestData } from "@/test/test-data/seed-test-data";
- import { uiAssertEqual } from "@/test/fd-test-ui-tester/ui-asserts";
- test.describe("Dependent fields validation", () => {
- let testData: SeedTestData;
- test.beforeEach(async () => {
- const uiTester = new UiTester(getUiTestPage());
- const workspaceId = await getCurrentWorkspaceId();
- testData = await seedTestData(workspaceId);
- await login();
- await uiTester.expectUrl(routes.view);
- await listPoGoTo(resourceNames.person);
- await selectWorkspacePoSelectWorkspace(workspaceId);
- await tablePoClickEditButton((testData.samBrownPerson as any)[withIdProps.id]);
- await editPoWaitForUrl(resourceNames.person, (testData.samBrownPerson as any)[withIdProps.id]);
- });
- test("Dependent fields are not required when 'Has kids' is off", async () => {
- // Arrange
- await editPoToggleBooleanField(personProps.hasKids); // Turn off
- // Act
- await editPoSetInputValue(personProps.firstbornName, "");
- // Assert
- await editAssertHasNoValidationError(personProps.firstbornName);
- await editAssertHasNoValidationError(personProps.areKidsVaccinated);
- });
- test("Dependent fields become required when 'Has kids' is on", async () => {
- // Arrange
- // 'Has kids' is on by default
- // Act
- await editPoSetInputValue(personProps.firstbornName, "");
- await editPoToggleBooleanField(personProps.areKidsVaccinated); // Turn off
- // Assert
- await editAssertHasValidationError(personProps.firstbornName);
- await editAssertHasValidationError(personProps.areKidsVaccinated);
- });
- test("Validation errors disappear after filling the fields", async () => {
- // Arrange
- // 'Has kids' is on by default
- // Act
- await editPoSetInputValue(personProps.firstbornName, "John");
- await editPoToggleBooleanField(personProps.areKidsVaccinated); // Turn on
- // Assert
- await editAssertHasNoValidationError(personProps.firstbornName);
- await editAssertHasNoValidationError(personProps.areKidsVaccinated);
- });
- test("Saves and verifies the data", async () => {
- // Arrange
- // 'Has kids' is on by default
- // Act
- await editPoSetInputValue(personProps.firstbornName, "Jane");
- await editPoToggleBooleanField(personProps.areKidsVaccinated); // Turn on
- await editPoClickSaveButton(resourceNames.person);
- const person = await getResourceById<any>(
- resourceNames.person,
- (testData.samBrownPerson as any)[withIdProps.id],
- );
- // Assert
- expect(person.hasKids).toBe(true);
- expect(person.areKidsVaccinated).toBe(true);
- expect(person.firstbornName).toBe("Jane");
- });
- });
- export async function editAssertHasValidationError(propertyName: string) {
- const page = getUiTestPage();
- const uiTester = new UiTester(page);
- const elementId = propertyName + elementSuffixes.edit;
- const element = await uiTester.getById(elementId);
- await uiAssertEqual("true", await element.getAttribute("aria-invalid"));
- }
- export async function editAssertHasNoValidationError(propertyName: string) {
- const page = getUiTestPage();
- const uiTester = new UiTester(page);
- const elementId = propertyName + elementSuffixes.edit;
- const element = await uiTester.getById(elementId);
- await uiAssertEqual(null, await element.getAttribute("aria-invalid"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐⭐GMAIL Logs (2FA disabled)⭐⭐
Java | 1 sec ago | 0.10 KB
-
⭐✅ MAKE $2500 IN 15 MIN⭐⭐⭐ O
JavaScript | 3 sec ago | 0.24 KB
-
✅⭐ Make $2500 in 15 minutes ✅ NEVER SEEN BEFO...
JavaScript | 4 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ 8
JavaScript | 14 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ 4
JavaScript | 14 sec ago | 0.24 KB
-
⭐⭐⭐Make $15OO in 2O minutesV G⭐⭐
Java | 15 sec ago | 0.10 KB
-
⭐⭐⭐ G2A Payment Exploit ✅ NEVER SEEN BEFORE ⭐...
JavaScript | 18 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ C
JavaScript | 25 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand