nested-suspense-ssg.spec.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // TODO: ssg is disabled in the CLI server
  2. // // @ts-check
  3. // const { test, expect } = require("@playwright/test");
  4. // test("nested suspense resolves", async ({ page }) => {
  5. // // Wait for the dev server to reload
  6. // await page.goto("http://localhost:6060");
  7. // // Then wait for the page to start loading
  8. // await page.goto("http://localhost:6060", { waitUntil: "commit" });
  9. // // Expect the page to contain the suspense result from the server
  10. // const mainMessageTitle = page.locator("#title-0");
  11. // await expect(mainMessageTitle).toContainText("The robot says hello world");
  12. // const mainMessageBody = page.locator("#body-0");
  13. // await expect(mainMessageBody).toContainText(
  14. // "The robot becomes sentient and says hello world"
  15. // );
  16. // // And expect the title to have resolved on the client
  17. // await expect(page).toHaveTitle("The robot says hello world");
  18. // // Nested suspense should be resolved
  19. // const nestedMessageTitle1 = page.locator("#title-1");
  20. // await expect(nestedMessageTitle1).toContainText("The world says hello back");
  21. // const nestedMessageBody1 = page.locator("#body-1");
  22. // await expect(nestedMessageBody1).toContainText(
  23. // "In a stunning turn of events, the world collectively unites and says hello back"
  24. // );
  25. // const nestedMessageDiv2 = page.locator("#children-2");
  26. // await expect(nestedMessageDiv2).toBeEmpty();
  27. // const nestedMessageTitle2 = page.locator("#title-2");
  28. // await expect(nestedMessageTitle2).toContainText("Goodbye Robot");
  29. // const nestedMessageBody2 = page.locator("#body-2");
  30. // await expect(nestedMessageBody2).toContainText("The robot says goodbye");
  31. // const nestedMessageDiv3 = page.locator("#children-3");
  32. // await expect(nestedMessageDiv3).toBeEmpty();
  33. // const nestedMessageTitle3 = page.locator("#title-3");
  34. // await expect(nestedMessageTitle3).toContainText("Goodbye World");
  35. // const nestedMessageBody3 = page.locator("#body-3");
  36. // await expect(nestedMessageBody3).toContainText("The world says goodbye");
  37. // // Deeply nested suspense should be resolved
  38. // const nestedMessageDiv4 = page.locator("#children-4");
  39. // await expect(nestedMessageDiv4).toBeEmpty();
  40. // const nestedMessageTitle4 = page.locator("#title-4");
  41. // await expect(nestedMessageTitle4).toContainText("Hello World");
  42. // const nestedMessageBody4 = page.locator("#body-4");
  43. // await expect(nestedMessageBody4).toContainText("The world says hello again");
  44. // });