-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perform Percy snapshotting in end to end tests #1340
Comments
Here's some code that I wrote to do some experimental testing with Percy. This just takes a snapshot of the course home page: import playwright from "playwright"
import { env } from "../../env"
import { test, expect } from "@playwright/test"
import { getFirstAfter, CoursePage } from "../util"
const percySnapshot = require('@percy/playwright')
const browsers = {
"firefox": playwright.firefox,
"chromium": playwright.chromium
}
test("Loads the course home page", async ({ browserName }) => {
const browser = await browsers[browserName].launch()
const page = await browser.newPage()
const course = new CoursePage(page, "course")
await course.goto()
await percySnapshot(page, `Loads the course home page in ${browserName}`)
await browser.close()
}) One peculiarity that I found while experimenting with this is that you need to run the "test:e2e:percy": "yarn with-env --dev -- percy exec -- ./package_scripts/test_e2e.sh", |
If we had added the tests as described here, what would have happened in a case like #1379? |
I wonder whether or not it works if we use |
I'm not sure we would have caught this issue, because it requires a pretty specific scenario where the course description uses a shortcode and is also longer than 320 characters. If we had the testing in place before the issue happened, and added a playwright test to check truncation beforehand it's possible we would have noticed it. It's likely we would add a Percy snapshot to the course home page, so if there was a difference visually between the unexpanded descriptions between two branches then it would have been flagged. It's also possible that a Playwright test checking for unrendered markdown in the description could have seen this. |
Description/Context
Browserstack Percy is a product that takes snapshots of websites and performs automatic visual comparison, generating images that show the differences between two snapshots. We should add this to our end to end tests so visual comparisons can be made both from branch to branch and also from commit to commit if necessary.
Plan/Design
@percy/cli
and@percy/playwright
to dev dependenciesocw-www
home pageThe text was updated successfully, but these errors were encountered: