test: organize golden files under __snapshots__ folder (#3494)
20
.github/workflows/tests.yml
vendored
@ -46,8 +46,8 @@ jobs:
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: ${{ matrix.browser }}-${{ matrix.os }}-output
|
||||
path: test/output-${{ matrix.browser }}
|
||||
name: ${{ matrix.browser }}-${{ matrix.os }}-test-results
|
||||
path: test-results
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
@ -77,8 +77,8 @@ jobs:
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: ${{ matrix.browser }}-mac-output
|
||||
path: test/output-${{ matrix.browser }}
|
||||
name: ${{ matrix.browser }}-mac-test-results
|
||||
path: test-results
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
@ -112,8 +112,8 @@ jobs:
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: ${{ matrix.browser }}-win-output
|
||||
path: test/output-${{ matrix.browser }}
|
||||
name: ${{ matrix.browser }}-win-test-results
|
||||
path: test-results
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
@ -169,8 +169,8 @@ jobs:
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: headful-${{ matrix.browser }}-linux-output
|
||||
path: test/output-${{ matrix.browser }}
|
||||
name: headful-${{ matrix.browser }}-linux-test-results
|
||||
path: test-results
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
@ -207,8 +207,8 @@ jobs:
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: wire-${{ matrix.browser }}-linux-output
|
||||
path: test/output-${{ matrix.browser }}
|
||||
name: wire-${{ matrix.browser }}-linux-test-results
|
||||
path: test-results
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
|
||||
5
.gitignore
vendored
@ -1,7 +1,6 @@
|
||||
/node_modules/
|
||||
/test/output-chromium
|
||||
/test/output-firefox
|
||||
/test/output-webkit
|
||||
/test-results/
|
||||
/test/coverage-report
|
||||
/test/test-user-data-dir*
|
||||
.local-browsers/
|
||||
/.dev_profile*
|
||||
|
||||
BIN
test/__snapshots__/chromium/oopif/chromium/screenshot-oopif.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B |
|
After Width: | Height: | Size: 311 B |
|
Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 113 B |
|
After Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 553 B |
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 553 B |
|
After Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 252 B |
BIN
test/__snapshots__/emulation-focus/chromium/grid-cell-0.png
Normal file
|
After Width: | Height: | Size: 475 B |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
BIN
test/__snapshots__/emulation-focus/firefox/grid-cell-0.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
test/__snapshots__/emulation-focus/firefox/screenshot-sanity.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
test/__snapshots__/emulation-focus/webkit/grid-cell-0.png
Normal file
|
After Width: | Height: | Size: 560 B |
BIN
test/__snapshots__/emulation-focus/webkit/screenshot-sanity.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
test/__snapshots__/page-screenshot/chromium/grid-cell-0.png
Normal file
|
After Width: | Height: | Size: 475 B |
|
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 81 B After Width: | Height: | Size: 81 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
BIN
test/__snapshots__/page-screenshot/chromium/white.jpg
Normal file
|
After Width: | Height: | Size: 911 B |
BIN
test/__snapshots__/page-screenshot/firefox/grid-cell-0.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
test/__snapshots__/page-screenshot/firefox/grid-cell-1.png
Normal file
|
After Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 75 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
BIN
test/__snapshots__/page-screenshot/firefox/screenshot-sanity.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
BIN
test/__snapshots__/page-screenshot/firefox/white.jpg
Normal file
|
After Width: | Height: | Size: 923 B |
BIN
test/__snapshots__/page-screenshot/webkit/grid-cell-0.png
Normal file
|
After Width: | Height: | Size: 560 B |
BIN
test/__snapshots__/page-screenshot/webkit/grid-cell-1.png
Normal file
|
After Width: | Height: | Size: 387 B |
BIN
test/__snapshots__/page-screenshot/webkit/screenshot-canvas.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 97 B |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
BIN
test/__snapshots__/page-screenshot/webkit/screenshot-sanity.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
BIN
test/__snapshots__/page-screenshot/webkit/transparent.png
Normal file
|
After Width: | Height: | Size: 400 B |
BIN
test/__snapshots__/page-screenshot/webkit/white.jpg
Normal file
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
@ -26,6 +26,7 @@ import { setUnderTest } from '../lib/helper';
|
||||
import { installCoverageHooks } from './runner/coverage';
|
||||
import { valueFromEnv } from './runner/utils';
|
||||
import { registerFixture, registerWorkerFixture} from './runner/fixtures';
|
||||
import './runner/builtin.fixtures';
|
||||
|
||||
import {mkdtempAsync, removeFolderAsync} from './utils';
|
||||
|
||||
@ -37,13 +38,11 @@ const platform = os.platform();
|
||||
declare global {
|
||||
interface WorkerState {
|
||||
asset: (path: string) => string;
|
||||
parallelIndex: number;
|
||||
defaultBrowserOptions: LaunchOptions;
|
||||
golden: (path: string) => string;
|
||||
playwright: typeof import('../index');
|
||||
browserType: BrowserType<Browser>;
|
||||
browser: Browser;
|
||||
tmpDir: string;
|
||||
}
|
||||
interface FixtureState {
|
||||
toImpl: (rpcObject: any) => any;
|
||||
@ -62,10 +61,6 @@ declare global {
|
||||
(global as any).FFOX = browserName === 'firefox';
|
||||
(global as any).WEBKIT = browserName === 'webkit';
|
||||
|
||||
registerWorkerFixture('parallelIndex', async ({}, test) => {
|
||||
await test(parseInt(process.env.JEST_WORKER_ID, 10) - 1);
|
||||
});
|
||||
|
||||
registerWorkerFixture('httpService', async ({parallelIndex}, test) => {
|
||||
const assetsPath = path.join(__dirname, 'assets');
|
||||
const cachedPath = path.join(__dirname, 'assets', 'cached');
|
||||
@ -139,7 +134,7 @@ registerWorkerFixture('playwright', async({parallelIndex}, test) => {
|
||||
|
||||
async function teardownCoverage() {
|
||||
uninstall();
|
||||
const coveragePath = path.join(path.join(__dirname, 'output-' + browserName), 'coverage', parallelIndex + '.json');
|
||||
const coveragePath = path.join(path.join(__dirname, 'coverage-report'), 'coverage', parallelIndex + '.json');
|
||||
const coverageJSON = [...coverage.keys()].filter(key => coverage.get(key));
|
||||
await fs.promises.mkdir(path.dirname(coveragePath), { recursive: true });
|
||||
await fs.promises.writeFile(coveragePath, JSON.stringify(coverageJSON, undefined, 2), 'utf8');
|
||||
@ -205,5 +200,5 @@ registerWorkerFixture('asset', async ({}, test) => {
|
||||
});
|
||||
|
||||
registerWorkerFixture('golden', async ({browserName}, test) => {
|
||||
await test(p => path.join(__dirname, `golden-${browserName}`, p));
|
||||
await test(p => path.join(`${browserName}`, p));
|
||||
});
|
||||
|
||||
@ -155,7 +155,7 @@ it.skip(!CHROMIUM)('should take screenshot', async({browser, page, server, golde
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
expect(await page.screenshot()).toMatchImage(golden('screenshot-oopif.png'));
|
||||
expect(await page.screenshot()).toMatchImage(golden('screenshot-oopif.png'), { threshold: 0.3 });
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should load oopif iframes with subresources and request interception', async function({browser, page, server, context}) {
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import '../runner/builtin.fixtures';
|
||||
import '../base.fixture';
|
||||
import { registerFixture } from '../runner/fixtures';
|
||||
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import './runner/builtin.fixtures';
|
||||
import './base.fixture';
|
||||
import { registerFixture } from './runner/fixtures';
|
||||
import fs from 'fs';
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import './runner/builtin.fixtures';
|
||||
import './base.fixture';
|
||||
|
||||
import fs from 'fs';
|
||||
|
||||
@ -13,7 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import './runner/builtin.fixtures';
|
||||
import './base.fixture';
|
||||
|
||||
import { registerFixture } from './runner/fixtures';
|
||||
|
||||
import path from 'path';
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
[
|
||||
{
|
||||
"url": "http://localhost:<PORT>/csscoverage/involved.html",
|
||||
"ranges": [
|
||||
{
|
||||
"start": 149,
|
||||
"end": 297
|
||||
},
|
||||
{
|
||||
"start": 327,
|
||||
"end": 433
|
||||
}
|
||||
],
|
||||
"text": "\n@charset \"utf-8\";\n@namespace svg url(http://www.w3.org/2000/svg);\n@font-face {\n font-family: \"Example Font\";\n src: url(\"./Dosis-Regular.ttf\");\n}\n\n#fluffy {\n border: 1px solid black;\n z-index: 1;\n /* -webkit-disabled-property: rgb(1, 2, 3) */\n -lol-cats: \"dogs\" /* non-existing property */\n}\n\n@media (min-width: 1px) {\n span {\n -webkit-border-radius: 10px;\n font-family: \"Example Font\";\n animation: 1s identifier;\n }\n}\n"
|
||||
}
|
||||
]
|
||||
|
Before Width: | Height: | Size: 436 B |
|
Before Width: | Height: | Size: 428 B |
|
Before Width: | Height: | Size: 448 B |
@ -1,28 +0,0 @@
|
||||
[
|
||||
{
|
||||
"url": "http://localhost:<PORT>/jscoverage/involved.html",
|
||||
"ranges": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 35
|
||||
},
|
||||
{
|
||||
"start": 50,
|
||||
"end": 100
|
||||
},
|
||||
{
|
||||
"start": 107,
|
||||
"end": 141
|
||||
},
|
||||
{
|
||||
"start": 148,
|
||||
"end": 160
|
||||
},
|
||||
{
|
||||
"start": 168,
|
||||
"end": 207
|
||||
}
|
||||
],
|
||||
"text": "\nfunction foo() {\n if (1 > 2)\n console.log(1);\n if (1 < 2)\n console.log(2);\n let x = 1 > 2 ? 'foo' : 'bar';\n let y = 1 < 2 ? 'foo' : 'bar';\n let z = () => {};\n let q = () => {};\n q();\n}\n\nfoo();\n"
|
||||
}
|
||||
]
|
||||
|
Before Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 357 B |