From 92294b136851e7610fe2f4d45a5ca0f2e1cc98f9 Mon Sep 17 00:00:00 2001
From: Artur Carvalho <artur.carvalho@uni.lu>
Date: Wed, 18 Jan 2023 13:03:47 +0100
Subject: [PATCH] Add ci initial configuration

---
 .gitlab-ci.yml       | 22 ++++++++++++++++++++++
 e2e/vue.spec.ts      |  2 +-
 playwright.config.ts |  2 +-
 3 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..9cca45d
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,22 @@
+stages:
+  - build
+  - test
+
+build app:
+  stage: build
+  image: node:16-alpine
+  script:
+    - npm ci
+    - npm run build
+    - echo "ENV URL $CI_ENVIRONMENT_URL"
+  artifacts:
+    paths:
+      - build
+
+unit tests:
+  stage: test
+  image: node:16-alpine
+  script:
+    - npm ci
+    - npm run test
+
diff --git a/e2e/vue.spec.ts b/e2e/vue.spec.ts
index 7237179..39923f7 100644
--- a/e2e/vue.spec.ts
+++ b/e2e/vue.spec.ts
@@ -4,5 +4,5 @@ import { test, expect } from "@playwright/test";
 // https://playwright.dev/docs/intro
 test("visits the app root url", async ({ page }) => {
   await page.goto("/");
-  await expect(page.locator("div.greetings > h1")).toHaveText("You did it!");
+  await expect(page.locator("#app > div > main")).toHaveText("This is a Vvue playground.");
 });
diff --git a/playwright.config.ts b/playwright.config.ts
index 03c0653..2cb61c0 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -34,7 +34,7 @@ const config: PlaywrightTestConfig = {
     /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
     actionTimeout: 0,
     /* Base URL to use in actions like `await page.goto('/')`. */
-    baseURL: "http://localhost:5173",
+    baseURL: process.env.CI_ENVIRONMENT_URL || "http://localhost:5173",
 
     /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
     trace: "on-first-retry",
-- 
GitLab