create next.js e2e test (#305)
This commit is contained in:
16
e2e-tests/fixtures/edit-made-with-dyad.md
Normal file
16
e2e-tests/fixtures/edit-made-with-dyad.md
Normal file
@@ -0,0 +1,16 @@
|
||||
<dyad-write path="src/components/made-with-dyad.tsx" description="write-description">
|
||||
export const MadeWithDyad = () => {
|
||||
return (
|
||||
<div className="p-4 text-center">
|
||||
<a
|
||||
href="https://www.dyad.sh/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
|
||||
>
|
||||
Made with Dyad (EDITED)
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
</dyad-write>
|
||||
@@ -50,6 +50,10 @@ class PageObject {
|
||||
await this.page.getByTestId("reject-proposal-button").click();
|
||||
}
|
||||
|
||||
async clickRestart() {
|
||||
await this.page.getByRole("button", { name: "Restart" }).click();
|
||||
}
|
||||
|
||||
getPreviewIframeElement() {
|
||||
return this.page.getByTestId("preview-iframe-element");
|
||||
}
|
||||
@@ -196,6 +200,14 @@ class PageObject {
|
||||
await this.page.getByRole("link", { name: "Apps" }).click();
|
||||
}
|
||||
|
||||
async goToHubTab() {
|
||||
await this.page.getByRole("link", { name: "Hub" }).click();
|
||||
}
|
||||
|
||||
async selectTemplate(templateName: string) {
|
||||
await this.page.getByRole("img", { name: templateName }).click();
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// Toast assertions
|
||||
////////////////////////////////
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
- main:
|
||||
- heading "Blank page" [level=1]
|
||||
- link "Made with Dyad (EDITED)":
|
||||
- /url: https://www.dyad.sh/
|
||||
- status:
|
||||
- img
|
||||
- text: Static route
|
||||
- button "Hide static indicator":
|
||||
- img
|
||||
- alert
|
||||
20
e2e-tests/template-create-nextjs.spec.ts
Normal file
20
e2e-tests/template-create-nextjs.spec.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { test } from "./helpers/test_helper";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
test("create next.js app", async ({ po }) => {
|
||||
await po.setUp();
|
||||
// Select Next.js template
|
||||
await po.goToHubTab();
|
||||
await po.selectTemplate("Next.js Template");
|
||||
await po.goToAppsTab();
|
||||
|
||||
// Create an app
|
||||
await po.sendPrompt("tc=edit-made-with-dyad");
|
||||
await po.approveProposal();
|
||||
|
||||
await po.clickRestart();
|
||||
|
||||
// This can be pretty slow because it's waiting for the app to build.
|
||||
await expect(po.getPreviewIframeElement()).toBeVisible({ timeout: 25_000 });
|
||||
await po.snapshotPreview();
|
||||
});
|
||||
Reference in New Issue
Block a user