From 7fa04919a6666c07c8d5e0120cb520e4b58091fa Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Wed, 3 Jul 2024 18:04:48 +0200
Subject: [PATCH 1/5] 1859: Fixed configurable base path
---
.gitignore | 12 ++++++------
CHANGELOG.md | 1 +
README.md | 2 +-
index.html | 1 +
infrastructure/itkdev/Dockerfile | 4 +++-
infrastructure/os2display/Dockerfile | 4 +++-
package.json | 2 +-
src/app.jsx | 3 ++-
src/config-loader.js | 4 +++-
src/index.jsx | 3 ++-
src/variables.js | 6 ++++++
11 files changed, 29 insertions(+), 13 deletions(-)
create mode 100644 src/variables.js
diff --git a/.gitignore b/.gitignore
index 43313a33..3d9cae3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,13 +28,13 @@ yarn-error.log*
# Temp files
temp/
-# API mock
-json-server/
-
-public/config.json
-public/access-config.json
-public/release.json
+# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
+
+# Json files in public folder
+public/config.json
+public/access-config.json
+public/release.json
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2afe3020..7980e471 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
+- Fixed configurable base path.
- Changed from vite CJS to ESM.
- Removed array spread.
- Fixed HMR setup.
diff --git a/README.md b/README.md
index 2c9d36c5..5b276bc4 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ description of the admin.
### Create public/config file
-By default the api that is requested is located at `/api/`.
+By default, the api that is requested is located at `/api/`.
This can be configured by:
```shell
diff --git a/index.html b/index.html
index 432f6f6e..fc185545 100644
--- a/index.html
+++ b/index.html
@@ -1,6 +1,7 @@
+
diff --git a/infrastructure/itkdev/Dockerfile b/infrastructure/itkdev/Dockerfile
index 1c28b85d..515c14ed 100644
--- a/infrastructure/itkdev/Dockerfile
+++ b/infrastructure/itkdev/Dockerfile
@@ -13,9 +13,11 @@ RUN mkdir -p ${APP_PATH} \
WORKDIR ${APP_PATH}
+ARG APP_BASE_PATH=/admin/
+
# Build it.
RUN yarn install \
- && yarn build
+ && BASE_PATH=${APP_BASE_PATH} yarn build
# Remove fixtures
RUN rm -rf public/fixtures
diff --git a/infrastructure/os2display/Dockerfile b/infrastructure/os2display/Dockerfile
index 1c28b85d..515c14ed 100644
--- a/infrastructure/os2display/Dockerfile
+++ b/infrastructure/os2display/Dockerfile
@@ -13,9 +13,11 @@ RUN mkdir -p ${APP_PATH} \
WORKDIR ${APP_PATH}
+ARG APP_BASE_PATH=/admin/
+
# Build it.
RUN yarn install \
- && yarn build
+ && BASE_PATH=${APP_BASE_PATH} yarn build
# Remove fixtures
RUN rm -rf public/fixtures
diff --git a/package.json b/package.json
index bd50910b..c8e656b3 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,7 @@
"check-coding-standards": "yarn lint:js && yarn lint:scss",
"apply-coding-standards": "yarn lint:js:fix && yarn lint:scss:fix",
"start": "vite --host 0.0.0.0",
- "build": "vite build",
+ "build": "vite build --base=$BASE_PATH",
"preview": "vite preview"
},
"eslintConfig": {
diff --git a/src/app.jsx b/src/app.jsx
index 2a417fb4..df25b716 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -42,6 +42,7 @@ import ActivationCodeActivate from "./components/activation-code/activation-code
import ConfigLoader from "./config-loader";
import "react-toastify/dist/ReactToastify.css";
import "./app.scss";
+import { BASE_PATH } from "./variables";
/**
* App component.
@@ -141,7 +142,7 @@ function App() {
}, []);
useEffect(() => {
- fetch("/admin/access-config.json")
+ fetch(`${BASE_PATH}access-config.json`)
.then((response) => response.json())
.then((jsonData) => {
setAccessConfig(jsonData);
diff --git a/src/config-loader.js b/src/config-loader.js
index c46bbc80..494c2808 100644
--- a/src/config-loader.js
+++ b/src/config-loader.js
@@ -1,3 +1,5 @@
+import { BASE_PATH } from "./variables";
+
let configData = null;
let activePromise = null;
@@ -11,7 +13,7 @@ const ConfigLoader = {
if (configData !== null) {
resolve(configData);
} else {
- fetch("/config.json")
+ fetch(`${BASE_PATH}config.json`)
.then((response) => response.json())
.then((data) => {
configData = data;
diff --git a/src/index.jsx b/src/index.jsx
index fa4d7780..cc42de5e 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -4,13 +4,14 @@ import { createRoot } from "react-dom/client";
import { Provider } from "react-redux";
import { store } from "./redux/store";
import App from "./app";
+import { BASE_PATH } from "./variables";
const container = document.getElementById("root");
const root = createRoot(container);
root.render(
-
+
diff --git a/src/variables.js b/src/variables.js
new file mode 100644
index 00000000..d9c0c9f8
--- /dev/null
+++ b/src/variables.js
@@ -0,0 +1,6 @@
+// The element base_path is set in index.html.
+// eslint-disable-next-line no-undef
+const BASE_PATH = document.getElementById("base_path").getAttribute("href") ?? "/";
+
+// eslint-disable-next-line import/prefer-default-export
+export { BASE_PATH };
From 9dd383e1f15a8bf22662ba83bbf24687b52c1868 Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Thu, 4 Jul 2024 14:54:53 +0200
Subject: [PATCH 2/5] 1859: Fixed build dir
---
index.html | 2 +-
src/variables.js | 3 ++-
vite.config.js | 4 ++++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index fc185545..727d0c8f 100644
--- a/index.html
+++ b/index.html
@@ -16,6 +16,6 @@
-
+
diff --git a/src/variables.js b/src/variables.js
index d9c0c9f8..013ac1a3 100644
--- a/src/variables.js
+++ b/src/variables.js
@@ -1,6 +1,7 @@
// The element base_path is set in index.html.
// eslint-disable-next-line no-undef
-const BASE_PATH = document.getElementById("base_path").getAttribute("href") ?? "/";
+const BASE_PATH =
+ document.getElementById("base_path").getAttribute("href") ?? "/";
// eslint-disable-next-line import/prefer-default-export
export { BASE_PATH };
diff --git a/vite.config.js b/vite.config.js
index b0955946..a59332be 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -4,6 +4,10 @@ import react from "@vitejs/plugin-react-swc";
export default defineConfig({
base: "/",
plugins: [react()],
+ build: {
+ outDir: "build",
+ emptyOutDir: true,
+ },
server: {
strictPort: true,
port: 3000,
From 2345fbeabe0a8855eeef44d39c99ca6d20388fa3 Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Fri, 5 Jul 2024 11:09:29 +0200
Subject: [PATCH 3/5] 1859: Changed path for tests
---
e2e/campaign.spec.js | 2 +-
e2e/login.spec.js | 12 ++++++------
e2e/media.spec.js | 2 +-
e2e/playlist.spec.js | 4 ++--
e2e/screen-groups.spec.js | 4 ++--
e2e/screens.spec.js | 4 ++--
e2e/shared-list.spec.js | 2 +-
e2e/slides.spec.js | 4 ++--
e2e/theme.spec.js | 5 +++--
e2e/top-bar.spec.js | 36 +++++++++++++++++++-----------------
10 files changed, 39 insertions(+), 36 deletions(-)
diff --git a/e2e/campaign.spec.js b/e2e/campaign.spec.js
index 5b1c7fef..0844908f 100644
--- a/e2e/campaign.spec.js
+++ b/e2e/campaign.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Campaign pages work", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/campaign/create");
+ await page.goto("/campaign/create");
await page.route("**/slides*", async (route) => {
const json = {
"@id": "/v2/slides",
diff --git a/e2e/login.spec.js b/e2e/login.spec.js
index 99a99d12..4e6fde53 100644
--- a/e2e/login.spec.js
+++ b/e2e/login.spec.js
@@ -22,7 +22,7 @@ test.describe("Login works", () => {
await route.fulfill({ json });
});
- await page.goto("/admin/playlist/list");
+ await page.goto("/playlist/list");
await page.locator("#login").click();
await expect(page.locator(".name")).toHaveText("John Doe");
});
@@ -59,14 +59,14 @@ test.describe("Login works", () => {
};
await route.fulfill({ json });
});
- await page.goto("/admin/group/list");
+ await page.goto("/group/list");
await page.locator("#login").click();
// Expect dropdown with tenants
await expect(page.locator(".dropdown-container")).toBeVisible();
});
test("Login with tenant that has role editor", async ({ page }) => {
- await page.goto("/admin/playlist/list");
+ await page.goto("/playlist/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -87,7 +87,7 @@ test.describe("Login works", () => {
await route.fulfill({ json });
});
- await page.goto("/admin/group/list");
+ await page.goto("/group/list");
await page.locator("#login").click();
await expect(page.locator(".name")).toHaveText("John Doe");
await expect(page.locator(".sidebar-nav").locator(".nav-item")).toHaveCount(
@@ -98,7 +98,7 @@ test.describe("Login works", () => {
test("Role editor should not be able to visit restricted route", async ({
page,
}) => {
- await page.goto("/admin/playlist/list");
+ await page.goto("/playlist/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -118,7 +118,7 @@ test.describe("Login works", () => {
};
await route.fulfill({ json });
});
- await page.goto("/admin/shared/list");
+ await page.goto("/shared/list");
await page.locator("#login").click();
await expect(page.locator("main").locator("div")).toHaveText(
"Du har ikke adgang til denne side"
diff --git a/e2e/media.spec.js b/e2e/media.spec.js
index 1382779c..fcd36560 100644
--- a/e2e/media.spec.js
+++ b/e2e/media.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("media list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/media/list");
+ await page.goto("/media/list");
await page.route("**/media*", async (route) => {
const json = {
"@context": "/contexts/Media",
diff --git a/e2e/playlist.spec.js b/e2e/playlist.spec.js
index 5590ac22..79bb79d8 100644
--- a/e2e/playlist.spec.js
+++ b/e2e/playlist.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Playlist create tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/playlist/create");
+ await page.goto("/playlist/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -107,7 +107,7 @@ test.describe("Playlist create tests", () => {
});
test.describe("Playlist list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/playlist/list");
+ await page.goto("/playlist/list");
await page.route("**/playlists*", async (route) => {
const json = {
"@context": "/contexts/Playlist",
diff --git a/e2e/screen-groups.spec.js b/e2e/screen-groups.spec.js
index 40b4876e..05c287b7 100644
--- a/e2e/screen-groups.spec.js
+++ b/e2e/screen-groups.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Create group page works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/group/create");
+ await page.goto("/group/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -91,7 +91,7 @@ test.describe("Create group page works", () => {
test.describe("Groups list works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/group/list");
+ await page.goto("/group/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
diff --git a/e2e/screens.spec.js b/e2e/screens.spec.js
index 7d7b52fd..551d52b1 100644
--- a/e2e/screens.spec.js
+++ b/e2e/screens.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Screen list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/screen/list");
+ await page.goto("/screen/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -121,7 +121,7 @@ test.describe("Screen list tests", () => {
test.describe("Screen create tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/screen/create");
+ await page.goto("/screen/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
diff --git a/e2e/shared-list.spec.js b/e2e/shared-list.spec.js
index 3a609976..ed9b15f1 100644
--- a/e2e/shared-list.spec.js
+++ b/e2e/shared-list.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Shared list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/shared/list");
+ await page.goto("/shared/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
diff --git a/e2e/slides.spec.js b/e2e/slides.spec.js
index 9cc0de47..243cffdf 100644
--- a/e2e/slides.spec.js
+++ b/e2e/slides.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Create slide page works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/slide/create");
+ await page.goto("/slide/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -163,7 +163,7 @@ test.describe("Create slide page works", () => {
test.describe("Slides list works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/slide/list");
+ await page.goto("/slide/list");
await page.route("**/slides*", async (route) => {
const json = {
"@id": "/v2/slides",
diff --git a/e2e/theme.spec.js b/e2e/theme.spec.js
index 4efe645f..0a6664b6 100644
--- a/e2e/theme.spec.js
+++ b/e2e/theme.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Theme pages work", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/themes/list");
+ await page.goto("/themes/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -70,9 +70,10 @@ test.describe("Theme pages work", () => {
await expect(page.locator("#cancel_theme")).not.toBeVisible();
});
});
+
test.describe("Themes list work", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/themes/list");
+ await page.goto("/themes/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
diff --git a/e2e/top-bar.spec.js b/e2e/top-bar.spec.js
index 0e539001..61a7d12f 100644
--- a/e2e/top-bar.spec.js
+++ b/e2e/top-bar.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Nav items loads", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/admin/screen/create");
+ await page.goto("/screen/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -34,58 +34,60 @@ test.describe("Nav items loads", () => {
await page.getByLabel("Kodeord").fill("password");
await page.locator("#login").click();
});
+
test("It loads", async ({ page }) => {
await expect(page.locator("nav")).toBeVisible();
});
test("It navigates to slides list", async ({ page }) => {
- await page.getByRole('link', { name: 'Slides' }).click();
+ await page.getByRole("link", { name: "Slides" }).click();
await expect(page.locator("h1")).toHaveText("Slides");
});
test("It navigates to media list", async ({ page }) => {
- await page.getByRole('link', { name: 'Medier' }).click();
+ await page.getByRole("link", { name: "Medier" }).click();
await expect(page.locator("h1")).toHaveText("Medier");
});
test("It navigates to screens list", async ({ page }) => {
- await page.getByRole('link', { name: 'Skærme' }).click();
+ await page.getByRole("link", { name: "Skærme" }).click();
await expect(page.locator("h1")).toHaveText("Skærme");
});
+
test("It navigates to groups list", async ({ page }) => {
- await page.getByRole('link', { name: 'Grupper' }).click();
+ await page.getByRole("link", { name: "Grupper" }).click();
await expect(page.locator("h1")).toHaveText("Grupper");
});
+
test("It navigates to playlists list", async ({ page }) => {
- await page.getByRole('link', { name: 'Spillelister', exact: true }).click();
+ await page.getByRole("link", { name: "Spillelister", exact: true }).click();
await expect(page.locator("h1")).toHaveText("Spillelister");
});
+
test("It navigates to themes list", async ({ page }) => {
- await page.getByRole('link', { name: 'Temaer' }).click();
+ await page.getByRole("link", { name: "Temaer" }).click();
await expect(page.locator("h1")).toHaveText("Temaer");
});
- // todo make tests green
test.skip("It navigates to create slide", async ({ page }) => {
- await page.goto("/admin/screen/create");
- await page.getByRole('button', { name: 'Tilføj' }).click();
- await page.getByRole('link', { name: 'Nyt slide', exact: true }).click();
+ await page.goto("/screen/create");
+ await page.getByRole("button", { name: "Tilføj" }).click();
+ await page.getByRole("link", { name: "Nyt slide", exact: true }).click();
await expect(page.locator("h1")).toHaveText("Opret nyt slide");
});
- // todo make tests green
test.skip("It navigates to create playlist", async ({ page }) => {
- await page.getByRole('button', { name: 'Tilføj' }).click();
- await page.getByRole('link', { name: 'Ny spilleliste' }).click();
+ await page.getByRole("button", { name: "Tilføj" }).click();
+ await page.getByRole("link", { name: "Ny spilleliste" }).click();
await expect(page.locator("h1")).toHaveText("Opret nyt spilleliste");
});
- // todo make tests green
test.skip("It navigates to create screen", async ({ page }) => {
- await page.getByRole('button', { name: 'Tilføj' }).click();
- await page.getByRole('link', { name: 'Ny skærm' }).click();
+ await page.getByRole("button", { name: "Tilføj" }).click();
+ await page.getByRole("link", { name: "Ny skærm" }).click();
await expect(page.locator("h1")).toHaveText("Opret ny skærm");
});
+
test("It loads different menu on smaller screens", async ({ page }) => {
await page.setViewportSize({ width: 550, height: 750 });
await expect(page.locator("#basic-navbar-nav-burger")).toBeVisible();
From cf1e09eeafa53cea9d403ee79266c16a2dc0b6ff Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Thu, 1 Aug 2024 08:48:48 +0200
Subject: [PATCH 4/5] 1859: Changed to fixed base path /admin
---
.docker/vhost.conf | 2 +-
CHANGELOG.md | 3 ++-
index.html | 1 -
infrastructure/itkdev/Dockerfile | 4 +---
infrastructure/os2display/Dockerfile | 4 +---
package.json | 6 +++---
src/app.jsx | 3 +--
src/config-loader.js | 4 +---
src/index.jsx | 3 +--
src/variables.js | 7 -------
10 files changed, 11 insertions(+), 26 deletions(-)
delete mode 100644 src/variables.js
diff --git a/.docker/vhost.conf b/.docker/vhost.conf
index edbfca1e..49dbc642 100644
--- a/.docker/vhost.conf
+++ b/.docker/vhost.conf
@@ -9,7 +9,7 @@ server {
proxy_pass http://node:3000;
}
- location /ws {
+ location /admin/ws {
proxy_pass http://node:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7980e471..03972790 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,11 @@
+
# Changelog
All notable changes to this project will be documented in this file.
## [Unreleased]
-- Fixed configurable base path.
+- Fixed base path to /admin in vite setup.
- Changed from vite CJS to ESM.
- Removed array spread.
- Fixed HMR setup.
diff --git a/index.html b/index.html
index 727d0c8f..1cee999d 100644
--- a/index.html
+++ b/index.html
@@ -1,7 +1,6 @@
-
diff --git a/infrastructure/itkdev/Dockerfile b/infrastructure/itkdev/Dockerfile
index 515c14ed..1c28b85d 100644
--- a/infrastructure/itkdev/Dockerfile
+++ b/infrastructure/itkdev/Dockerfile
@@ -13,11 +13,9 @@ RUN mkdir -p ${APP_PATH} \
WORKDIR ${APP_PATH}
-ARG APP_BASE_PATH=/admin/
-
# Build it.
RUN yarn install \
- && BASE_PATH=${APP_BASE_PATH} yarn build
+ && yarn build
# Remove fixtures
RUN rm -rf public/fixtures
diff --git a/infrastructure/os2display/Dockerfile b/infrastructure/os2display/Dockerfile
index 515c14ed..1c28b85d 100644
--- a/infrastructure/os2display/Dockerfile
+++ b/infrastructure/os2display/Dockerfile
@@ -13,11 +13,9 @@ RUN mkdir -p ${APP_PATH} \
WORKDIR ${APP_PATH}
-ARG APP_BASE_PATH=/admin/
-
# Build it.
RUN yarn install \
- && BASE_PATH=${APP_BASE_PATH} yarn build
+ && yarn build
# Remove fixtures
RUN rm -rf public/fixtures
diff --git a/package.json b/package.json
index c8e656b3..5a275f43 100644
--- a/package.json
+++ b/package.json
@@ -53,9 +53,9 @@
"lint:scss:fix": "stylelint --fix \"./src/**/*.scss\"",
"check-coding-standards": "yarn lint:js && yarn lint:scss",
"apply-coding-standards": "yarn lint:js:fix && yarn lint:scss:fix",
- "start": "vite --host 0.0.0.0",
- "build": "vite build --base=$BASE_PATH",
- "preview": "vite preview"
+ "start": "vite --host 0.0.0.0 --base=/admin",
+ "build": "vite build --base=/admin",
+ "preview": "vite preview --base=/admin"
},
"eslintConfig": {
"extends": [
diff --git a/src/app.jsx b/src/app.jsx
index df25b716..2a417fb4 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -42,7 +42,6 @@ import ActivationCodeActivate from "./components/activation-code/activation-code
import ConfigLoader from "./config-loader";
import "react-toastify/dist/ReactToastify.css";
import "./app.scss";
-import { BASE_PATH } from "./variables";
/**
* App component.
@@ -142,7 +141,7 @@ function App() {
}, []);
useEffect(() => {
- fetch(`${BASE_PATH}access-config.json`)
+ fetch("/admin/access-config.json")
.then((response) => response.json())
.then((jsonData) => {
setAccessConfig(jsonData);
diff --git a/src/config-loader.js b/src/config-loader.js
index 494c2808..180aa9c9 100644
--- a/src/config-loader.js
+++ b/src/config-loader.js
@@ -1,5 +1,3 @@
-import { BASE_PATH } from "./variables";
-
let configData = null;
let activePromise = null;
@@ -13,7 +11,7 @@ const ConfigLoader = {
if (configData !== null) {
resolve(configData);
} else {
- fetch(`${BASE_PATH}config.json`)
+ fetch("/admin/config.json")
.then((response) => response.json())
.then((data) => {
configData = data;
diff --git a/src/index.jsx b/src/index.jsx
index cc42de5e..fa4d7780 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -4,14 +4,13 @@ import { createRoot } from "react-dom/client";
import { Provider } from "react-redux";
import { store } from "./redux/store";
import App from "./app";
-import { BASE_PATH } from "./variables";
const container = document.getElementById("root");
const root = createRoot(container);
root.render(
-
+
diff --git a/src/variables.js b/src/variables.js
deleted file mode 100644
index 013ac1a3..00000000
--- a/src/variables.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// The element base_path is set in index.html.
-// eslint-disable-next-line no-undef
-const BASE_PATH =
- document.getElementById("base_path").getAttribute("href") ?? "/";
-
-// eslint-disable-next-line import/prefer-default-export
-export { BASE_PATH };
From 8dbe057ca65e17ca59ed1f42c3d93249b322599e Mon Sep 17 00:00:00 2001
From: Troels Ugilt Jensen <6103205+tuj@users.noreply.github.com>
Date: Thu, 1 Aug 2024 10:05:21 +0200
Subject: [PATCH 5/5] 1859: Fixed tests and vite config
---
e2e/campaign.spec.js | 2 +-
e2e/login.spec.js | 12 +-
e2e/media.spec.js | 2 +-
e2e/playlist.spec.js | 4 +-
e2e/screen-groups.spec.js | 4 +-
e2e/screens.spec.js | 4 +-
e2e/shared-list.spec.js | 2 +-
e2e/slides.spec.js | 4 +-
e2e/theme.spec.js | 555 +++++++++++++++++++-------------------
e2e/top-bar.spec.js | 4 +-
package.json | 6 +-
vite.config.js | 2 +-
12 files changed, 302 insertions(+), 299 deletions(-)
diff --git a/e2e/campaign.spec.js b/e2e/campaign.spec.js
index 0844908f..5b1c7fef 100644
--- a/e2e/campaign.spec.js
+++ b/e2e/campaign.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Campaign pages work", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/campaign/create");
+ await page.goto("/admin/campaign/create");
await page.route("**/slides*", async (route) => {
const json = {
"@id": "/v2/slides",
diff --git a/e2e/login.spec.js b/e2e/login.spec.js
index 4e6fde53..99a99d12 100644
--- a/e2e/login.spec.js
+++ b/e2e/login.spec.js
@@ -22,7 +22,7 @@ test.describe("Login works", () => {
await route.fulfill({ json });
});
- await page.goto("/playlist/list");
+ await page.goto("/admin/playlist/list");
await page.locator("#login").click();
await expect(page.locator(".name")).toHaveText("John Doe");
});
@@ -59,14 +59,14 @@ test.describe("Login works", () => {
};
await route.fulfill({ json });
});
- await page.goto("/group/list");
+ await page.goto("/admin/group/list");
await page.locator("#login").click();
// Expect dropdown with tenants
await expect(page.locator(".dropdown-container")).toBeVisible();
});
test("Login with tenant that has role editor", async ({ page }) => {
- await page.goto("/playlist/list");
+ await page.goto("/admin/playlist/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -87,7 +87,7 @@ test.describe("Login works", () => {
await route.fulfill({ json });
});
- await page.goto("/group/list");
+ await page.goto("/admin/group/list");
await page.locator("#login").click();
await expect(page.locator(".name")).toHaveText("John Doe");
await expect(page.locator(".sidebar-nav").locator(".nav-item")).toHaveCount(
@@ -98,7 +98,7 @@ test.describe("Login works", () => {
test("Role editor should not be able to visit restricted route", async ({
page,
}) => {
- await page.goto("/playlist/list");
+ await page.goto("/admin/playlist/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -118,7 +118,7 @@ test.describe("Login works", () => {
};
await route.fulfill({ json });
});
- await page.goto("/shared/list");
+ await page.goto("/admin/shared/list");
await page.locator("#login").click();
await expect(page.locator("main").locator("div")).toHaveText(
"Du har ikke adgang til denne side"
diff --git a/e2e/media.spec.js b/e2e/media.spec.js
index fcd36560..1382779c 100644
--- a/e2e/media.spec.js
+++ b/e2e/media.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("media list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/media/list");
+ await page.goto("/admin/media/list");
await page.route("**/media*", async (route) => {
const json = {
"@context": "/contexts/Media",
diff --git a/e2e/playlist.spec.js b/e2e/playlist.spec.js
index 79bb79d8..5590ac22 100644
--- a/e2e/playlist.spec.js
+++ b/e2e/playlist.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Playlist create tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/playlist/create");
+ await page.goto("/admin/playlist/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -107,7 +107,7 @@ test.describe("Playlist create tests", () => {
});
test.describe("Playlist list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/playlist/list");
+ await page.goto("/admin/playlist/list");
await page.route("**/playlists*", async (route) => {
const json = {
"@context": "/contexts/Playlist",
diff --git a/e2e/screen-groups.spec.js b/e2e/screen-groups.spec.js
index 05c287b7..40b4876e 100644
--- a/e2e/screen-groups.spec.js
+++ b/e2e/screen-groups.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Create group page works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/group/create");
+ await page.goto("/admin/group/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -91,7 +91,7 @@ test.describe("Create group page works", () => {
test.describe("Groups list works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/group/list");
+ await page.goto("/admin/group/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
diff --git a/e2e/screens.spec.js b/e2e/screens.spec.js
index 551d52b1..7d7b52fd 100644
--- a/e2e/screens.spec.js
+++ b/e2e/screens.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Screen list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/screen/list");
+ await page.goto("/admin/screen/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -121,7 +121,7 @@ test.describe("Screen list tests", () => {
test.describe("Screen create tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/screen/create");
+ await page.goto("/admin/screen/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
diff --git a/e2e/shared-list.spec.js b/e2e/shared-list.spec.js
index ed9b15f1..3a609976 100644
--- a/e2e/shared-list.spec.js
+++ b/e2e/shared-list.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Shared list tests", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/shared/list");
+ await page.goto("/admin/shared/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
diff --git a/e2e/slides.spec.js b/e2e/slides.spec.js
index 243cffdf..9cc0de47 100644
--- a/e2e/slides.spec.js
+++ b/e2e/slides.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Create slide page works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/slide/create");
+ await page.goto("/admin/slide/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -163,7 +163,7 @@ test.describe("Create slide page works", () => {
test.describe("Slides list works", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/slide/list");
+ await page.goto("/admin/slide/list");
await page.route("**/slides*", async (route) => {
const json = {
"@id": "/v2/slides",
diff --git a/e2e/theme.spec.js b/e2e/theme.spec.js
index 0a6664b6..665f31e2 100644
--- a/e2e/theme.spec.js
+++ b/e2e/theme.spec.js
@@ -1,8 +1,284 @@
import { test, expect } from "@playwright/test";
+const themesJson = {
+ "@context": "/contexts/Theme",
+ "@id": "/v2/themes",
+ "@type": "hydra:Collection",
+ "hydra:member": [
+ {
+ "@type": "Theme",
+ "@id": "/v2/themes/01FTNTE788816N6YCW9NVM2JQB",
+ title: "Consequatur quisquam recusandae asperiores accusamus.",
+ description:
+ "Occaecati debitis et saepe eum sint dolorem. Enim ipsum inventore sed libero et velit qui suscipit. Deserunt laudantium quibusdam enim nostrum soluta qui ipsam non.",
+ onSlides: [],
+ created: "2022-01-30T15:42:42+01:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ css: "",
+ },
+ {
+ "@type": "Theme",
+ "@id": "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
+ title: "Sit vitae voluptas sint non.",
+ description:
+ "Optio quos qui illo error. Laborum vero a officia id corporis. Saepe provident esse hic eligendi. Culpa ut ab voluptas sed a.",
+ onSlides: [
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/007ZR8C9811R741WAP1KHK0T09",
+ title: "Mollitia iure culpa exercitationem.",
+ description:
+ "Facilis nihil minus vel eum. Ut corrupti dicta quo modi temporibus est.",
+ created: "1978-09-14T10:51:02+01:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/017BG9P0E0103F0TFS17FM016M",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
+ onPlaylists: [],
+ duration: 92789,
+ published: {
+ from: "2021-08-04T05:24:19+02:00",
+ to: "2021-11-14T19:59:53+01:00",
+ },
+ media: ["/v2/media/00MTYFFTN30XNZ0F350YM31TN5"],
+ content: [],
+ feed: null,
+ },
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/00GYC65JP01DEG1F6H0R5Q0JBA",
+ title: "Voluptatem recusandae hic.",
+ description:
+ "Nulla occaecati praesentium quia magni ipsum dolor. Et aliquid natus molestiae ut quis. Ad voluptatum qui consequatur deleniti labore est. Voluptas hic veritatis quidem molestias qui.",
+ created: "1988-06-15T11:26:36+02:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/002BAP34VD1EHG0E4J0D2Y00JW",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
+ onPlaylists: [],
+ duration: 78938,
+ published: {
+ from: "2021-10-09T12:14:12+02:00",
+ to: "2021-12-24T16:18:08+01:00",
+ },
+ media: [
+ "/v2/media/00YB5658GH0TAE1A1N0XBB0YR7",
+ "/v2/media/01CVTNA9Y917EX09MY0FNX0GKA",
+ "/v2/media/01E4S5SPXR19MP1KGY16TD1XG2",
+ ],
+ content: [],
+ feed: null,
+ },
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/00V28394SD1WBY1BPE1STN13MD",
+ title: "Reprehenderit neque nam mollitia quia.",
+ description:
+ "Omnis aliquam ea architecto dignissimos. Harum provident asperiores neque consequatur sit sed. Quasi ipsa illum et qui deleniti quo.",
+ created: "1999-06-23T10:05:00+02:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
+ onPlaylists: [],
+ duration: 69299,
+ published: {
+ from: "2021-06-09T03:25:34+02:00",
+ to: "2021-11-05T02:30:21+01:00",
+ },
+ media: ["/v2/media/0041NS3DFY1EMS0XGQ025B0425"],
+ content: [],
+ feed: null,
+ },
+ ],
+ created: "2022-01-30T15:42:42+01:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ css: "",
+ },
+ {
+ "@type": "Theme",
+ "@id": "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
+ title: "Enim ex eveniet facere.",
+ description:
+ "Delectus aut nam et eum. Fugit repellendus illo veritatis. Ex esse veritatis voluptate vel possimus. Aut incidunt sunt cumque asperiores incidunt iure sequi.",
+ onSlides: [
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/003VYYZPPN1MQ61MEM1TE10G2J",
+ title: "Quos ducimus culpa consequuntur nulla aliquid.",
+ description:
+ "At quia quia voluptatibus eius. Delectus quia consequuntur aut nihil. Impedit sit aut dolorum aut dolore. Dolore beatae ipsa voluptas.",
+ created: "1974-03-21T14:49:33+01:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
+ onPlaylists: ["/v2/playlists/00XVQEW1EV0N3K0JZQ0TYS0T1G"],
+ duration: 77194,
+ published: {
+ from: "2021-07-02T08:33:02+02:00",
+ to: "2022-03-12T20:52:07+01:00",
+ },
+ media: [
+ "/v2/media/00GEQ02WW10SZ21F9G1MAZ0KR8",
+ "/v2/media/00MTYFFTN30XNZ0F350YM31TN5",
+ "/v2/media/00SSYSBFHR16PM09MQ0B0K0202",
+ "/v2/media/00X6A9GBZM0EHF05AA0B350D8E",
+ ],
+ content: [],
+ feed: null,
+ },
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/00EBKSK8ZZ0Y301VFR0WGQ05F4",
+ title: "Maiores repudiandae quibusdam et rerum.",
+ description:
+ "At totam ut animi nisi ut ut qui. Aspernatur omnis quod temporibus non quo numquam. Dignissimos non eius numquam neque. Numquam modi tempora minus ad aut aut sit.",
+ created: "1985-08-21T22:37:57+02:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/0044JYNRTJ1KD0128318R80B3Q",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
+ onPlaylists: [],
+ duration: 66516,
+ published: {
+ from: "2021-08-30T14:57:29+02:00",
+ to: "2021-10-24T12:24:48+02:00",
+ },
+ media: ["/v2/media/00031XCV6Z1W860V5R0SXB0D6R"],
+ content: [],
+ feed: null,
+ },
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/00VRS9JQ7C1BZZ1NBA1XE50E19",
+ title: "Doloremque cum aliquam quis sint.",
+ description:
+ "Est quos beatae voluptatem optio et sit. Culpa fugiat quam et quisquam error a. Aut molestias quaerat quia aut non ipsum autem. Sunt aspernatur eos dolores quas alias. Culpa aut maiores consectetur.",
+ created: "2000-03-29T12:07:31+02:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
+ onPlaylists: [],
+ duration: 28295,
+ published: {
+ from: "2022-03-18T13:47:21+01:00",
+ to: "2022-03-19T12:34:17+01:00",
+ },
+ media: [
+ "/v2/media/003NVKRN4E183T0C431JF7036P",
+ "/v2/media/00C07KS3R00PEV24RF09870SH9",
+ "/v2/media/0170X462SF1P3205JP1R6K0553",
+ ],
+ content: [],
+ feed: null,
+ },
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/00X2XD9Y011VB31K2T10JW0NR1",
+ title: "Eveniet repellendus et autem repellat.",
+ description:
+ "Rerum praesentium quo sequi. Accusamus fugiat voluptatem est quam. Esse voluptatem quia fugiat nisi delectus omnis.",
+ created: "2001-09-04T01:28:51+02:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/017BG9P0E0103F0TFS17FM016M",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
+ onPlaylists: ["/v2/playlists/007TM6JDGF1ECH07J10ZHY0S7P"],
+ duration: 99209,
+ published: {
+ from: "2021-11-11T07:58:12+01:00",
+ to: "2021-11-13T19:36:00+01:00",
+ },
+ media: [
+ "/v2/media/00J8PGYF1N12T60T200QN50KKJ",
+ "/v2/media/014S7FGP500Z8P18ZW12631TCP",
+ "/v2/media/019PTTMBQB0Z2D05VQ0HVC1M5M",
+ ],
+ content: [],
+ feed: null,
+ },
+ {
+ "@type": "Slide",
+ "@id": "/v2/slides/011KV2WHQS0NDK1Q1Q01GY0XPS",
+ title: "Harum ducimus reiciendis.",
+ description:
+ "Est aut quis omnis. Cumque id officiis molestias accusamus est molestias. Nulla qui aut quo sunt et.",
+ created: "2006-08-10T03:26:54+02:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ templateInfo: {
+ "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
+ options: [],
+ },
+ theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
+ onPlaylists: [],
+ duration: 7509,
+ published: {
+ from: "2021-07-22T07:48:05+02:00",
+ to: "2021-09-03T23:11:43+02:00",
+ },
+ media: [
+ "/v2/media/008ARWMTYJ0SX810490JQQ0DAK",
+ "/v2/media/00E98GAQXH1Y2C1G131MVH0YWZ",
+ "/v2/media/00MTYFFTN30XNZ0F350YM31TN5",
+ "/v2/media/0142VZYZ7H0XHE1XJB1M730VGS",
+ "/v2/media/015H8MEPVH13BE15A11MHJ0KAM",
+ ],
+ content: [],
+ feed: null,
+ },
+ ],
+ created: "2022-01-30T15:42:42+01:00",
+ modified: "2022-01-30T15:42:42+01:00",
+ modifiedBy: "",
+ createdBy: "",
+ css: "",
+ },
+ ],
+ "hydra:totalItems": 20,
+};
+
test.describe("Theme pages work", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/themes/list");
+ await page.goto("/admin/themes/list");
+ await page.route("**/themes*", async (route) => {
+ await route.fulfill({ json: themesJson });
+ });
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -73,7 +349,7 @@ test.describe("Theme pages work", () => {
test.describe("Themes list work", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/themes/list");
+ await page.goto("/admin/themes/list");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -94,280 +370,7 @@ test.describe("Themes list work", () => {
await route.fulfill({ json });
});
await page.route("**/themes*", async (route) => {
- const json = {
- "@context": "/contexts/Theme",
- "@id": "/v2/themes",
- "@type": "hydra:Collection",
- "hydra:member": [
- {
- "@type": "Theme",
- "@id": "/v2/themes/01FTNTE788816N6YCW9NVM2JQB",
- title: "Consequatur quisquam recusandae asperiores accusamus.",
- description:
- "Occaecati debitis et saepe eum sint dolorem. Enim ipsum inventore sed libero et velit qui suscipit. Deserunt laudantium quibusdam enim nostrum soluta qui ipsam non.",
- onSlides: [],
- created: "2022-01-30T15:42:42+01:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- css: "",
- },
- {
- "@type": "Theme",
- "@id": "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
- title: "Sit vitae voluptas sint non.",
- description:
- "Optio quos qui illo error. Laborum vero a officia id corporis. Saepe provident esse hic eligendi. Culpa ut ab voluptas sed a.",
- onSlides: [
- {
- "@type": "Slide",
- "@id": "/v2/slides/007ZR8C9811R741WAP1KHK0T09",
- title: "Mollitia iure culpa exercitationem.",
- description:
- "Facilis nihil minus vel eum. Ut corrupti dicta quo modi temporibus est.",
- created: "1978-09-14T10:51:02+01:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/017BG9P0E0103F0TFS17FM016M",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
- onPlaylists: [],
- duration: 92789,
- published: {
- from: "2021-08-04T05:24:19+02:00",
- to: "2021-11-14T19:59:53+01:00",
- },
- media: ["/v2/media/00MTYFFTN30XNZ0F350YM31TN5"],
- content: [],
- feed: null,
- },
- {
- "@type": "Slide",
- "@id": "/v2/slides/00GYC65JP01DEG1F6H0R5Q0JBA",
- title: "Voluptatem recusandae hic.",
- description:
- "Nulla occaecati praesentium quia magni ipsum dolor. Et aliquid natus molestiae ut quis. Ad voluptatum qui consequatur deleniti labore est. Voluptas hic veritatis quidem molestias qui.",
- created: "1988-06-15T11:26:36+02:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/002BAP34VD1EHG0E4J0D2Y00JW",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
- onPlaylists: [],
- duration: 78938,
- published: {
- from: "2021-10-09T12:14:12+02:00",
- to: "2021-12-24T16:18:08+01:00",
- },
- media: [
- "/v2/media/00YB5658GH0TAE1A1N0XBB0YR7",
- "/v2/media/01CVTNA9Y917EX09MY0FNX0GKA",
- "/v2/media/01E4S5SPXR19MP1KGY16TD1XG2",
- ],
- content: [],
- feed: null,
- },
- {
- "@type": "Slide",
- "@id": "/v2/slides/00V28394SD1WBY1BPE1STN13MD",
- title: "Reprehenderit neque nam mollitia quia.",
- description:
- "Omnis aliquam ea architecto dignissimos. Harum provident asperiores neque consequatur sit sed. Quasi ipsa illum et qui deleniti quo.",
- created: "1999-06-23T10:05:00+02:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQC",
- onPlaylists: [],
- duration: 69299,
- published: {
- from: "2021-06-09T03:25:34+02:00",
- to: "2021-11-05T02:30:21+01:00",
- },
- media: ["/v2/media/0041NS3DFY1EMS0XGQ025B0425"],
- content: [],
- feed: null,
- },
- ],
- created: "2022-01-30T15:42:42+01:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- css: "",
- },
- {
- "@type": "Theme",
- "@id": "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
- title: "Enim ex eveniet facere.",
- description:
- "Delectus aut nam et eum. Fugit repellendus illo veritatis. Ex esse veritatis voluptate vel possimus. Aut incidunt sunt cumque asperiores incidunt iure sequi.",
- onSlides: [
- {
- "@type": "Slide",
- "@id": "/v2/slides/003VYYZPPN1MQ61MEM1TE10G2J",
- title: "Quos ducimus culpa consequuntur nulla aliquid.",
- description:
- "At quia quia voluptatibus eius. Delectus quia consequuntur aut nihil. Impedit sit aut dolorum aut dolore. Dolore beatae ipsa voluptas.",
- created: "1974-03-21T14:49:33+01:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
- onPlaylists: ["/v2/playlists/00XVQEW1EV0N3K0JZQ0TYS0T1G"],
- duration: 77194,
- published: {
- from: "2021-07-02T08:33:02+02:00",
- to: "2022-03-12T20:52:07+01:00",
- },
- media: [
- "/v2/media/00GEQ02WW10SZ21F9G1MAZ0KR8",
- "/v2/media/00MTYFFTN30XNZ0F350YM31TN5",
- "/v2/media/00SSYSBFHR16PM09MQ0B0K0202",
- "/v2/media/00X6A9GBZM0EHF05AA0B350D8E",
- ],
- content: [],
- feed: null,
- },
- {
- "@type": "Slide",
- "@id": "/v2/slides/00EBKSK8ZZ0Y301VFR0WGQ05F4",
- title: "Maiores repudiandae quibusdam et rerum.",
- description:
- "At totam ut animi nisi ut ut qui. Aspernatur omnis quod temporibus non quo numquam. Dignissimos non eius numquam neque. Numquam modi tempora minus ad aut aut sit.",
- created: "1985-08-21T22:37:57+02:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/0044JYNRTJ1KD0128318R80B3Q",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
- onPlaylists: [],
- duration: 66516,
- published: {
- from: "2021-08-30T14:57:29+02:00",
- to: "2021-10-24T12:24:48+02:00",
- },
- media: ["/v2/media/00031XCV6Z1W860V5R0SXB0D6R"],
- content: [],
- feed: null,
- },
- {
- "@type": "Slide",
- "@id": "/v2/slides/00VRS9JQ7C1BZZ1NBA1XE50E19",
- title: "Doloremque cum aliquam quis sint.",
- description:
- "Est quos beatae voluptatem optio et sit. Culpa fugiat quam et quisquam error a. Aut molestias quaerat quia aut non ipsum autem. Sunt aspernatur eos dolores quas alias. Culpa aut maiores consectetur.",
- created: "2000-03-29T12:07:31+02:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
- onPlaylists: [],
- duration: 28295,
- published: {
- from: "2022-03-18T13:47:21+01:00",
- to: "2022-03-19T12:34:17+01:00",
- },
- media: [
- "/v2/media/003NVKRN4E183T0C431JF7036P",
- "/v2/media/00C07KS3R00PEV24RF09870SH9",
- "/v2/media/0170X462SF1P3205JP1R6K0553",
- ],
- content: [],
- feed: null,
- },
- {
- "@type": "Slide",
- "@id": "/v2/slides/00X2XD9Y011VB31K2T10JW0NR1",
- title: "Eveniet repellendus et autem repellat.",
- description:
- "Rerum praesentium quo sequi. Accusamus fugiat voluptatem est quam. Esse voluptatem quia fugiat nisi delectus omnis.",
- created: "2001-09-04T01:28:51+02:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/017BG9P0E0103F0TFS17FM016M",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
- onPlaylists: ["/v2/playlists/007TM6JDGF1ECH07J10ZHY0S7P"],
- duration: 99209,
- published: {
- from: "2021-11-11T07:58:12+01:00",
- to: "2021-11-13T19:36:00+01:00",
- },
- media: [
- "/v2/media/00J8PGYF1N12T60T200QN50KKJ",
- "/v2/media/014S7FGP500Z8P18ZW12631TCP",
- "/v2/media/019PTTMBQB0Z2D05VQ0HVC1M5M",
- ],
- content: [],
- feed: null,
- },
- {
- "@type": "Slide",
- "@id": "/v2/slides/011KV2WHQS0NDK1Q1Q01GY0XPS",
- title: "Harum ducimus reiciendis.",
- description:
- "Est aut quis omnis. Cumque id officiis molestias accusamus est molestias. Nulla qui aut quo sunt et.",
- created: "2006-08-10T03:26:54+02:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- templateInfo: {
- "@id": "/v2/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
- options: [],
- },
- theme: "/v2/themes/01FTNTE788816N6YCW9NVM2JQD",
- onPlaylists: [],
- duration: 7509,
- published: {
- from: "2021-07-22T07:48:05+02:00",
- to: "2021-09-03T23:11:43+02:00",
- },
- media: [
- "/v2/media/008ARWMTYJ0SX810490JQQ0DAK",
- "/v2/media/00E98GAQXH1Y2C1G131MVH0YWZ",
- "/v2/media/00MTYFFTN30XNZ0F350YM31TN5",
- "/v2/media/0142VZYZ7H0XHE1XJB1M730VGS",
- "/v2/media/015H8MEPVH13BE15A11MHJ0KAM",
- ],
- content: [],
- feed: null,
- },
- ],
- created: "2022-01-30T15:42:42+01:00",
- modified: "2022-01-30T15:42:42+01:00",
- modifiedBy: "",
- createdBy: "",
- css: "",
- },
- ],
- "hydra:totalItems": 20,
- };
-
- await route.fulfill({ json });
+ await route.fulfill({ json: themesJson });
});
await expect(page).toHaveTitle(/OS2Display admin/);
await page.getByLabel("Email").fill("johndoe@example.com");
diff --git a/e2e/top-bar.spec.js b/e2e/top-bar.spec.js
index 61a7d12f..c0757daa 100644
--- a/e2e/top-bar.spec.js
+++ b/e2e/top-bar.spec.js
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
test.describe("Nav items loads", () => {
test.beforeEach(async ({ page }) => {
- await page.goto("/screen/create");
+ await page.goto("/admin/screen/create");
await page.route("**/token", async (route) => {
const json = {
token: "1",
@@ -70,7 +70,7 @@ test.describe("Nav items loads", () => {
});
test.skip("It navigates to create slide", async ({ page }) => {
- await page.goto("/screen/create");
+ await page.goto("/admin/screen/create");
await page.getByRole("button", { name: "Tilføj" }).click();
await page.getByRole("link", { name: "Nyt slide", exact: true }).click();
await expect(page.locator("h1")).toHaveText("Opret nyt slide");
diff --git a/package.json b/package.json
index 5a275f43..bd50910b 100644
--- a/package.json
+++ b/package.json
@@ -53,9 +53,9 @@
"lint:scss:fix": "stylelint --fix \"./src/**/*.scss\"",
"check-coding-standards": "yarn lint:js && yarn lint:scss",
"apply-coding-standards": "yarn lint:js:fix && yarn lint:scss:fix",
- "start": "vite --host 0.0.0.0 --base=/admin",
- "build": "vite build --base=/admin",
- "preview": "vite preview --base=/admin"
+ "start": "vite --host 0.0.0.0",
+ "build": "vite build",
+ "preview": "vite preview"
},
"eslintConfig": {
"extends": [
diff --git a/vite.config.js b/vite.config.js
index a59332be..ac6692c6 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -2,7 +2,7 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
export default defineConfig({
- base: "/",
+ base: "/admin",
plugins: [react()],
build: {
outDir: "build",