Skip to content

Commit

Permalink
fix: deployment (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietzler authored Sep 8, 2024
1 parent 4d79c76 commit 282c206
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion server/src/main/java/de/uftos/UftosApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Contains the method to start the UFTOS application.
*/
@OpenAPIDefinition(info = @Info(title = "UFTOS OpenAPI definition", version = "v0"), servers = {
@Server(url = "http://localhost:5173/api", description = "UFTOS api URL")})
@Server(url = "/api", description = "UFTOS API URL")})
@SpringBootApplication
public class UftosApplication {
/**
Expand Down
4 changes: 2 additions & 2 deletions uftos-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"version" : "v0"
},
"servers" : [ {
"url" : "http://localhost:5173/api",
"description" : "UFTOS api URL"
"url" : "/api",
"description" : "UFTOS API URL"
} ],
"paths" : {
"/constraints" : {
Expand Down
1 change: 0 additions & 1 deletion web/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const config: PlaywrightTestConfig = {
baseURL: 'http://localhost:5173',
trace: 'on-first-retry',
},

projects: [
{
name: 'chromium',
Expand Down
4 changes: 2 additions & 2 deletions web/src/lib/sdk/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import * as Oazapfts from "@oazapfts/runtime";
import * as QS from "@oazapfts/runtime/query";
export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
headers: {},
baseUrl: "http://localhost:5173/api",
baseUrl: "/api",
};
const oazapfts = Oazapfts.runtime(defaults);
export const servers = {
uftosApiUrl: "http://localhost:5173/api"
uftosApiUrl: "/api"
};
export type Pageable = {
page?: number;
Expand Down
4 changes: 4 additions & 0 deletions web/tests/admin.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
createGrade,
createStudent,
createTeacher,
defaults,
deleteGrades,
deleteRooms,
deleteStudentGroup,
Expand All @@ -16,6 +17,9 @@ import {
import { expect, test } from '@playwright/test';

test.describe('Admin Overview', () => {
test.beforeAll(() => {
defaults.baseUrl = 'http://localhost:5173/api';
});
test('shows statistics', async ({ page }) => {
const totalStudents = await getStudents({ page: 0 }).then(({ totalElements }) => totalElements);
const students = await getStudents({ page: 0, size: totalStudents }).then(({ content }) => content ?? []);
Expand Down
2 changes: 2 additions & 0 deletions web/tests/constraints.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
createSubject,
createTag,
createTeacher,
defaults,
deleteGrades,
deleteStudentGroup,
deleteStudents,
Expand All @@ -26,6 +27,7 @@ test.describe.configure({ mode: 'serial' });

test.describe('Constraints', () => {
test.beforeAll('Delete existing constraints', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
await page.goto('/');
await page.getByRole('link').first().click();
Expand Down
2 changes: 2 additions & 0 deletions web/tests/curriculum.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
createGrade,
createSubject,
defaults,
deleteGrades,
deleteStudentGroup,
deleteSubjects,
Expand All @@ -17,6 +18,7 @@ test.describe.configure({ mode: 'serial' });

test.describe('Curriculum', () => {
test.beforeAll('Delete existing entities', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
const subjects = await getSubjects({});
if (subjects.length > 0) {
Expand Down
9 changes: 8 additions & 1 deletion web/tests/grade.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { createGrade, deleteStudentGroup, getStudentGroups, type GradeRequestDto } from '$lib/sdk/fetch-client';
import {
createGrade,
defaults,
deleteStudentGroup,
getStudentGroups,
type GradeRequestDto,
} from '$lib/sdk/fetch-client';
import { expect, test, type Page } from '@playwright/test';

let page: Page;
Expand All @@ -8,6 +14,7 @@ test.describe.configure({ mode: 'serial' });
//tests need to be done in order or they might break!
test.describe('grades page', () => {
test.beforeAll('delete all existing grades', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
const totalGroups = await getStudentGroups({ page: 0 }).then(({ totalElements }) => totalElements);
const groups = await getStudentGroups({ page: 0, size: totalGroups }).then(({ content }) => content ?? []);
Expand Down
3 changes: 2 additions & 1 deletion web/tests/room.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRoom, type RoomRequestDto } from '$lib/sdk/fetch-client';
import { createRoom, defaults, type RoomRequestDto } from '$lib/sdk/fetch-client';
import { expect, test, type Page } from '@playwright/test';

let page: Page;
Expand All @@ -8,6 +8,7 @@ test.describe.configure({ mode: 'serial' });
//tests need to be done in order or they might break!
test.describe('rooms page', () => {
test.beforeAll('delete all existing rooms', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
await page.goto('/');
await page.getByRole('link').first().click();
Expand Down
2 changes: 2 additions & 0 deletions web/tests/settings.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { defaults } from '$lib/sdk/fetch-client';
import { expect, test, type Page } from '@playwright/test';

let page: Page;
Expand All @@ -6,6 +7,7 @@ test.describe.configure({ mode: 'serial' });

test.describe('Settings', () => {
test.beforeAll('delete all existing timeslots', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
await page.goto('/');
await page.getByRole('link').first().click();
Expand Down
2 changes: 2 additions & 0 deletions web/tests/student-group.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
createStudent,
createSubject,
createTag,
defaults,
deleteGrades,
deleteStudents,
deleteSubjects,
Expand All @@ -24,6 +25,7 @@ test.describe.configure({ mode: 'serial' });

test.describe('Student group page', () => {
test.beforeAll('delete existing groups', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
await page.goto('/');
await page.getByRole('link').first().click();
Expand Down
3 changes: 2 additions & 1 deletion web/tests/students.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStudent, type StudentRequestDto } from '$lib/sdk/fetch-client';
import { createStudent, defaults, type StudentRequestDto } from '$lib/sdk/fetch-client';
import { expect, test, type Page } from '@playwright/test';

let page: Page;
Expand All @@ -8,6 +8,7 @@ test.describe.configure({ mode: 'serial' });
//tests need to be done in order or they might break!
test.describe('Students page', () => {
test.beforeAll('delete all existing students', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
await page.goto('/');
await page.getByRole('link').first().click();
Expand Down
2 changes: 2 additions & 0 deletions web/tests/subject.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
createSubject,
defaults,
deleteGrades,
deleteStudentGroup,
getGrades,
Expand All @@ -15,6 +16,7 @@ test.describe.configure({ mode: 'serial' });
//tests need to be done in order or they might break!
test.describe('subjects page', () => {
test.beforeAll('delete all existing subjects', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
const totalGroups = await getStudentGroups({ page: 0 }).then(({ totalElements }) => totalElements);
const groups = await getStudentGroups({ page: 0, size: totalGroups }).then(({ content }) => content ?? []);
if (groups.length > 0) {
Expand Down
3 changes: 2 additions & 1 deletion web/tests/tag.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTag, type TagRequestDto } from '$lib/sdk/fetch-client';
import { createTag, defaults, type TagRequestDto } from '$lib/sdk/fetch-client';
import { expect, test, type Page } from '@playwright/test';

let page: Page;
Expand All @@ -8,6 +8,7 @@ test.describe.configure({ mode: 'serial' });
//tests need to be done in order or they might break!
test.describe('tags page', () => {
test.beforeAll('delete all existing tags', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
await page.goto('/');
await page.getByRole('link').first().click();
Expand Down
2 changes: 2 additions & 0 deletions web/tests/teacher.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
createSubject,
createTeacher,
defaults,
deleteSubjects,
getSubjects,
type TeacherRequestDto,
Expand All @@ -14,6 +15,7 @@ test.describe.configure({ mode: 'serial' });
//tests need to be done in order or they might break!
test.describe('teachers page', () => {
test.beforeAll('delete all existing teachers', async ({ browser }) => {
defaults.baseUrl = 'http://localhost:5173/api';
page = await browser.newPage();
const subjects = await getSubjects({});
if (subjects.length > 0) {
Expand Down

0 comments on commit 282c206

Please sign in to comment.