diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 615549cc4..e638a5935 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,17 +215,18 @@ jobs: with: name: online-ui - name: Setup webapp server - run: | - > echo ' + run: >- + echo ' include_shell "/usr/share/lighttpd/create-mime.conf.pl" - server.document-root = "./site" + server.document-root = "/home/runner/work/KappaTools/KappaTools/site" server.port = 12345 server.username = "root" server.groupname = "root" ' > lighttpd.conf - lighttpd -f lighttpd.conf -D + lighttpd -f lighttpd.conf -D & + sleep 10 && curl -i http://127.0.0.1:12345/index.html # test - name: Run Playwright tests - run: DEBUG=pw:webserver npx playwright test + run: DEBUG=pw:webserver npx playwright test --retries=3 --trace retain-on-failure - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: diff --git a/tests/playwright/lighttpd.conf b/tests/playwright/lighttpd.conf index 888817bb4..3ad26ded2 100644 --- a/tests/playwright/lighttpd.conf +++ b/tests/playwright/lighttpd.conf @@ -1,5 +1,5 @@ include_shell "/usr/share/lighttpd/create-mime.conf.pl" -server.document-root = "./build/site" +server.document-root = var.CWD + "/build/site" server.port = 12345 server.username = "root" server.groupname = "root" diff --git a/tests/playwright/procedure.spec.ts b/tests/playwright/procedure.spec.ts index 3a61d7538..006e79fa1 100644 --- a/tests/playwright/procedure.spec.ts +++ b/tests/playwright/procedure.spec.ts @@ -68,7 +68,7 @@ test.describe('Editor tab', () => { await utils.expect_no_error(page); }); - test('contact_map', async ({ page }) => { + test('contact_map', async ({ browserName, page }) => { await utils.open_app_with_model(page, abc_ka); const contact_map = page.locator('#map-container'); await expect.soft(contact_map).toHaveScreenshot(); @@ -88,11 +88,12 @@ test.describe('Editor tab', () => { await expect.soft(contact_map).toHaveScreenshot(); //export - await utils.testExports(page, '#export_contact-export', 'map', ['svg', 'png', 'json']); + await utils.testExports(page, '#export_contact-export', 'map', ['svg', 'png', 'json'], undefined, browserName); }); test('influences', async ({ page }) => { - const opts_screen = { threshold: 0.4 } + const opts_screen = { threshold: 0.2, maxDiffPixels: 60 } + const opts_screen_lenient = { threshold: 0.4, maxDiffPixels: 150 } await utils.open_app_with_model(page, abc_ka); await page.locator('#navinfluences').click(); const table = page.locator('#influences-table'); @@ -102,14 +103,14 @@ test.describe('Editor tab', () => { await page.getByRole('button', { name: 'First node' }).click(); await expect.soft(table).toHaveScreenshot(); await page.locator('#influence-rendering').selectOption('graph'); - await expect.soft(page.getByRole('img')).toHaveScreenshot(opts_screen); + await expect.soft(page.getByRole('img')).toHaveScreenshot(opts_screen_lenient); await page.locator('#influence-accuracy').selectOption('high'); await expect.soft(page.getByRole('img')).toHaveScreenshot(opts_screen); await page.getByRole('button', { name: 'Next' }).click(); await expect.soft(page.getByRole('img')).toHaveScreenshot(opts_screen); await page.getByRole('spinbutton', { name: 'Navigate' }).fill('2'); await page.getByRole('spinbutton', { name: 'Navigate' }).press('Enter'); - await expect.soft(page.getByRole('img')).toHaveScreenshot(opts_screen); + await expect.soft(page.getByRole('img')).toHaveScreenshot(opts_screen_lenient); // TODO: check why there is more issues on chromium? await page.locator('#influence-rendering').selectOption('tabular'); await page.getByRole('button', { name: 'Track cursor' }).click(); await page.locator('div:nth-child(10) > .CodeMirror-line > span > span:nth-child(7)').scrollIntoViewIfNeeded(); @@ -170,7 +171,7 @@ A(c[1]),C(a[1]) }); test('constraints_and_polymers_3', async ({ page }) => { - await utils.open_app_with_model(page, local_views_slide_69_ka, true); + await utils.open_app_with_model(page, local_views_slide_69_ka, true, 20000); await page.locator('#navconstraints').click(); await expect.soft(constraint_locator(page, 0)).toHaveText( `E(x) => [ E(x[.]) v E(x[x.R]) ] @@ -215,7 +216,8 @@ R(CN[C.R],CR[CR.R]) => R(CN[2],CR[1]),R(C[2],CR[1]) }); test('contact_map_accuracy', async ({ page }) => { - await utils.open_app_with_model(page, minikai_counters_ka, false, 50000); + test.setTimeout(180000) + await utils.open_app_with_model(page, minikai_counters_ka, false, 120000); const contact_map = page.locator('#map-container'); await expect.soft(contact_map).toHaveScreenshot(); await page.locator('#contact_map-accuracy').selectOption('high'); @@ -226,7 +228,7 @@ R(CN[C.R],CR[CR.R]) => R(CN[2],CR[1]),R(C[2],CR[1]) test.describe('Simulation tools', () => { - test('Simulation, plot', async ({ page }) => { + test('Simulation, plot', async ({ browserName, page }) => { await utils.open_app_with_model(page, abc_ka); await utils.setSeed(page, 1); // Run simulation to 30, then 100, then test plot options @@ -262,7 +264,8 @@ test.describe('Simulation tools', () => { await page.locator('.panel-footer').click(); // needed for update await expect.soft(page.getByRole('img')).toHaveScreenshot(); - await utils.testExports(page, '#export_plot-export', 'plot', ['svg', 'csv', 'json', 'tsv', 'png']); + await utils.testExports(page, '#export_plot-export', 'plot', ['csv', 'json', 'tsv'], undefined); + await utils.testExports(page, '#export_plot-export', 'plot', ['svg', 'png'], undefined, browserName); // Test larger plots, slider await utils.set_pause_if(page, '[T] > 2000'); @@ -294,6 +297,10 @@ test.describe('Simulation tools', () => { // Run simulation to 30, then 100, then test plot options await utils.set_pause_if(page, '[T] > 30'); await page.getByRole('button', { name: 'start' }).click(); + + await page.waitForTimeout(3000); + // await utils.wait_for_file_load(page, { timeout: 20000 }); // TODO: fix: glyphicon doesn't show properly + // await page.locator('#navDIN').click(); await expectScreenShotDINTable(); @@ -301,6 +308,10 @@ test.describe('Simulation tools', () => { await utils.set_pause_if(page, '[T] > 60'); await page.getByRole('button', { name: 'continue' }).click(); + + await page.waitForTimeout(3000); + // await utils.wait_for_file_load(page, { timeout: 20000 }); // TODO: fix: glyphicon doesn't show properly + // await expectScreenShotDINTable(); await page.getByRole('combobox').first().selectOption('flux.json'); await expectScreenShotDINTable(); @@ -311,18 +322,20 @@ test.describe('Simulation tools', () => { await expectScreenShotDINTable(); }); - test('snapshots', async ({ page }) => { + test('snapshots', async ({ browserName, page }) => { await utils.open_app_with_model(page, abc_ka); await utils.setSeed(page, 1); // Generate two snapshots await utils.set_pause_if(page, '[T] > 30'); await page.getByRole('button', { name: 'start' }).click(); + await utils.wait_for_sim_stop(page, { timeout: 10000 }); await utils.apply_perturbation(page, ''); await expect.soft(utils.get_error_field(page)).toHaveText(" « 1/1 » [] Problematic effect list "); await utils.apply_perturbation(page, '$SNAPSHOT'); await utils.set_pause_if(page, '[T] > 60'); await page.getByRole('button', { name: 'continue' }).click(); + await utils.wait_for_sim_stop(page, { timeout: 10000 }); await utils.apply_perturbation(page, '$SNAPSHOT "T60"'); // check log page @@ -399,11 +412,18 @@ test.describe('Simulation tools', () => { await utils.testExports(page, "#export_snapshot_kappa", "snapshot_kappa", ["json", "kappa", "dot"], ['', '', '"#\\w{5,6}"']); await page.locator('#format_select_id').selectOption('Graph'); - await utils.testExports(page, "#export_snapshot_graph", "snapshot_graph", ["json", "kappa", "dot", "svg", "png"], - ['', '', '"#\\w{5,6}"', ' { // Generate two snapshots await utils.set_pause_if(page, '[T] > 30'); await page.getByRole('button', { name: 'start' }).click(); + await utils.wait_for_sim_stop(page, { timeout: 10000 }); const print_time = '$PRINT "time: ".[T] > "time.txt"'; const print_ab = '$PRINT \'AB\' > "ab.txt"'; await utils.apply_perturbation(page, print_time); + await page.waitForTimeout(500); await utils.apply_perturbation(page, print_ab); await utils.set_pause_if(page, '[T] > 60'); await page.getByRole('button', { name: 'continue' }).click(); + await utils.wait_for_sim_stop(page, { timeout: 10000 }); await utils.apply_perturbation(page, print_time); + await page.waitForTimeout(500); await utils.apply_perturbation(page, print_ab); // check log page @@ -688,6 +712,9 @@ test.describe('projects_and_files', () => { // await page.waitForTimeout(2000); await expect(locator_project_tabs_list.locator('li').nth(n)).toHaveClass("active", { timeout: 10000 }); } + async function wait_for_project_nb(nb: number) { + await utils.expect_locator_toHaveInnerHtml(page, locator_project_tabs_text.nth(nb), "New project", 5000); + } // open new project const project_name = 'new_project' @@ -697,14 +724,17 @@ test.describe('projects_and_files', () => { await page.getByPlaceholder('project new').click(); await page.getByPlaceholder('project new').fill(project_name); await page.getByPlaceholder('project new').press('Enter'); + await wait_for_project_nb(2); // add new file "abc.ka" and fill it await page.getByRole('button', { name: 'File' }).click(); await page.locator('#menu-editor-file-new-li').click(); await page.getByRole('textbox', { name: 'file name' }).click(); await page.getByRole('textbox', { name: 'file name' }).fill('abc.ka'); await page.getByRole('textbox', { name: 'file name' }).press('Enter'); + await page.waitForTimeout(5000); await page.locator('.CodeMirror-scroll').click(); await utils.input_in_editor_from_url(page, abc_ka); + await utils.wait_for_file_load(page, { timeout: 10000 }); // switch and check contact_map change const contact_map = page.locator('#map-container'); @@ -758,6 +788,7 @@ test.describe('projects_and_files', () => { %mod: [true] do $TRACK 'S++' [true] ; ` ); + await utils.wait_for_file_load(page, { timeout: 10000 }); const contact_map = page.locator('#map-container'); await expect.soft(contact_map).toHaveScreenshot(); diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-1-chromium-linux.png new file mode 100644 index 000000000..2811b26ee Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-2-chromium-linux.png new file mode 100644 index 000000000..f6f08be6f Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-3-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-3-chromium-linux.png new file mode 100644 index 000000000..08e44d1c4 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-3-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-4-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-4-chromium-linux.png new file mode 100644 index 000000000..b34691624 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-4-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-5-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-5-chromium-linux.png new file mode 100644 index 000000000..2811b26ee Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-5-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-6-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-6-chromium-linux.png new file mode 100644 index 000000000..e37a480e1 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-6-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-7-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-7-chromium-linux.png new file mode 100644 index 000000000..2811b26ee Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-7-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-accuracy-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-accuracy-1-chromium-linux.png new file mode 100644 index 000000000..9553b5cd1 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-accuracy-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-accuracy-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-accuracy-2-chromium-linux.png new file mode 100644 index 000000000..359809ee4 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-contact-map-accuracy-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-1-chromium-linux.png new file mode 100644 index 000000000..69e3423fb Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-10-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-10-chromium-linux.png new file mode 100644 index 000000000..c2be14615 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-10-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-2-chromium-linux.png new file mode 100644 index 000000000..b4f164263 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-3-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-3-chromium-linux.png new file mode 100644 index 000000000..931dfe5c3 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-3-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-4-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-4-chromium-linux.png new file mode 100644 index 000000000..77357244d Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-4-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-5-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-5-chromium-linux.png new file mode 100644 index 000000000..35380d0ac Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-5-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-6-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-6-chromium-linux.png new file mode 100644 index 000000000..e86a2efab Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-6-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-7-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-7-chromium-linux.png new file mode 100644 index 000000000..6ef1cdacb Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-7-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-8-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-8-chromium-linux.png new file mode 100644 index 000000000..c2be14615 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-8-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-9-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-9-chromium-linux.png new file mode 100644 index 000000000..e3fdc6804 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Editor-tab-influences-9-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-1-chromium-linux.png new file mode 100644 index 000000000..70c86bc89 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-2-chromium-linux.png new file mode 100644 index 000000000..70c86bc89 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-3-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-3-chromium-linux.png new file mode 100644 index 000000000..1aa1addb9 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-3-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-4-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-4-chromium-linux.png new file mode 100644 index 000000000..70c86bc89 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-DIN-4-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-1-chromium-linux.png new file mode 100644 index 000000000..5b3f77905 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-10-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-10-chromium-linux.png new file mode 100644 index 000000000..f94aa9c7f Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-10-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-11-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-11-chromium-linux.png new file mode 100644 index 000000000..cf7c22d3b Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-11-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-12-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-12-chromium-linux.png new file mode 100644 index 000000000..4d7a86e29 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-12-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-13-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-13-chromium-linux.png new file mode 100644 index 000000000..1ad215cc6 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-13-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-2-chromium-linux.png new file mode 100644 index 000000000..f94aa9c7f Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-3-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-3-chromium-linux.png new file mode 100644 index 000000000..6803bb942 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-3-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-4-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-4-chromium-linux.png new file mode 100644 index 000000000..f3c4c16f9 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-4-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-5-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-5-chromium-linux.png new file mode 100644 index 000000000..4612a1f89 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-5-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-6-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-6-chromium-linux.png new file mode 100644 index 000000000..f94aa9c7f Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-6-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-7-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-7-chromium-linux.png new file mode 100644 index 000000000..5cf4e9c70 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-7-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-8-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-8-chromium-linux.png new file mode 100644 index 000000000..f94aa9c7f Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-8-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-9-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-9-chromium-linux.png new file mode 100644 index 000000000..8899f4f0b Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-Simulation-plot-9-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-1-chromium-linux.png new file mode 100644 index 000000000..be66186e5 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-2-chromium-linux.png new file mode 100644 index 000000000..b6a6fb37b Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-3-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-3-chromium-linux.png new file mode 100644 index 000000000..53ece67d8 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-3-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-4-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-4-chromium-linux.png new file mode 100644 index 000000000..c467c466e Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-4-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-5-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-5-chromium-linux.png new file mode 100644 index 000000000..199ff6e56 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-5-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-6-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-6-chromium-linux.png new file mode 100644 index 000000000..53226c765 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/Simulation-tools-snapshots-6-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-files-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-files-1-chromium-linux.png new file mode 100644 index 000000000..bcc9cc9f6 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-files-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-files-1-firefox-linux.png b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-files-1-firefox-linux.png index 343bf6cdc..4c2a16b4b 100644 Binary files a/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-files-1-firefox-linux.png and b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-files-1-firefox-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-1-chromium-linux.png new file mode 100644 index 000000000..2811b26ee Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-2-chromium-linux.png new file mode 100644 index 000000000..286af034b Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-3-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-3-chromium-linux.png new file mode 100644 index 000000000..2811b26ee Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/projects-and-files-project-3-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-1-chromium-linux.png new file mode 100644 index 000000000..d3662eb6b Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-2-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-2-chromium-linux.png new file mode 100644 index 000000000..aa0fad3d2 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-2-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-3-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-3-chromium-linux.png new file mode 100644 index 000000000..ae7d3ab21 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/stories-Causal-select-stories-3-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/stories-Strongly-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/stories-Strongly-1-chromium-linux.png new file mode 100644 index 000000000..aa0fad3d2 Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/stories-Strongly-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/stories-Weakly-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/stories-Weakly-1-chromium-linux.png new file mode 100644 index 000000000..666b8a3ee Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/stories-Weakly-1-chromium-linux.png differ diff --git a/tests/playwright/procedure.spec.ts-snapshots/stories-Weakly-Strongly-1-chromium-linux.png b/tests/playwright/procedure.spec.ts-snapshots/stories-Weakly-Strongly-1-chromium-linux.png new file mode 100644 index 000000000..666b8a3ee Binary files /dev/null and b/tests/playwright/procedure.spec.ts-snapshots/stories-Weakly-Strongly-1-chromium-linux.png differ diff --git a/tests/playwright/refs/map.json b/tests/playwright/refs/map_chromium.json similarity index 100% rename from tests/playwright/refs/map.json rename to tests/playwright/refs/map_chromium.json diff --git a/tests/playwright/refs/map_chromium.png b/tests/playwright/refs/map_chromium.png new file mode 100644 index 000000000..22e2ee090 Binary files /dev/null and b/tests/playwright/refs/map_chromium.png differ diff --git a/tests/playwright/refs/map_chromium.svg b/tests/playwright/refs/map_chromium.svg new file mode 100644 index 000000000..59ac960db --- /dev/null +++ b/tests/playwright/refs/map_chromium.svg @@ -0,0 +1,4 @@ + + +ABCcxxx1x2pupu \ No newline at end of file diff --git a/tests/playwright/refs/map_firefox.json b/tests/playwright/refs/map_firefox.json new file mode 100644 index 000000000..1d17d339f --- /dev/null +++ b/tests/playwright/refs/map_firefox.json @@ -0,0 +1 @@ +[[{"node_type":"A","node_sites":[{"site_name":"c","site_type":["port",{"port_links":[[[0,2],0],[[0,2],1]],"port_states":[]}]},{"site_name":"x","site_type":["port",{"port_links":[[[0,1],0]],"port_states":[]}]}]},{"node_type":"B","node_sites":[{"site_name":"x","site_type":["port",{"port_links":[[[0,0],1]],"port_states":[]}]}]},{"node_type":"C","node_sites":[{"site_name":"x1","site_type":["port",{"port_links":[[[0,0],0]],"port_states":["p","u"]}]},{"site_name":"x2","site_type":["port",{"port_links":[[[0,0],0]],"port_states":["p","u"]}]}]}]] \ No newline at end of file diff --git a/tests/playwright/refs/map.png b/tests/playwright/refs/map_firefox.png similarity index 100% rename from tests/playwright/refs/map.png rename to tests/playwright/refs/map_firefox.png diff --git a/tests/playwright/refs/map.svg b/tests/playwright/refs/map_firefox.svg similarity index 100% rename from tests/playwright/refs/map.svg rename to tests/playwright/refs/map_firefox.svg diff --git a/tests/playwright/refs/plot_chromium.png b/tests/playwright/refs/plot_chromium.png new file mode 100644 index 000000000..491eb7e3f Binary files /dev/null and b/tests/playwright/refs/plot_chromium.png differ diff --git a/tests/playwright/refs/plot_chromium.svg b/tests/playwright/refs/plot_chromium.svg new file mode 100644 index 000000000..68de19fb6 --- /dev/null +++ b/tests/playwright/refs/plot_chromium.svg @@ -0,0 +1,4 @@ + + +01020304050607080901000.001.00e+32.00e+33.00e+34.00e+35.00e+36.00e+37.00e+38.00e+39.00e+31.00e+4ABCuuCpuCpp \ No newline at end of file diff --git a/tests/playwright/refs/plot.png b/tests/playwright/refs/plot_firefox.png similarity index 100% rename from tests/playwright/refs/plot.png rename to tests/playwright/refs/plot_firefox.png diff --git a/tests/playwright/refs/plot.svg b/tests/playwright/refs/plot_firefox.svg similarity index 100% rename from tests/playwright/refs/plot.svg rename to tests/playwright/refs/plot_firefox.svg diff --git a/tests/playwright/refs/snapshot_graph.dot b/tests/playwright/refs/snapshot_graph.dot index 92fae30b1..19a486d0a 100644 --- a/tests/playwright/refs/snapshot_graph.dot +++ b/tests/playwright/refs/snapshot_graph.dot @@ -2,73 +2,73 @@ digraph G{ subgraph cluster0{ counter0 [label = "60 instance(s)", shape=none]; - node0_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node0_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node0_0_0 -> counter0 [style=invis]; - node0_0_1 [label = "B(x)", color = "#f0ef6", style=filled]; + node0_0_1 [label = "B(x)", color = "#b7539", style=filled]; node0_0_1 -> counter0 [style=invis]; - node0_0_2 [label = "C(x1{p} x2{u})", color = "#1bea26", style=filled]; + node0_0_2 [label = "C(x1{p} x2{u})", color = "#d2b8cc", style=filled]; node0_0_2 -> counter0 [style=invis]; node0_0_0 -> node0_0_1 [taillabel="x", headlabel="x", dir=none]; node0_0_0 -> node0_0_2 [taillabel="c", headlabel="x2", dir=none]; } subgraph cluster1{ counter1 [label = "111 instance(s)", shape=none]; - node1_0_0 [label = "B(x)", color = "#f0ef6", style=filled]; + node1_0_0 [label = "B(x)", color = "#b7539", style=filled]; node1_0_0 -> counter1 [style=invis]; - node1_0_1 [label = "A(x c)", color = "#7416e1", style=filled]; + node1_0_1 [label = "A(x c)", color = "#d315e5", style=filled]; node1_0_1 -> counter1 [style=invis]; - node1_0_2 [label = "C(x1{u} x2{u})", color = "#1bea26", style=filled]; + node1_0_2 [label = "C(x1{u} x2{u})", color = "#d2b8cc", style=filled]; node1_0_2 -> counter1 [style=invis]; node1_0_0 -> node1_0_1 [taillabel="x", headlabel="x", dir=none]; node1_0_1 -> node1_0_2 [taillabel="c", headlabel="x1", dir=none]; } subgraph cluster2{ counter2 [label = "20 instance(s)", shape=none]; - node2_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node2_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node2_0_0 -> counter2 [style=invis]; - node2_0_1 [label = "C(x1{u} x2{u})", color = "#1bea26", style=filled]; + node2_0_1 [label = "C(x1{u} x2{u})", color = "#d2b8cc", style=filled]; node2_0_1 -> counter2 [style=invis]; node2_0_0 -> node2_0_1 [taillabel="c", headlabel="x1", dir=none]; } subgraph cluster3{ counter3 [label = "112 instance(s)", shape=none]; - node3_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node3_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node3_0_0 -> counter3 [style=invis]; - node3_0_1 [label = "C(x1{p} x2{u})", color = "#1bea26", style=filled]; + node3_0_1 [label = "C(x1{p} x2{u})", color = "#d2b8cc", style=filled]; node3_0_1 -> counter3 [style=invis]; node3_0_0 -> node3_0_1 [taillabel="c", headlabel="x2", dir=none]; } subgraph cluster4{ counter4 [label = "1852 instance(s)", shape=none]; - node4_0_0 [label = "C(x1{p} x2{p})", color = "#1bea26", style=filled]; + node4_0_0 [label = "C(x1{p} x2{p})", color = "#d2b8cc", style=filled]; node4_0_0 -> counter4 [style=invis]; } subgraph cluster5{ counter5 [label = "2107 instance(s)", shape=none]; - node5_0_0 [label = "C(x1{p} x2{u})", color = "#1bea26", style=filled]; + node5_0_0 [label = "C(x1{p} x2{u})", color = "#d2b8cc", style=filled]; node5_0_0 -> counter5 [style=invis]; } subgraph cluster6{ counter6 [label = "5738 instance(s)", shape=none]; - node6_0_0 [label = "C(x1{u} x2{u})", color = "#1bea26", style=filled]; + node6_0_0 [label = "C(x1{u} x2{u})", color = "#d2b8cc", style=filled]; node6_0_0 -> counter6 [style=invis]; } subgraph cluster7{ counter7 [label = "223 instance(s)", shape=none]; - node7_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node7_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node7_0_0 -> counter7 [style=invis]; - node7_0_1 [label = "B(x)", color = "#f0ef6", style=filled]; + node7_0_1 [label = "B(x)", color = "#b7539", style=filled]; node7_0_1 -> counter7 [style=invis]; node7_0_0 -> node7_0_1 [taillabel="x", headlabel="x", dir=none]; } subgraph cluster8{ counter8 [label = "606 instance(s)", shape=none]; - node8_0_0 [label = "B(x)", color = "#f0ef6", style=filled]; + node8_0_0 [label = "B(x)", color = "#b7539", style=filled]; node8_0_0 -> counter8 [style=invis]; } subgraph cluster9{ counter9 [label = "474 instance(s)", shape=none]; - node9_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node9_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node9_0_0 -> counter9 [style=invis]; } } diff --git a/tests/playwright/refs/snapshot_graph_chromium.png b/tests/playwright/refs/snapshot_graph_chromium.png new file mode 100644 index 000000000..58cc7b94f Binary files /dev/null and b/tests/playwright/refs/snapshot_graph_chromium.png differ diff --git a/tests/playwright/refs/snapshot_graph_chromium.svg b/tests/playwright/refs/snapshot_graph_chromium.svg new file mode 100644 index 000000000..4cc5645ba --- /dev/null +++ b/tests/playwright/refs/snapshot_graph_chromium.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/tests/playwright/refs/snapshot_graph.png b/tests/playwright/refs/snapshot_graph_firefox.png similarity index 100% rename from tests/playwright/refs/snapshot_graph.png rename to tests/playwright/refs/snapshot_graph_firefox.png diff --git a/tests/playwright/refs/snapshot_graph.svg b/tests/playwright/refs/snapshot_graph_firefox.svg similarity index 100% rename from tests/playwright/refs/snapshot_graph.svg rename to tests/playwright/refs/snapshot_graph_firefox.svg diff --git a/tests/playwright/refs/snapshot_kappa.dot b/tests/playwright/refs/snapshot_kappa.dot index 92fae30b1..19a486d0a 100644 --- a/tests/playwright/refs/snapshot_kappa.dot +++ b/tests/playwright/refs/snapshot_kappa.dot @@ -2,73 +2,73 @@ digraph G{ subgraph cluster0{ counter0 [label = "60 instance(s)", shape=none]; - node0_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node0_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node0_0_0 -> counter0 [style=invis]; - node0_0_1 [label = "B(x)", color = "#f0ef6", style=filled]; + node0_0_1 [label = "B(x)", color = "#b7539", style=filled]; node0_0_1 -> counter0 [style=invis]; - node0_0_2 [label = "C(x1{p} x2{u})", color = "#1bea26", style=filled]; + node0_0_2 [label = "C(x1{p} x2{u})", color = "#d2b8cc", style=filled]; node0_0_2 -> counter0 [style=invis]; node0_0_0 -> node0_0_1 [taillabel="x", headlabel="x", dir=none]; node0_0_0 -> node0_0_2 [taillabel="c", headlabel="x2", dir=none]; } subgraph cluster1{ counter1 [label = "111 instance(s)", shape=none]; - node1_0_0 [label = "B(x)", color = "#f0ef6", style=filled]; + node1_0_0 [label = "B(x)", color = "#b7539", style=filled]; node1_0_0 -> counter1 [style=invis]; - node1_0_1 [label = "A(x c)", color = "#7416e1", style=filled]; + node1_0_1 [label = "A(x c)", color = "#d315e5", style=filled]; node1_0_1 -> counter1 [style=invis]; - node1_0_2 [label = "C(x1{u} x2{u})", color = "#1bea26", style=filled]; + node1_0_2 [label = "C(x1{u} x2{u})", color = "#d2b8cc", style=filled]; node1_0_2 -> counter1 [style=invis]; node1_0_0 -> node1_0_1 [taillabel="x", headlabel="x", dir=none]; node1_0_1 -> node1_0_2 [taillabel="c", headlabel="x1", dir=none]; } subgraph cluster2{ counter2 [label = "20 instance(s)", shape=none]; - node2_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node2_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node2_0_0 -> counter2 [style=invis]; - node2_0_1 [label = "C(x1{u} x2{u})", color = "#1bea26", style=filled]; + node2_0_1 [label = "C(x1{u} x2{u})", color = "#d2b8cc", style=filled]; node2_0_1 -> counter2 [style=invis]; node2_0_0 -> node2_0_1 [taillabel="c", headlabel="x1", dir=none]; } subgraph cluster3{ counter3 [label = "112 instance(s)", shape=none]; - node3_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node3_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node3_0_0 -> counter3 [style=invis]; - node3_0_1 [label = "C(x1{p} x2{u})", color = "#1bea26", style=filled]; + node3_0_1 [label = "C(x1{p} x2{u})", color = "#d2b8cc", style=filled]; node3_0_1 -> counter3 [style=invis]; node3_0_0 -> node3_0_1 [taillabel="c", headlabel="x2", dir=none]; } subgraph cluster4{ counter4 [label = "1852 instance(s)", shape=none]; - node4_0_0 [label = "C(x1{p} x2{p})", color = "#1bea26", style=filled]; + node4_0_0 [label = "C(x1{p} x2{p})", color = "#d2b8cc", style=filled]; node4_0_0 -> counter4 [style=invis]; } subgraph cluster5{ counter5 [label = "2107 instance(s)", shape=none]; - node5_0_0 [label = "C(x1{p} x2{u})", color = "#1bea26", style=filled]; + node5_0_0 [label = "C(x1{p} x2{u})", color = "#d2b8cc", style=filled]; node5_0_0 -> counter5 [style=invis]; } subgraph cluster6{ counter6 [label = "5738 instance(s)", shape=none]; - node6_0_0 [label = "C(x1{u} x2{u})", color = "#1bea26", style=filled]; + node6_0_0 [label = "C(x1{u} x2{u})", color = "#d2b8cc", style=filled]; node6_0_0 -> counter6 [style=invis]; } subgraph cluster7{ counter7 [label = "223 instance(s)", shape=none]; - node7_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node7_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node7_0_0 -> counter7 [style=invis]; - node7_0_1 [label = "B(x)", color = "#f0ef6", style=filled]; + node7_0_1 [label = "B(x)", color = "#b7539", style=filled]; node7_0_1 -> counter7 [style=invis]; node7_0_0 -> node7_0_1 [taillabel="x", headlabel="x", dir=none]; } subgraph cluster8{ counter8 [label = "606 instance(s)", shape=none]; - node8_0_0 [label = "B(x)", color = "#f0ef6", style=filled]; + node8_0_0 [label = "B(x)", color = "#b7539", style=filled]; node8_0_0 -> counter8 [style=invis]; } subgraph cluster9{ counter9 [label = "474 instance(s)", shape=none]; - node9_0_0 [label = "A(x c)", color = "#7416e1", style=filled]; + node9_0_0 [label = "A(x c)", color = "#d315e5", style=filled]; node9_0_0 -> counter9 [style=invis]; } } diff --git a/tests/playwright/webapp_utils.ts b/tests/playwright/webapp_utils.ts index b10a198f3..bf63c838b 100644 --- a/tests/playwright/webapp_utils.ts +++ b/tests/playwright/webapp_utils.ts @@ -12,8 +12,8 @@ const arg_set_model = '?model=https%3A' const referencesDir = 'tests/playwright/refs/' -function timeout_of_options(options?: { timeout?: number | undefined; visible?: boolean | undefined; } | undefined) { - var timeout = 5000; +function timeout_of_options(options: { timeout?: number | undefined; visible?: boolean | undefined; } | undefined, default_timeout: number = 5000) { + var timeout = default_timeout; if (options !== undefined) { if (options.timeout !== undefined) { timeout = options.timeout; @@ -25,7 +25,7 @@ function timeout_of_options(options?: { timeout?: number | undefined; visible?: // TODO: test for contains and not == // Used as playwright does not seemed to offer a way to have this logic -async function expect_locator_toHaveInnerHtml(page: Page, locator: Locator, value: any, timeout: number, retry_timeout: number = 500, allow_include: boolean = false) { +export async function expect_locator_toHaveInnerHtml(page: Page, locator: Locator, value: any, timeout: number, retry_timeout: number = 500, allow_include: boolean = false) { const end_time: number = Date.now() + timeout; var is_equal: boolean = false; while (Date.now() < end_time && !(is_equal)) { @@ -41,7 +41,7 @@ async function expect_locator_toHaveInnerHtml(page: Page, locator: Locator, valu } export async function wait_for_project_ready_status(page: Page, options?: { timeout?: number | undefined; visible?: boolean | undefined; } | undefined, check_busy_first: boolean = false, project_name: string | undefined = undefined) { - const timeout = timeout_of_options(options); + const timeout = timeout_of_options(options, 15000); const locator_first_tab = page.getByRole('list').locator('a').first(); if (check_busy_first) { @@ -141,13 +141,23 @@ export async function apply_perturbation(page: Page, s: string) { } // Write in `referencesDir` the file named `fileName` as a copy of `filePath` -export async function write_ref(filePath: string, fileName: string) { +async function write_ref(filePath: string, fileName: string) { expect.soft(filePath).toBeTruthy(); const refFilePath = path.join(referencesDir, fileName); fs.copyFileSync(filePath, refFilePath); } -export function regex_of_str(s: string, option: string = "g"): RegExp { +function write_str_ref(test: string, fileName: string) { + const filePath = path.join(referencesDir, fileName); + fs.writeFile(filePath, test, + err => { + if (err) { + console.error(`Error writing to file: ${err}`); + } + }); +} + +function regex_of_str(s: string, option: string = "g"): RegExp { try { const r = new RegExp(s, option); return r; @@ -162,66 +172,67 @@ function escape_string_for_regex(s: string): string { return s.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&'); } +function add_to_filename_before_ext(name: string, to_add: string) { + var name_splitted = name.split('.'); + const extension = name_splitted.pop(); + return (name_splitted.join('.') + to_add + '.' + extension); +} + +function make_filename_with_browserName(name: string, browserName: string | undefined) { + if (browserName == undefined) { + return name; + } else { + return add_to_filename_before_ext(name, '_' + browserName); + } +} + // Returns a regex matching [s] with matches of [pattern] replaced by the [pattern] // Used to avoid mismatching colors in exports, as it's different according to how playwright is run… function regex_matching_str_with_pattern_replaced(s: string, pattern: string): RegExp { const s_escaped = escape_string_for_regex(s); - console.error(s_escaped); const regex_pattern = regex_of_str(pattern, "g"); - console.error(regex_pattern); + // console.debug(s_escaped); + // console.debug(regex_pattern); return regex_of_str(s_escaped.replace(regex_pattern, pattern), ""); } -export async function compare_download_to_ref(download: Download, fileName: string, pattern_ignore: string = "", writeRef: boolean = false) { - const filePath = await download.path(); - expect.soft(filePath).toBeTruthy(); - if (writeRef || process.env.UPDATE_EXPORTS === 'true') { +export async function compare_download_to_ref(download: Download, name: string, pattern_ignore: string = "", browserName: string | undefined = undefined) { + const fileName = make_filename_with_browserName(name, browserName); + const downloadPath = await download.path(); + expect.soft(downloadPath).toBeTruthy(); + if (process.env.UPDATE_EXPORTS === 'true') { console.info(`Writing ref file: ${fileName}`); - await write_ref(filePath, fileName); + await write_ref(downloadPath, fileName); } const refFilePath = path.join(referencesDir, fileName); - const downloadedContent = await fs.promises.readFile(filePath, 'utf8'); + const downloadedContent = await fs.promises.readFile(downloadPath, 'utf8'); const referenceContent = await fs.promises.readFile(refFilePath, 'utf8'); if (pattern_ignore == "") { expect.soft(downloadedContent).toBe(referenceContent); } else { const regex_ref_test: RegExp = regex_matching_str_with_pattern_replaced(referenceContent, pattern_ignore); - - // TODO : clean this - console.error(regex_ref_test); - expect.soft(downloadedContent).toMatch(regex_ref_test); - } } -export async function write_str_ref(test: string, fileName: string) { - const filePath = path.join(referencesDir, fileName); - fs.writeFile(filePath, test, - err => { - if (err) { - console.error(`Error writing to file: ${err}`); - } - }); -} export async function get_ref(fileName: string) { const refFilePath = path.join(referencesDir, fileName); const referenceContent = await fs.promises.readFile(refFilePath, 'utf8'); return referenceContent; } -export async function compare_str_to_ref(text: string, fileName: string, writeRef: boolean = false) { - if (writeRef || process.env.UPDATE_EXPORTS === 'true') { - await write_str_ref(text, fileName); +export async function compare_str_to_ref(text: string, fileName: string) { + if (process.env.UPDATE_EXPORTS === 'true') { + write_str_ref(text, fileName); } const refFilePath = path.join(referencesDir, fileName); const referenceContent = await fs.promises.readFile(refFilePath, 'utf8'); expect.soft(text).toBe(referenceContent); } -export async function testExports(page: Page, exportLocatorPrefix: string, fileBaseName: string, extensions: string[], pattern_ignores: string[] = [], writeRef: boolean = false) { +export async function testExports(page: Page, exportLocatorPrefix: string, fileBaseName: string, extensions: string[], pattern_ignores: string[] = [], browserName: string | undefined = undefined) { const exportFilenameLoc = page.locator(exportLocatorPrefix + "_filename"); const exportSelectLoc = page.locator(exportLocatorPrefix + "_select"); @@ -239,7 +250,7 @@ export async function testExports(page: Page, exportLocatorPrefix: string, fileB const download = await downloadPromise; const pattern_ignore = pattern_ignores_present ? pattern_ignores[i] : ""; - await compare_download_to_ref(download, fileName, writeRef, pattern_ignore); + await compare_download_to_ref(download, fileName, pattern_ignore, browserName); } }