Skip to content

Commit

Permalink
Complete Testing Doc
Browse files Browse the repository at this point in the history
Also move screenshots and gifs to the docs/ folder
  • Loading branch information
YuxinZhang214 committed Jan 11, 2024
1 parent 1584a52 commit f214558
Show file tree
Hide file tree
Showing 12 changed files with 335 additions and 275 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,39 @@ Below are some screenshots of the project UI:

### Home Page

![Home Page](screenshots/homepage.png)
![Home Page](docs/screenshots/homepage.png)

This is the homepage with no existing project

### Project Page

![Project Page](screenshots/project.png)
![Project Page](docs/screenshots/project.png)

This is the project page showing the project details

## Example GIFs

### Create new project

![Create Project](screenshots/create-project.gif)
![Create Project](docs/screenshots/create-project.gif)

Create a new project named **Project Management System**

### Create new category

![Create Category](screenshots/create-categories.gif)
![Create Category](docs/screenshots/create-categories.gif)

Create a new category named **Planning**

### Create new task

![Create Task](screenshots/create-task.gif)
![Create Task](docs/screenshots/create-task.gif)

Create a new task named **Design the database schema** under the **Planning** category

### Create new user

![Create User](screenshots/create-user.gif)
![Create User](docs/screenshots/create-user.gif)

Create a user named **John Smith** managing the **Planning** tasks. He prefers to take over the **Design database schema** task.

Expand Down
1 change: 1 addition & 0 deletions components/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default function Layout({ children }) {
<div className={"mt-8"}>
<Link href={"/output"}>
<button
id={"nav-solution"}
className={
"group flex w-full items-center justify-start space-x-2 px-2"
}
Expand Down
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = defineConfig({
setupNodeEvents(on, config) {
// implement node event listeners here
},
screenshotOnRunFailure: false, // disable screenshots on test failure
},

component: {
Expand Down
286 changes: 277 additions & 9 deletions cypress/e2e/get_solution.cy.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,290 @@
describe("Generate solution when click on get solution link", () => {
describe("Generate solution for Project Management", () => {

const project_data = {
id: 1,
name: "Testing Project",
tasks: [],
users: [],
categories: [],
output_history: [],
"id": 0,
"name": "Project Management",
"tasks": [
{
"id": 0,
"name": " Code feature A",
"description": "",
"category": 0,
"weight": 2
},
{
"id": 1,
"name": "Debug module B",
"description": "",
"category": 0,
"weight": 3
},
{
"id": 2,
"name": "Write unit tests",
"description": "",
"category": 1,
"weight": 1
},
{
"id": 3,
"name": "Conduct code review",
"description": "",
"category": 2,
"weight": 5
},
{
"id": 4,
"name": "Document feature C",
"description": "",
"category": 2,
"weight": 1
}
],
"users": [
{
"id": 0,
"name": "Alice",
"categories": [
{
"id": 0,
"percentage": 0
}
],
"task_blacklist": [
2,
3,
4
],
"preferences": [
0
]
},
{
"id": 1,
"name": "Bob",
"categories": [
{
"id": 0,
"percentage": 0
}
],
"task_blacklist": [
2,
3,
4,
0
],
"preferences": [
1
]
},
{
"id": 2,
"name": "Charlie",
"categories": [
{
"id": 1,
"percentage": 0
}
],
"task_blacklist": [
0,
1,
4,
3
],
"preferences": [
2
]
},
{
"id": 3,
"name": "David",
"task_blacklist": [
0,
1,
2
],
"preferences": [
3,
4
],
"categories": [
{
"id": 2,
"percentage": 0
}
]
}
],
"categories": [
{
"id": 0,
"name": "Development"
},
{
"id": 1,
"name": "Testing"
},
{
"id": 2,
"name": "Documentation"
}
],
"locked_tasks": []
};

beforeEach(() => {
// Visiting the home page before each test
cy.visit("/");
// Set up with a Testing Project
cy.window().then((win) => {
win.localStorage.setItem(
"workload_project_data",
JSON.stringify(project_data),
);
});
});

it("should successfully generate a solution for Project Management", () => {
cy.get("#nav-solution").as("navSolutionButton");
cy.get("@navSolutionButton").click();
cy.url().should("eq", Cypress.config().baseUrl + "/output");

// Click on Generate Solution
// [pending waiting server to back up]
});
});

describe("Generate solution for Class Assignments in a School", () => {

const school_project_data = {
"id": 0,
"name": "Class Assignments in a School",
"tasks": [
{
"id": 0,
"name": "Teach Math",
"description": "",
"category": 0,
"weight": 4
},
{
"id": 1,
"name": " Teach Science",
"description": "",
"category": 0,
"weight": 3
},
{
"id": 2,
"name": "Teach History",
"description": "",
"category": 0,
"weight": 5
},
{
"id": 3,
"name": "Supervise Laboratory",
"description": "",
"category": 1,
"weight": 2
},
{
"id": 4,
"name": "Monitor Recess",
"description": "",
"category": 1,
"weight": 4
}
],
"users": [
{
"id": 0,
"name": "Mr. Smith",
"task_blacklist": [
1,
2,
3,
4
],
"preferences": [
0
],
"categories": [
{
"id": 0,
"percentage": 0
}
]
},
{
"id": 1,
"name": "Ms. Johnson",
"task_blacklist": [
0,
2,
3,
4
],
"preferences": [
1
],
"categories": [
{
"id": 0,
"percentage": 0
}
]
},
{
"id": 2,
"name": "Mr. Brown",
"task_blacklist": [
0,
1,
3,
4
],
"preferences": [
2
],
"categories": [
{
"id": 0,
"percentage": 0
}
]
}
],
"categories": [
{
"id": 0,
"name": "Teaching"
},
{
"id": 1,
"name": "Supervision"
}
],
"locked_tasks": []
}


beforeEach(() => {
cy.visit("/");
cy.window().then((win) => {
win.localStorage.setItem(
"workload_project_data",
JSON.stringify(school_project_data),
);
});
});

it("should failed generate a solution for Class Assignments in a School", () => {
cy.get("#nav-solution").as("navSolutionButton");
cy.get("@navSolutionButton").click();
cy.url().should("eq", Cypress.config().baseUrl + "/output");

// Click on Generate Solution
// [pending waiting server to back up]
});
});
Empty file added cypress/support/commands.js
Empty file.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit f214558

Please sign in to comment.