-
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.
added final component tests so all finished components/pages are prop…
…erly tested now
- Loading branch information
1 parent
a193b27
commit 9d3148c
Showing
6 changed files
with
113 additions
and
0 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,11 @@ | ||
import GroupClusterDropdown from '../../src/pages/projectCreate/components/GroupClusterDropdown' | ||
|
||
describe('GroupClusterDropdown', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<GroupClusterDropdown courseId={1}/>).should("exist") | ||
cy.get(".ant-select-selector").should("be.visible") | ||
cy.get(".ant-select-selector").click() | ||
cy.get("body").should("contain.text", "no") | ||
}) | ||
}) |
14 changes: 14 additions & 0 deletions
14
frontend/cypress/components/GroupClusterModalContent.cy.tsx
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 GroupClusterModalContent from '../../src/pages/projectCreate/components/GroupClusterModalContent' | ||
|
||
describe('GroupClusterModalContent', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<GroupClusterModalContent courseId={1} onClusterCreated={(c) => {}} onClose={()=>{}}/>).should("exist") | ||
cy.get("#name").type("TEST") | ||
cy.get("body").should("contain.text", "project.change.clusterName") | ||
.and("contain.text", "project.change.amountOfGroups") | ||
.and("contain.text", "project.change.groupSize") | ||
cy.get(':nth-child(1) > .ant-btn').should("be.visible") | ||
cy.get(':nth-child(2) > .ant-btn').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,15 @@ | ||
import SubmitForm from '../../src/pages/submit/components/SubmitForm' | ||
|
||
describe('SubmitForm', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<SubmitForm/>).should("exist") | ||
cy.get("body").should("contain.text", "project.uploadAreaTitle") | ||
.and("contain.text", "project.uploadAreaSubtitle") | ||
}) | ||
it('opens a file window when clicked', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<SubmitForm />).should("exist") | ||
cy.get('.ant-upload-drag-container').click() | ||
}); | ||
}) |
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,48 @@ | ||
import ProjectCreate from '../../src/pages/projectCreate/ProjectCreate' | ||
import {BrowserRouter} from "react-router-dom"; | ||
|
||
describe('ProjectCreate', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><ProjectCreate /></BrowserRouter>).should("exist") | ||
cy.get("body").should("contain.text", "project.change.title") | ||
}) | ||
|
||
it('shows message for empty required fields', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><ProjectCreate /></BrowserRouter>).should("exist") | ||
cy.get("body").should("not.contain.text", "project.change.nameMessage") | ||
cy.get("#name").click() | ||
cy.get("body").click() | ||
cy.get("body").should("contain.text", "project.change.nameMessage") | ||
cy.get("#name").type("Test name") | ||
cy.get("body").click() | ||
cy.get("body").should("not.contain.text", "project.change.nameMessage") | ||
}) | ||
|
||
it('shows the description in the preview', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><ProjectCreate /></BrowserRouter>).should("exist") | ||
cy.get("#description").type("Test description") | ||
cy.get('[data-node-key="preview"]').click() | ||
cy.get("body").should("contain.text", "Test description") | ||
}) | ||
|
||
it('can switch between tabs', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><ProjectCreate /></BrowserRouter>).should("exist") | ||
cy.get("#name").should("be.visible") | ||
cy.get(".ant-select-selector").should("not.be.visible") | ||
cy.get("#structureTest").should("not.be.visible") | ||
cy.get("#rc-tabs-6-tab-groups").click() | ||
cy.get("#name").should("not.be.visible") | ||
cy.get(".ant-select-selector").should("be.visible") | ||
cy.get("#structureTest").should("not.be.visible") | ||
// idk why maar als ik 1maal klik dan switcht hij niet | ||
cy.get('#rc-tabs-6-tab-structure').click() | ||
cy.get('#rc-tabs-6-tab-structure').click() | ||
cy.get("#name").should("not.be.visible") | ||
cy.get(".ant-select-selector").should("not.be.visible") | ||
cy.get("#structureTest").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 Submission from '../../src/pages/submission/Submission' | ||
|
||
describe('Submission', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<Submission />).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,16 @@ | ||
import Submit from '../../src/pages/submit/Submit' | ||
import {BrowserRouter} from "react-router-dom"; | ||
|
||
describe('Submit', () => { | ||
it('renders', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><Submit /></BrowserRouter>).should("exist") | ||
cy.get("body").should("contain.text", "project.files") | ||
}) | ||
it('disables submit button by default', () => { | ||
// see: https://on.cypress.io/mounting-react | ||
cy.mount(<BrowserRouter><Submit /></BrowserRouter>).should("exist") | ||
cy.get('.ant-btn-default').should("be.visible").and("not.be.disabled") | ||
cy.get('.ant-btn-primary').should("be.visible").and("be.disabled") | ||
}) | ||
}) |