-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb3eef5
commit a193b27
Showing
23 changed files
with
483 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import CourseCard from '../../src/pages/index/components/CourseCard' | ||
import {BrowserRouter} from "react-router-dom"; | ||
import {ApiRoutes, CourseRelation, DockerFeedback, DockerStatus, Timestamp} from "../../src/@types/requests"; | ||
|
||
const mockProjects = [ | ||
{course: {name: "test course 1", url: "test course 1 url", courseId: 1908}, | ||
deadline: "NOW", | ||
description: "do something", | ||
clusterId: null, | ||
projectId: 35, | ||
name: "test project 1", | ||
submissionUrl: null, | ||
testsUrl: "test project 1 url", | ||
maxScore: null, | ||
visible: true, | ||
progress: { | ||
completed: 5, | ||
total: 10, | ||
}, | ||
groupId: null, | ||
}, | ||
{course: {name: "test course 1", url: "test course 1 url", courseId: 1908}, | ||
deadline: "NOW", | ||
description: "do something", | ||
clusterId: null, | ||
projectId: 36, | ||
name: "test project 2", | ||
submissionUrl: null, | ||
testsUrl: "test project 2 url", | ||
maxScore: null, | ||
visible: true, | ||
progress: { | ||
completed: 0, | ||
total: 10, | ||
}, | ||
groupId: null, | ||
} | ||
] | ||
|
||
|
||
const mockCourse = { | ||
courseId: 1908, | ||
name: "test course 1", | ||
relation: "enrolled" as CourseRelation, | ||
memberCount: 20, | ||
archivedAt: null, | ||
year: 2023, | ||
url: "test course 1 url" | ||
} | ||
|
||
Cypress.on('uncaught:exception', (err: any, runnable: any) => { | ||
return false | ||
}) | ||
|
||
describe('<CourseCard />', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><CourseCard adminView={false} courseProjects={{projects: mockProjects, course: mockCourse }} /></BrowserRouter>).should("exist") | ||
cy.get('.ant-card-head').should("contain.text", "test course 1") | ||
cy.get('.ant-list-items > :nth-child(1)').should("contain.text", "test project 1") | ||
.and("contain.text", "50%") | ||
cy.get('.ant-list-items > :nth-child(2)').should("contain.text", "test project 2") | ||
.and("contain.text", "0%") | ||
cy.get(':nth-child(1) > :nth-child(1) > :nth-child(1) > .ant-statistic > .ant-statistic-content') | ||
.should("contain.text", "20") | ||
cy.get(':nth-child(2) > :nth-child(1) > :nth-child(1) > .ant-statistic > .ant-statistic-content') | ||
.should("contain.text", "2") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import CourseSection from '../../src/pages/index/components/CourseSection' | ||
import {BrowserRouter} from "react-router-dom"; | ||
|
||
Cypress.on('uncaught:exception', (err: any, runnable: any) => { | ||
return false | ||
}) | ||
|
||
describe('<CourseSection />', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><CourseSection /></BrowserRouter>).should("exist") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import CreateCourseModal from '../../src/pages/index/components/CreateCourseModal' | ||
import {BrowserRouter} from "react-router-dom"; | ||
|
||
describe('CreateCourseModal', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><CreateCourseModal open={true} setOpen={(b: boolean) => {}}/></BrowserRouter>).should("exist") | ||
cy.get("body").should("contain.text", "home.createCourse") | ||
.and("contain.text", "home.courseName") | ||
.and("contain.text", "project.change.description") | ||
.and("contain.text", "components.write") | ||
.and("contain.text", "components.preview") | ||
cy.get('.ant-btn-default').should("be.visible") | ||
cy.get('.ant-btn-primary').should("be.visible") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import EditProject from '../../src/pages/editProject/EditProject' | ||
import {BrowserRouter} from "react-router-dom"; | ||
|
||
describe('<EditProject />', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><EditProject /></BrowserRouter>).should("exist") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import EditRole from '../../src/pages/editRole/EditRole' | ||
|
||
describe('EditRole', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<EditRole />).should("exist") | ||
cy.get("body").should("contain.text", "Alice Kornelis") | ||
.and("contain.text", "Bob Kornelis") | ||
.and("contain.text", "Charlie Kornelis") | ||
cy.get('.ant-list-items > :nth-child(1)').should("contain.text", "editRole.student") | ||
cy.get('.ant-list-items > :nth-child(2)').should("contain.text", "editRole.teacher") | ||
cy.get('.ant-list-items > :nth-child(3)').should("contain.text", "editRole.admin") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import GroupProgress from '../../src/pages/index/components/GroupProgress' | ||
|
||
describe('GroupProgress', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<GroupProgress usersCompleted={10} userCount={20}/>).should("exist") | ||
cy.get("body").should("be.visible") | ||
.and("contain.text", "50%") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import GroupTab from '../../src/pages/project/components/GroupTab' | ||
|
||
describe('GroupTab', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<GroupTab />).should("exist") | ||
cy.get(".ant-spin-dot").should("be.visible") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import HorizontalCourseScroll from '../../src/pages/index/components/HorizontalCourseScroll' | ||
import {BrowserRouter} from "react-router-dom"; | ||
|
||
describe('HorizontalCourseScroll', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter> | ||
<HorizontalCourseScroll | ||
title="test horizontal scroll" | ||
projects={null} | ||
type="test" | ||
onOpenNew={()=> {}} | ||
showMore={true} | ||
showPlus={true} | ||
allOptions={true} | ||
/> | ||
</BrowserRouter>).should("exist") | ||
cy.get("body").should("contain.text", "test horizontal scroll") | ||
.and("contain.text", "home.moreCourses") | ||
cy.get(':nth-child(1) > .ant-card > .ant-card-body').should("be.visible") | ||
cy.get(':nth-child(2) > .ant-card > .ant-card-body').should("be.visible") | ||
cy.get(':nth-child(3) > .ant-card > .ant-card-body').should("not.be.visible") | ||
cy.viewport(2560, 1440) | ||
cy.get(':nth-child(3) > .ant-card > .ant-card-body').should("be.visible") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Navbar from '../../src/pages/index/landing/Navbar' | ||
import {BrowserRouter} from "react-router-dom"; | ||
|
||
describe('Navbar', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><Navbar onLogin={() => {}}/></BrowserRouter>).should("exist") | ||
cy.get(".navbar").should("be.visible") | ||
.and("contain.text", "Pigeonhole") | ||
cy.get(".landing-page-btn").should("be.visible") | ||
cy.get(".white-color").should("be.visible") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ProjectCard from '../../src/pages/index/components/ProjectCard' | ||
import {BrowserRouter} from "react-router-dom"; | ||
Cypress.on('uncaught:exception', (err: any, runnable: any) => { | ||
|
||
return false | ||
}) | ||
describe('<ProjectCard />', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><ProjectCard courseId={undefined}/></BrowserRouter>).should("exist") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import ProjectInfo from '../../src/pages/index/components/ProjectInfo' | ||
const mockProject = {course: {name: "test course 1", url: "test course 1 url", courseId: 1908}, | ||
deadline: "2023/05/15", | ||
description: "do something", | ||
clusterId: null, | ||
projectId: 35, | ||
name: "test project 1", | ||
submissionUrl: null, | ||
testsUrl: "test project 1 url", | ||
maxScore: null, | ||
visible: true, | ||
progress: { | ||
completed: 5, | ||
total: 10, | ||
}, | ||
groupId: null, | ||
} | ||
|
||
describe('<ProjectInfo />', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ProjectInfo project={mockProject}/>).should("exist") | ||
cy.get("body").should("contain.text", "home.projects.name") | ||
.and("contain.text", "test course 1") | ||
.and("contain.text", "home.projects.deadline") | ||
.and("contain.text", "15 mei 2023") | ||
.and("contain.text", "home.projects.description") | ||
.and("contain.text", "do something") | ||
.and("contain.text", "home.projects.projectStatus") | ||
.and("contain.text", "home.projects.groupProgress") | ||
.and("contain.text", "50%") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import ProjectStatusTag from '../../src/pages/index/components/ProjectStatusTag' | ||
|
||
describe('ProjectStatusTag', () => { | ||
it('renders when correct', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ProjectStatusTag status="correct" icon={true}/>).should("exist") | ||
cy.get("body").should("contain.text", "home.projects.status.completed") | ||
}) | ||
it('renders when incorrect', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ProjectStatusTag status="incorrect" icon={true}/>).should("exist") | ||
cy.get("body").should("contain.text", "home.projects.status.failed") | ||
.and("not.contain.text", "home.projects.status.completed") | ||
}) | ||
it('renders when not started', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ProjectStatusTag status="not started" icon={true}/>).should("exist") | ||
cy.get("body").should("contain.text", "home.projects.status.notStarted") | ||
.and("not.contain.text", "home.projects.status.completed") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import ProjectTable from '../../src/pages/index/components/ProjectTable' | ||
|
||
Cypress.on('uncaught:exception', (err: any, runnable: any) => { | ||
|
||
return false | ||
}) | ||
|
||
const mockProjects = [ | ||
{course: {name: "test course 1", url: "test course 1 url", courseId: 1908}, | ||
deadline: "2024/05/28", | ||
description: "do something", | ||
clusterId: null, | ||
projectId: 35, | ||
name: "test project 1", | ||
submissionUrl: null, | ||
testsUrl: "test project 1 url", | ||
maxScore: null, | ||
visible: true, | ||
progress: { | ||
completed: 5, | ||
total: 10, | ||
}, | ||
groupId: null, | ||
}, | ||
{course: {name: "test course 1", url: "test course 1 url", courseId: 1908}, | ||
deadline: "2024/06/03", | ||
description: "do something", | ||
clusterId: null, | ||
projectId: 36, | ||
name: "test project 2", | ||
submissionUrl: null, | ||
testsUrl: "test project 2 url", | ||
maxScore: null, | ||
visible: true, | ||
progress: { | ||
completed: 0, | ||
total: 10, | ||
}, | ||
groupId: null, | ||
} | ||
] | ||
|
||
describe('ProjectTable', () => { | ||
it('renders loading correctly', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ProjectTable projects={null}/>).should("exist") | ||
cy.get('.ant-spin-dot').should("be.visible") | ||
}) | ||
it('renders projects', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ProjectTable projects={mockProjects}/>).should("exist") | ||
cy.get('.ant-spin-dot').should("not.exist") | ||
cy.get("body").should("not.contain.text", "home.projects.noProjects") | ||
}) | ||
it('renders no projects', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ProjectTable projects={[]}/>).should("exist") | ||
cy.get('.ant-spin-dot').should("not.exist") | ||
cy.get("body").should("contain.text", "home.projects.noProjects") | ||
.and("contain.text", "home.projects.name") | ||
.and("contain.text", "home.projects.course") | ||
.and("contain.text", "home.projects.projectStatus") | ||
.and("contain.text", "home.projects.deadline") | ||
.and("contain.text", "home.projects.groupProgress") | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import ScoreCard from '../../src/pages/project/components/ScoreTab' | ||
|
||
describe('ScoreCard', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<ScoreCard />).should("exist") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import SubmissionList from '../../src/pages/project/components/SubmissionList' | ||
|
||
describe('SubmissionList', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<SubmissionList submissions={[]}/>).should("exist") | ||
cy.get("body").should("contain.text", "project.noSubmissions") | ||
.and("contain.text", "project.submission") | ||
.and("contain.text", "project.submissionTime") | ||
.and("contain.text", "project.status") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import SubmissionStatusTag, {SubmissionStatus} from '../../src/pages/project/components/SubmissionStatusTag' | ||
|
||
describe('SubmissionStatusTag', () => { | ||
it('renders when passed', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<SubmissionStatusTag status={SubmissionStatus.PASSED}/>) | ||
cy.get("body").should("contain.text", "project.passed") | ||
.and("not.contain.text", "project.testFailed") | ||
.and("not.contain.text", "project.notSubmitted") | ||
}) | ||
it('renders when failed', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<SubmissionStatusTag status={SubmissionStatus.DOCKER_REJECTED}/>) | ||
cy.get("body").should("contain.text", "project.testFailed") | ||
.and("not.contain.text", "project.passed") | ||
.and("not.contain.text", "project.notSubmitted") | ||
}) | ||
it('renders when not submitted', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<SubmissionStatusTag status={SubmissionStatus.NOT_SUBMITTED}/>) | ||
cy.get("body").should("not.contain.text", "project.passed") | ||
.and("not.contain.text", "project.testFailed") | ||
.and("contain.text", "project.notSubmitted") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import SubmissionTab from '../../src/pages/project/components/SubmissionTab' | ||
|
||
describe('SubmissionTab', () => { | ||
it('renders when loading', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<SubmissionTab projectId={1} courseId={1}/>).should("exist") | ||
cy.get(".ant-spin-dot").should("be.visible") | ||
}) | ||
}) |
Oops, something went wrong.