 Made by [TestDriver.ai](https://testdriver.ai) - Automate and scale QA with agentic users # Visually Validate Playwright Tests Without Flaky Selectors Static selectors break with code changes and can't prove that a site "looks good". Is that button really missing or was the `id` changed? Is the site responsive on mobile? Is the correct image showing? These kinds of tests are impossible to validate with selectors alone and take a lot of time to test manually. GoodLooks.ai lets you visually validate your web pages with natural language prompts instead of selectors. Check out our other products: [TestDriver.ai](https://testdriver.ai/?ref=goodlooks) and [Dashcam.io](https://dashcam.io?ref=goodlooks). ## Quickstart 1. `git clone git@github.com:dashcamio/goodlooks.git` 2. `npm install` 3. `npx playwright test` Note that these examples use a demo key that gets rotated weekly; you'll want to [create your own API KEY](https://lgtm-main-80a621c.d2.zuplo.dev/docs/routes/~pricing). # Examples ## Element Visibility Validate that a cookie banner shows up.
| Input | Code |
|  | ```js const { test, expect } = require("@playwright/test"); const goodlooks = require("goodlooks"); goodlooks.configure("zpka_c0d0539ada014283bc974f0fd55835ea_2b745cbf"); expect.extend(goodlooks); test("framer", async ({ page }) => { await page.goto("https://framer.com/"); await page.waitForTimeout(5000); await expect(page).goodlooks("A request to enable cookies shows up"); }); ``` |
| Result | |
| ✅ PASS. The page displays a request to enable cookies with a message stating "We use cookies to personalize content, run ads, and analyze traffic." and an "Okay" button to acknowledge the message. | |
| Input | Code |
|  | ```js const { test, expect, devices } = require("@playwright/test"); const goodlooks = require("goodlooks"); goodlooks.configure("zpka_c0d0539ada014283bc974f0fd55835ea_2b745cbf"); expect.extend(goodlooks); test("is mobile responsive", async ({ page }) => { page.setViewportSize(devices["iPhone X"].viewport); await page.goto("https://cnn.com/"); await expect(page).goodlooks("should be mobile responsive"); }); ``` |
| Explanation | |
| ✅ PASS. The page appears to be displayed in a mobile-responsive layout. The content is aligned correctly within the confines of a narrow screen typical of mobile devices. The text is legible, the menu collapses into a hamburger icon, and the image is scaled to fit the screen width, indicating that the design adapts to a mobile resolution. | |
| Input | Code |
|  | ```js const { test, expect } = require("@playwright/test"); const goodlooks = require("goodlooks"); goodlooks.configure("zpka_c0d0539ada014283bc974f0fd55835ea_2b745cbf"); expect.extend(goodlooks); test("rickroll", async ({ page }) => { await page.goto("https://www.youtube.com/watch?v=dQw4w9WgXcQ"); await expect(page).goodlooks("video is not playing"); }); ``` |
| Result | |
| ✅ PASS. The page shows a video with the play button available and a timeline that is not progressing, indicating that the video is currently not playing. | |
| Input | Code |
|  | ```js const { test, expect, devices } = require("@playwright/test"); const goodlooks = require("goodlooks"); goodlooks.configure("zpka_c0d0539ada014283bc974f0fd55835ea_2b745cbf"); expect.extend(goodlooks); test("ycombinator", async ({ page }) => { await page.goto("https://news.ycombinator.com"); await expect(page).goodlooks( "there is an orange strip at the top of the page" ); }); ``` |
| Result | |
| ✅ PASS. The page has an orange strip at the top, which is consistent with the given condition. | |
| Input | Code |
|  | ```js const { test, expect, devices } = require("@playwright/test"); const goodlooks = require("goodlooks"); goodlooks.configure("zpka_c0d0539ada014283bc974f0fd55835ea_2b745cbf"); expect.extend(goodlooks); test("correct image appears", async ({ page }) => { await page.goto("https://eloquentjavascript.net/"); await expect(page).goodlooks("there is bird on this page"); }); ``` |
| Result | |
| ✅ PASS. There is an illustration of a bird on the left side of the page on the cover of a book titled "Eloquent JavaScript, Fourth Edition." | |
| Input | Code |
|  | ```js const { test, expect } = require("@playwright/test"); const goodlooks = require("goodlooks"); goodlooks.configure("zpka_c0d0539ada014283bc974f0fd55835ea_2b745cbf"); test("diversity", async ({ page }) => { await page.goto("https://diversityequityinclusion.com/about/"); await expect(page).goodlooks("diverse people show up"); }); ``` |
| Result | |
| ✅ PASS. The page includes a collage of images featuring various individuals in different settings and professional environments, indicative of a diverse group of people. This aligns with the theme of "Diversity Equity Inclusion" that is prominently displayed on the page. | |