Skip to content

Commit

Permalink
fixing tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinepouille committed Nov 7, 2024
1 parent b800902 commit 0cf2a10
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
6 changes: 6 additions & 0 deletions gui/resources/JsSim.css
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,19 @@ form {
fill: none;
stroke: transparent;
}

#din_table_id {
font-variant-numeric: tabular-nums;
}

.snap-tooltip {
position: absolute;
text-align: right;
white-space: pre;
bottom: 0;
right: 0;
pointer-events: none;
font-variant-numeric: tabular-nums;
}

.tooltip {
Expand Down
8 changes: 7 additions & 1 deletion gui/ui/panel_tabs/tab_din.ml
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ let din_table : Html_types.tbody Html.elt ReactiveData.RList.t =
[ Html.tbody body ])
din_data)

let din_table_id = "din-table-id"

let din : [> Html_types.tablex ] Html.elt =
let thead = React.S.const (Tyxml_js.R.Html5.thead din_header) in
Tyxml_js.R.Html5.tablex
~a:[ Html.a_class [ "table"; "table-condensed"; "table-bordered" ] ]
~a:
[
Html.a_class [ "table"; "table-condensed"; "table-bordered" ];
Html.a_id din_table_id;
]
~thead din_table

let export_current_din (to_string : Data.din -> string) (mime : string)
Expand Down
19 changes: 14 additions & 5 deletions tests/playwright/procedure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ test.describe('Editor tab', () => {
await page.getByRole('button', { name: 'Reset Zoom' }).click();
await expect.soft(contact_map).toHaveScreenshot();

//export
await utils.testExports(page, '#export_contact-export', 'map', ['svg', 'png', 'json'], undefined, browserName);
await utils.testExports(page, '#export_contact-export', 'map', ['svg', 'json'], undefined, browserName);
if (browserName != "chromium") {
await utils.testExports(page, '#export_contact-export', 'map', ['png'], undefined, browserName);
// TODO: pngs doesn't match on CI's chromium. check if we can test them in some way
}

});

test('influences', async ({ page }) => {
Expand Down Expand Up @@ -266,7 +270,11 @@ test.describe('Simulation tools', () => {
await expect.soft(page.getByRole('img')).toHaveScreenshot();

await utils.testExports(page, '#export_plot-export', 'plot', ['csv', 'json', 'tsv'], undefined);
await utils.testExports(page, '#export_plot-export', 'plot', ['svg', 'png'], undefined, browserName);
await utils.testExports(page, '#export_plot-export', 'plot', ['svg'], undefined, browserName);
if (browserName != "chromium") {
await utils.testExports(page, '#export_plot-export', 'plot', ['png'], undefined, browserName);
// TODO: pngs doesn't match on CI's chromium. check if we can test them in some way
}

// Test larger plots, slider
await utils.set_pause_if(page, '[T] > 2000');
Expand Down Expand Up @@ -419,11 +427,12 @@ test.describe('Simulation tools', () => {
['<svg class="svg.*'], browserName);
if (browserName != "chromium") {
await utils.testExports(page, "#export_snapshot_graph", "snapshot_graph", ["png"],
[""], browserName);
undefined, browserName);
// TODO: pngs doesn't match on CI's chromium. check if we can test them in some way
}
// note: dot and svg export have special change as there is variance on their outputs if ran in playwright through the cli or through --ui …
// dot : don't check colors, svg: only check there is a svg header
// TODO: more complete match for svg, where the difference seems to be in the sizes…, check png
// TODO: more complete match for svg, where the difference seems to be in the sizes…
// Graphics are different between firefox and chrome… and on chrome png is also different between --ui and cli uuuuuh

});
Expand Down
Binary file removed tests/playwright/refs/map_chromium.png
Binary file not shown.
Binary file removed tests/playwright/refs/plot_chromium.png
Binary file not shown.

0 comments on commit 0cf2a10

Please sign in to comment.