also iterate through stacks
This commit is contained in:
parent
7396160833
commit
610400bc49
@ -1,5 +1,6 @@
|
||||
import puppeteer, { Browser, Page, ElementHandle } from "puppeteer";
|
||||
import { Stack } from "../lib/stacks";
|
||||
import { CodeGenerationModel } from "../lib/models";
|
||||
|
||||
const REPO_PATH = "/Users/abi/Documents/GitHub/screenshot-to-code/frontend";
|
||||
const DOWNLOAD_PATH = `${REPO_PATH}/qa`;
|
||||
@ -32,17 +33,17 @@ describe("Simple Puppeteer Test", () => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
const stacks = Object.values(Stack);
|
||||
|
||||
const stacks = Object.values(Stack).slice(0, 1);
|
||||
const models = Object.values(CodeGenerationModel);
|
||||
// For debugging
|
||||
//.slice(0, 1);
|
||||
|
||||
models.forEach((model) => {
|
||||
stacks.forEach((stack) => {
|
||||
it(`should load the homepage and check the title for stack: ${stack}`, async () => {
|
||||
const codeGenerationModel = "claude_3_sonnet";
|
||||
const testId = `${codeGenerationModel}_${stack}`;
|
||||
const testId = `${model}_${stack}`;
|
||||
|
||||
await setupLocalStorage(page, stack, codeGenerationModel);
|
||||
await setupLocalStorage(page, stack, model);
|
||||
|
||||
// Upload file
|
||||
const fileInput = (await page.$(
|
||||
@ -62,9 +63,12 @@ describe("Simple Puppeteer Test", () => {
|
||||
|
||||
// Click the generate button and wait for the code to be generated
|
||||
await page.waitForNetworkIdle();
|
||||
await page.waitForFunction(() => document.body.innerText.includes("v1"), {
|
||||
await page.waitForFunction(
|
||||
() => document.body.innerText.includes("v1"),
|
||||
{
|
||||
timeout: 30000,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
await page.screenshot({
|
||||
path: `${SCREENSHOTS_PATH}/${testId}_image_results.png`,
|
||||
@ -72,6 +76,7 @@ describe("Simple Puppeteer Test", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
async function setupLocalStorage(page: Page, stack: string, model: string) {
|
||||
const setting = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user