-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
test(playwright): add snapshots, refactor utils, coverage #9078
Conversation
Build Stats
|
… into test-playwright
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted logic from util/objects to ObjectUtil
I really want to use jest inside playwright for object snapshots, is there a way to do that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept
Each test is a folder containing:
*.spec.ts
- playwright testindex.ts
- fabric test setup:beforeAll
- a simple hook that creates the canvas, attaches and runs
index.ts
- return a map of objects that playwright can access via eval
- it is awaited by playwright to avoid race conditions
- a simple hook that creates the canvas, attaches and runs
afterAll
- executed by playwright at the end of a test
- also awaited
@@ -1,25 +1,19 @@ | |||
<html> | |||
<head> | |||
<script type="text/javascript" src="/dist/index.js"></script> | |||
<title>Fabric e2e Testing Suite</title> | |||
<link rel="icon" type="image/x-icon" href="./favicon.ico" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to silence playwright raising an error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am DONE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the last time
DONE
Not touching, I sware
Playwright is a powerful tool indeed, and this PR makes it easy for us to use it and to migrate tests to it.
If it had data snapshots that would have been amazing, testing state during interaction
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps chromium | ||
- name: Run Playwright tests | ||
run: xvfb-run npm run test:e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want/need to run CI in headed mode?
@asturur ?
@mxschmitt would love your input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For browsers test as unit tests in browsers is not needed.
For playwright i don't know the framework so well yet.
i assume that to take screenshots you need xvfb ready unless you are doing them through the browser with an internal browser buffer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look before this commit you will see I didn't use the headed option thus nkt needing xvfb
But I don't know what the diff is, tests pass in both cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep what works, at some point we will optimize instance usage and strain, for now starting the X server on linux who cares
Let's try this setup. |
Motivation
playing around with playwright cause I wanted to write another test
Description
Made the exisitng test create visual snapshots
Refactored util to be more useful
Added coverage reporting
Added an app concept to each test
Changes
Each test is a folder containing:
*.spec.ts
- playwright testindex.ts
- fabric test setup:beforeAll
index.ts
before
: same asbeforeAll
only that is accepts a selector to select the canvas element to operate onafterAll
after
: same asafterAll
only that is accepts a selector to select the canvas element to operate onindex.html
Gist
In Action