mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: update screencast test to actually require red color (#4745)
This commit is contained in:
parent
b6cd385a67
commit
9bbabaaa74
@ -90,25 +90,26 @@ export class VideoPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function almostRed(r, g, b, alpha) {
|
function almostRed(r, g, b, alpha) {
|
||||||
expect(g).toBeLessThan(50);
|
expect(r).toBeGreaterThan(185);
|
||||||
expect(b).toBeLessThan(50);
|
expect(g).toBeLessThan(70);
|
||||||
|
expect(b).toBeLessThan(70);
|
||||||
expect(alpha).toBe(255);
|
expect(alpha).toBe(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
function almostBlack(r, g, b, alpha) {
|
function almostBlack(r, g, b, alpha) {
|
||||||
expect(r).toBeLessThan(30);
|
expect(r).toBeLessThan(70);
|
||||||
expect(g).toBeLessThan(30);
|
expect(g).toBeLessThan(70);
|
||||||
expect(b).toBeLessThan(30);
|
expect(b).toBeLessThan(70);
|
||||||
expect(alpha).toBe(255);
|
expect(alpha).toBe(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
function almostGrey(r, g, b, alpha) {
|
function almostGray(r, g, b, alpha) {
|
||||||
expect(r).toBeGreaterThan(70);
|
expect(r).toBeGreaterThan(70);
|
||||||
expect(g).toBeGreaterThan(70);
|
expect(g).toBeGreaterThan(70);
|
||||||
expect(b).toBeGreaterThan(70);
|
expect(b).toBeGreaterThan(70);
|
||||||
expect(r).toBeLessThan(130);
|
expect(r).toBeLessThan(185);
|
||||||
expect(g).toBeLessThan(130);
|
expect(g).toBeLessThan(185);
|
||||||
expect(b).toBeLessThan(130);
|
expect(b).toBeLessThan(185);
|
||||||
expect(alpha).toBe(255);
|
expect(alpha).toBe(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,12 +287,13 @@ describe('screencast', suite => {
|
|||||||
|
|
||||||
{
|
{
|
||||||
const pixels = videoPlayer.seekLastFrame().data;
|
const pixels = videoPlayer.seekLastFrame().data;
|
||||||
expectAll(pixels, almostGrey);
|
expectAll(pixels, almostGray);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should capture css transformation', (test, { headful }) => {
|
it('should capture css transformation', (test, { headful, browserName, platform }) => {
|
||||||
test.fixme(headful, 'Fails on headful');
|
test.fixme(headful, 'Fails on headful');
|
||||||
|
test.fixme(browserName === 'webkit' && platform === 'win32', 'Fails on headful');
|
||||||
}, async ({browser, server, testInfo}) => {
|
}, async ({browser, server, testInfo}) => {
|
||||||
const size = { width: 320, height: 240 };
|
const size = { width: 320, height: 240 };
|
||||||
// Set viewport equal to screencast frame size to avoid scaling.
|
// Set viewport equal to screencast frame size to avoid scaling.
|
||||||
@ -385,11 +387,11 @@ describe('screencast', suite => {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
const pixels = videoPlayer.seekLastFrame({x: 300, y: 0}).data;
|
const pixels = videoPlayer.seekLastFrame({x: 300, y: 0}).data;
|
||||||
expectAll(pixels, almostGrey);
|
expectAll(pixels, almostGray);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const pixels = videoPlayer.seekLastFrame({x: 0, y: 200}).data;
|
const pixels = videoPlayer.seekLastFrame({x: 0, y: 200}).data;
|
||||||
expectAll(pixels, almostGrey);
|
expectAll(pixels, almostGray);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const pixels = videoPlayer.seekLastFrame({x: 300, y: 200}).data;
|
const pixels = videoPlayer.seekLastFrame({x: 300, y: 200}).data;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user