Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Header tests frontend #391

Merged
merged 21 commits into from
May 23, 2024
Merged
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
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dist
dist-ssr
*.local
coverage
screenshots
.env

# Editor directories and files
Expand Down
31 changes: 31 additions & 0 deletions frontend/cypress/e2e/Header.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
describe("Header look not logged in", () => {
it("App name in header", () => {
cy.visit("/");
cy.get("header").contains("Peristerónas");
});
it("Login in header", () => {
cy.visit("/");
cy.get("header").contains("Login");
});
it("Language in header", () => {
cy.visit("/");
cy.get("header").contains("en");
});
});

describe("Header functionality not logged in", () => {
it("Header Login", () => {
cy.visit("/");
cy.contains("Login")
.should("be.visible")
.should("have.attr", "href")
.and("include", "login.microsoftonline.com");
});

it("Header change language en -> nl", () => {
cy.visit("/");
cy.contains("en").should("be.visible").click();
cy.contains("Nederlands").should("be.visible").click();
cy.contains("nl").should("be.visible");
});
});
20 changes: 20 additions & 0 deletions frontend/cypress/e2e/HomePageTests.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe("Homepage functionality not logged in ", () => {
it("Header Visible", () => {
cy.visit("/");
cy.contains("Peristerónas");
cy.get("header").should("be.visible");
});

it("Center button Login", () => {
cy.visit("/");
cy.contains("Peristerónas");
cy.contains(
"Welcome to Peristerónas, the online submission platform of UGent"
)
.parent()
.contains("Login")
.should("be.visible")
.should("have.attr", "href")
.and("include", "login.microsoftonline.com");
});
});
106 changes: 106 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"styled-components": "^6.1.8"
},
"devDependencies": {
"@testing-library/react": "^15.0.7",
"@types/downloadjs": "^1.4.6",
"@types/history": "^4.7.11",
"@types/react": "^18.2.55",
Expand Down
7 changes: 5 additions & 2 deletions frontend/tests/unit/header.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { test } from "vitest";
import { describe, test } from "vitest";
//import { render } from "@testing-library/react";

test.todo("Header test");
describe("Header", () => {
test.todo("Header test");
});
Empty file removed frontend/tests/utils/api.ts
Empty file.
5 changes: 5 additions & 0 deletions frontend/tests/utils/me-fixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
uid: "TestUID",
role: "STUDENT",
display_name: "Terry Tester",
};
Empty file removed frontend/tests/utils/utils.ts
Empty file.