Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test deployments without mocks #483

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
run: npm ci

- name: build project
env:
NODE_ENV: development
VITE_TEST_SERVER_URL: "https://develop.opencast.org"
VITE_TEST_SERVER_AUTH: "admin:opencast"
run: npm run build

- name: create pages directory
Expand All @@ -34,10 +38,6 @@ jobs:
- name: include admin interface
run: mv build gh-pages/admin-ui

- name: include mock data
working-directory: ./gh-pages
run: cp -rv ../test/GET/* .

- name: include landing page
run: cp .github/demo-page.html gh-pages/index.html

Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: build app
env:
PUBLIC_URL: /${{ steps.build-path.outputs.build }}
NODE_ENV: development
VITE_TEST_SERVER_URL: "https://develop.opencast.org"
VITE_TEST_SERVER_AUTH: "admin:opencast"
run: npm run build

- name: prepare git
Expand Down Expand Up @@ -63,10 +66,6 @@ jobs:
run: |
git checkout gh-pages

- name: include mock data
working-directory: admin-interface-test
run: cp -rv ../test/GET/* .

- name: store build
working-directory: admin-interface-test
env:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ PROXY_TARGET=http://localhost:8080 PROXY_AUTH=jdoe:aligator3 npm start
Similarly, if you want to change the port the development server itself runs at,
you can specify an alternative port in the `PORT` environment variable.

If you aim to test against a remote server without using a proxy, you have the option to configure the target server with the `VITE_TEST_SERVER_URL`, and the `VITE_TEST_SERVER_AUTH` environment variables while using the node development mode:

```sh
NODE_ENV=development VITE_TEST_SERVER_URL="https://develop.opencast.org" VITE_TEST_SERVER_AUTH="admin:opencast" npm start
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how common this will be, in testing against localhost I could not get this to work until I put a proxy with a wide open CORS config in between. So VITE_TEST_SERVER_URL="http://localhost:8080" did not work, but VITE_TEST_SERVER_URL="http://localhost" <- now with proxy! did. Would it be worth explaining that here, or am I sufficiently out of touch with frontend dev that this is something that's obvious?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CORS is Daily Business nowadays, and the Vite proxy would be a better fit for local scenarios.

```

How to cut a release for Opencast
---------------------------------
Expand Down
6 changes: 6 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import ReactDOMClient from "react-dom/client";
import "./index.css";
import App from "./App";
import axios from "axios";

// redux imports
import { persistStore } from "redux-persist";
Expand Down Expand Up @@ -31,6 +32,11 @@ const theme = createTheme({
}
})

if (import.meta.env.DEV && import.meta.env.VITE_TEST_SERVER_URL) {
axios.defaults.baseURL = import.meta.env.VITE_TEST_SERVER_URL || ""
axios.defaults.headers.common['Authorization'] = import.meta.env.VITE_TEST_SERVER_AUTH && ("Basic " + window.btoa(import.meta.env.VITE_TEST_SERVER_AUTH));
}

const container = document.getElementById("root");
if (!container) {
throw new Error("Failed to find the root element");
Expand Down
Empty file.
Empty file.
1 change: 0 additions & 1 deletion test/DELETE/admin-ng/theme/1

This file was deleted.

28 changes: 0 additions & 28 deletions test/GET/acl-manager/acl/1601

This file was deleted.

28 changes: 0 additions & 28 deletions test/GET/acl-manager/acl/1851

This file was deleted.

29 changes: 0 additions & 29 deletions test/GET/admin-ng/acl/1601

This file was deleted.

29 changes: 0 additions & 29 deletions test/GET/admin-ng/acl/31151

This file was deleted.

37 changes: 0 additions & 37 deletions test/GET/admin-ng/acl/acls.json

This file was deleted.

1 change: 0 additions & 1 deletion test/GET/admin-ng/acl/roles.json

This file was deleted.

21 changes: 0 additions & 21 deletions test/GET/admin-ng/adopter/registration

This file was deleted.

48 changes: 0 additions & 48 deletions test/GET/admin-ng/capture-agents/F300.1

This file was deleted.

48 changes: 0 additions & 48 deletions test/GET/admin-ng/capture-agents/agent1

This file was deleted.

9 changes: 0 additions & 9 deletions test/GET/admin-ng/capture-agents/agent2

This file was deleted.

Loading
Loading