Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions tests/page/page-transition.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { test as it, expect } from './pageTest';

it('should not crash when filter transition completes', async ({ page, browserName }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/42637' });
it.fixme(browserName === 'webkit', 'Web process crashes on the compositor thread when a filter transitions to none');

await page.setContent(`
<style>
div { transition: filter 0.1s; }
.dim { filter: brightness(0.95); }
</style>
${'<div>hello</div>'.repeat(10)}
`);
let crashed = false;
page.on('crash', () => crashed = true);
for (let i = 0; i < 10 && !crashed; i++) {
await page.evaluate(async () => {
const divs = [...document.querySelectorAll('div')];
const settled = () => Promise.all(divs.map(div => new Promise(f => div.addEventListener('transitionend', f, { once: true }))));
let promise = settled();
divs.forEach(div => div.classList.add('dim'));
await promise;
promise = settled();
divs.forEach(div => div.classList.remove('dim'));
await promise;
}).catch(() => {});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not fail the test if there are other issues?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably wants to tell that evaluate can fail, but it is important that it does not crash the page.

}
expect(crashed).toBe(false);
});
Loading