playwright/test/assets/snapshot/snapshot-with-css.html
Dmitry Gozman b34d9aba25
feat(trace): experimental traces for our tests (#3567)
This introduces basic tracing enabled in our tests.

What is captured:
- network resources;
- snapshots at the start of most actions;
- snapshot after the test failure.

How this integrates with test runner:
- context fixture calls private method context._initSnapshotter() and uses Tracer to trace all events;
- all tests share a single test-results/trace-storage directory to store blobs;
- each test has its own trace file.
- npm run show-trace opens a bare-minimum trace viewer that renders snapshots.
2020-08-28 10:51:55 -07:00

45 lines
1.1 KiB
HTML

<link rel='stylesheet' href='./one.css'>
<style>
.root {
width: 800px;
height: 800px;
background: cyan;
}
</style>
<div>hello, world!</div>
<div class=root></div>
<script>
let shadow;
window.addEventListener('DOMContentLoaded', () => {
const root = document.querySelector('.root');
shadow = root.attachShadow({ mode: 'open' });
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = './one.css';
shadow.appendChild(link);
const imaged = document.createElement('div');
imaged.className = 'imaged';
shadow.appendChild(imaged);
const iframe = document.createElement('iframe');
iframe.width = '600px';
iframe.height = '600px';
iframe.src = '../frames/nested-frames.html';
shadow.appendChild(iframe);
});
window.addEventListener('load', () => {
for (const rule of shadow.styleSheets[0].cssRules) {
if (rule.styleSheet) {
for (const rule2 of rule.styleSheet.cssRules) {
if (rule2.cssText.includes('width: 200px'))
rule2.style.width = '400px';
}
}
}
});
</script>