-
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.
- Loading branch information
Showing
5 changed files
with
57 additions
and
2 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
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
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,53 @@ | ||
import { test, expect, Page } from "@playwright/test"; | ||
|
||
async function runProgramTest(page: Page, pvmType: string) { | ||
// Navigate to your app | ||
await page.goto("http://localhost:5173"); | ||
|
||
// Select the PVM type | ||
await page.waitForSelector('button[test-id="pvm-select"]'); | ||
|
||
await page.click('button[test-id="pvm-select"]'); | ||
|
||
const pvmOption = page.locator('div[role="option"]', { hasText: new RegExp(pvmType, "i") }); | ||
await pvmOption.waitFor({ state: "visible" }); | ||
await pvmOption.click(); | ||
|
||
// Wait for the ProgramUpload component to be visible | ||
await page.waitForSelector('button:has-text("Load")'); | ||
|
||
// Click the Load Program button | ||
await page.click('button:has-text("Load")'); | ||
|
||
// Wait for the program to load | ||
await page.waitForTimeout(1000); | ||
|
||
await page.click('button:has-text("Examples")'); | ||
await page.click('button[id="option-fibonacci"]'); | ||
await page.click('button[id="load-button"]'); | ||
|
||
await page.waitForTimeout(1000); | ||
|
||
const jumpIndInstruction = page.locator('span:has-text("JUMP_IND")'); | ||
await expect(jumpIndInstruction).toBeVisible(); | ||
|
||
// Test the "Run" button functionality | ||
await page.click('button:has-text("Run")'); | ||
|
||
// Wait for execution to complete | ||
await page.waitForTimeout(5000); | ||
|
||
const programStatus = page.locator('[test-id="program-status"]'); | ||
await expect(programStatus).toHaveText("HALT"); | ||
|
||
// const jumpIndInstructionParent = page.locator('div[test-id="instruction-item"]:has(span:has-text("JUMP_IND"))'); | ||
// await expect(jumpIndInstructionParent).toHaveCSS('background-color', 'rgb(76, 175, 80)'); | ||
} | ||
|
||
test("Run program with typeberry PVM", async ({ page }) => { | ||
await runProgramTest(page, "@typeberry"); | ||
}); | ||
|
||
test("Run program with polkavm PVM", async ({ page }) => { | ||
await runProgramTest(page, "polkavm"); | ||
}); |