From 9e329e71fece0101856e0f12862051a637bf3edf Mon Sep 17 00:00:00 2001
From: Damien Iriberry <damien.iriberry@artal.fr>
Date: Tue, 26 Sep 2023 15:03:10 +0200
Subject: [PATCH] Fix individual tests

---
 .gitlab-ci.yml                                            | 4 ++--
 ivette/src/dome/main/dome.ts                              | 4 ++--
 ivette/tests/e2e-playwright/libs/e2eService.ts            | 3 ++-
 ivette/tests/e2e-playwright/monkey/monkey-testing.spec.ts | 4 ++--
 ivette/tests/e2e-playwright/server-connection.spec.ts     | 2 +-
 ivette/tests/settings.json                                | 4 ++--
 6 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a38b106e794..0637083db90 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -233,12 +233,12 @@ ivette-tests:
     - make clean && make && make -C ivette dist
     - cd ivette
     - cp dist/renderer/* dist/main/
-    - xvfb-run --auto-servernum -e /dev/stdout -s "-screen 0 1280x1024x24 -ac -nolisten tcp -nolisten unix" npx playwright test --headed
+    - xvfb-run --auto-servernum -e /dev/stdout -s "-screen 0 1920x1080x24 -ac -nolisten tcp -nolisten unix" yarn playwright test --headed
   artifacts:
     paths:
       - ivette/test-results
       - ivette/screenshots
-    when: on_failure
+    when: always
     expire_in: 1 day
   tags:
     - docker
diff --git a/ivette/src/dome/main/dome.ts b/ivette/src/dome/main/dome.ts
index e375ee8eb97..8666c363928 100644
--- a/ivette/src/dome/main/dome.ts
+++ b/ivette/src/dome/main/dome.ts
@@ -408,8 +408,8 @@ function createBrowserWindow(
   let configFile = PATH_WINDOW_SETTINGS;
   if (argv && argv.includes('--with-fixed-settings')) {
     configFile =
-      argv[process.argv.indexOf('--with-fixed-settings') + 1];
-    argv = process.argv.filter((p) => !!p && p !== "--with-fixed-settings");
+      argv[argv.indexOf('--with-fixed-settings') + 1];
+    argv = argv.filter((p) => !!p && p !== "--with-fixed-settings" && p !== configFile);
   } else if (isAppWindow) {
     configFile = lookupConfig(wdir);
   }
diff --git a/ivette/tests/e2e-playwright/libs/e2eService.ts b/ivette/tests/e2e-playwright/libs/e2eService.ts
index da2b61101a8..9d1a1fa02a7 100644
--- a/ivette/tests/e2e-playwright/libs/e2eService.ts
+++ b/ivette/tests/e2e-playwright/libs/e2eService.ts
@@ -46,7 +46,8 @@ export const argsLaunchWithDefaultSettings: string[] = [
 // e2e tests using an additional C file loaded
 export const argsLaunchWithTestFile: string[] = [
   "./dist/main/main.js",
-  "--no-sandbox",
+  "--with-fixed-settings",
+  "./tests/settings.json",
   "--command",
   "../bin/frama-c",
   "../tests/test/adpcm.c",
diff --git a/ivette/tests/e2e-playwright/monkey/monkey-testing.spec.ts b/ivette/tests/e2e-playwright/monkey/monkey-testing.spec.ts
index 290e47c36b7..a4694902ac8 100644
--- a/ivette/tests/e2e-playwright/monkey/monkey-testing.spec.ts
+++ b/ivette/tests/e2e-playwright/monkey/monkey-testing.spec.ts
@@ -26,9 +26,9 @@ import * as e2eService from "../libs/e2eService";
 /* eslint-disable  @typescript-eslint/no-explicit-any */
 let gremlins: any;
 
-test.skip("run gremlins.js", async () => {
+test("run gremlins.js", async () => {
   const launchAppResult = await e2eService.launchApp(
-    e2eService.argsLaunchWithDefaultSettings,
+    e2eService.argsDefaultLaunch,
   );
   const electronApp = launchAppResult.app;
   const window = launchAppResult.page;
diff --git a/ivette/tests/e2e-playwright/server-connection.spec.ts b/ivette/tests/e2e-playwright/server-connection.spec.ts
index d82b970264f..79a8f3e33d0 100644
--- a/ivette/tests/e2e-playwright/server-connection.spec.ts
+++ b/ivette/tests/e2e-playwright/server-connection.spec.ts
@@ -25,7 +25,7 @@ import * as e2eService from "./libs/e2eService";
 
 test("check server connection", async () => {
   const launchAppResult = await e2eService.launchApp(
-    e2eService.argsDefaultLaunch,
+    e2eService.argsLaunchWithDefaultSettings,
   );
   const electronApp = launchAppResult.app;
   const window = launchAppResult.page;
diff --git a/ivette/tests/settings.json b/ivette/tests/settings.json
index 948b0797535..f8dfd808891 100644
--- a/ivette/tests/settings.json
+++ b/ivette/tests/settings.json
@@ -2,8 +2,8 @@
     "frame": {
         "x": 100,
         "y": 100,
-        "width": 1000,
-        "height": 750
+        "width": 1900,
+        "height": 1060
     },
     "settings": {
         "frama-c.labview.shape": {
-- 
GitLab