From 0bec122cdbe202f6659fa868dcfbc77379a6837b Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Mon, 30 Sep 2024 12:19:06 +0300 Subject: [PATCH] remove datetime from SVG snapshots --- cspell.yml | 1 + tests/PageObjectModel.ts | 5 +++-- .../custom-introspection-graph-Demo-linux.svg | 2 +- tests/demo.spec.ts-snapshots/custom-sdl-graph-Demo-linux.svg | 2 +- .../custom-sdl-with-unknown-directives-graph-Demo-linux.svg | 2 +- tests/demo.spec.ts-snapshots/demo-graph-Demo-linux.svg | 2 +- tests/demo.spec.ts-snapshots/github-graph-Demo-linux.svg | 2 +- .../demo.spec.ts-snapshots/graph-after-resize-Demo-linux.svg | 2 +- .../graph-before-resize-Demo-linux.svg | 2 +- .../schema-from-url-graph-Demo-linux.svg | 2 +- .../shopify-storefront-graph-Demo-linux.svg | 2 +- tests/demo.spec.ts-snapshots/star-wars-graph-Demo-linux.svg | 2 +- tests/demo.spec.ts-snapshots/yelp-graph-Demo-linux.svg | 2 +- 13 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cspell.yml b/cspell.yml index fca0af40..84e5231f 100644 --- a/cspell.yml +++ b/cspell.yml @@ -8,6 +8,7 @@ ignorePaths: - demo/presets - worker/viz.cpp - worker/Dockerfile + - tests/*-snapshots/ dictionaries: - html diff --git a/tests/PageObjectModel.ts b/tests/PageObjectModel.ts index ba0fcf19..172b3393 100644 --- a/tests/PageObjectModel.ts +++ b/tests/PageObjectModel.ts @@ -98,8 +98,9 @@ class PlaywrightVoyagerPage { } async getGraphSVG(): Promise { - const svg = await this.svgContainer.innerHTML(); - return format(svg, { parser: 'html' }); + let svg = await this.svgContainer.innerHTML(); + svg = await format(svg, { parser: 'html' }); + return svg.replace(/id="viewport-.*?"/, 'id="viewport-{datetime}"'); } async submitSDL(sdl: string) { diff --git a/tests/demo.spec.ts-snapshots/custom-introspection-graph-Demo-linux.svg b/tests/demo.spec.ts-snapshots/custom-introspection-graph-Demo-linux.svg index 0ea3aec1..8bcd12fb 100644 --- a/tests/demo.spec.ts-snapshots/custom-introspection-graph-Demo-linux.svg +++ b/tests/demo.spec.ts-snapshots/custom-introspection-graph-Demo-linux.svg @@ -7,7 +7,7 @@ style="overflow: hidden" >