-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from sandboxnu/dc-limbo-fsm
Priority Queue
- Loading branch information
Showing
37 changed files
with
1,479 additions
and
427 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
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
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
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,141 @@ | ||
describe("can't be found", () => { | ||
beforeEach(() => { | ||
// Set the state | ||
cy.request("POST", "/api/v1/seeds/createUser", { role: "student" }) | ||
.then((res) => res.body) | ||
.as("student"); | ||
|
||
cy.get("@student").then((student) => { | ||
cy.request("POST", "/api/v1/seeds/createQueue", { | ||
courseId: student.course.id, | ||
allowQuestions: true, | ||
}) | ||
.then((res) => res.body) | ||
.as("queue"); | ||
}); | ||
|
||
//creates TA | ||
cy.get("@student").then((student) => { | ||
cy.request("POST", "/api/v1/seeds/createUser", { | ||
role: "ta", | ||
courseId: student.course.id, | ||
}) | ||
.then((res) => res.body) | ||
.as("ta"); | ||
}); | ||
|
||
cy.get("@queue").then((queue) => { | ||
cy.get("@ta").then((ta) => { | ||
cy.visit(`/api/v1/login/dev?userId=${ta.user.id}`); | ||
|
||
// Check the TA into the queue | ||
cy.request( | ||
"POST", | ||
`/api/v1/courses/${queue.course.id}/ta_location/${queue.room}` | ||
); | ||
}); | ||
}); | ||
|
||
// Login the student | ||
cy.get("@student").then((student) => { | ||
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`); | ||
}); | ||
|
||
// Visit the queue page and create a question | ||
cy.get("@queue").then((queue) => | ||
cy.visit(`/course/${queue.courseId}/queue/${queue.id}`).then(() => { | ||
// Click "Join Queue" | ||
cy.get("body").should("contain", "Join Queue"); | ||
cy.get('[data-cy="join-queue-button"]').click(); | ||
|
||
// Fill out the question form | ||
cy.get("body").should("contain", "Concept"); | ||
cy.get("label").contains("Concept").click({ | ||
force: true, | ||
}); | ||
cy.get("[data-cy='questionText']").type( | ||
"How do I use the design recipe?" | ||
); | ||
|
||
// Click Submit | ||
cy.get("[data-cy='finishQuestion']").click(); | ||
}) | ||
); | ||
|
||
//TA opens the student's question | ||
cy.get("@queue").then((queue) => { | ||
cy.get("@ta").then((ta) => { | ||
cy.visit(`/api/v1/login/dev?userId=${ta.user.id}`); | ||
|
||
cy.get(".ant-modal-close-x").click(); | ||
// Visit the queue page | ||
cy.visit(`/course/${queue.courseId}/queue/${queue.id}`); | ||
}); | ||
}); | ||
}); | ||
|
||
it("Can't find student and student leaves the queue", () => { | ||
cy.get("@queue").then((queue) => { | ||
cy.get("@ta").then((ta) => { | ||
cy.get("body").should("contain", "Help Next"); | ||
cy.get("button").contains("Help Next").click(); | ||
|
||
// Click Can't Find | ||
cy.get("body").should("contain", "Can't Find"); | ||
cy.get("button").contains("Can't Find").click(); | ||
|
||
cy.get("body").should("contain", "Yes"); | ||
cy.get("button").contains("Yes").click(); | ||
}); | ||
}); | ||
|
||
// Login the student | ||
cy.get("@student").then((student) => { | ||
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`); | ||
}); | ||
cy.get("@queue").then((queue) => | ||
cy.visit(`course/${queue.courseId}/queue/${queue.id}`).then(() => { | ||
cy.get("body").should( | ||
"contain", | ||
"A TA tried to help you, but couldn't reach you. Are you still in the queue? If you are, make sure you have Teams open, and rejoin the queue." | ||
); | ||
|
||
//cy.get(".ant-modal").should("contain", "Leave Queue"); | ||
cy.get("button").contains("Leave Queue").click(); | ||
}) | ||
); | ||
}); | ||
|
||
it("Can't find student and student rejoins the queue", () => { | ||
cy.get("@queue").then((queue) => { | ||
cy.get("@ta").then((ta) => { | ||
cy.get("body").should("contain", "Help Next"); | ||
cy.get("button").contains("Help Next").click(); | ||
// Click Can't Find | ||
cy.get("body").should("contain", "Can't Find"); | ||
cy.get("button").contains("Can't Find").click(); | ||
|
||
cy.get("body").should("contain", "Yes"); | ||
cy.get("button").contains("Yes").click(); | ||
}); | ||
}); | ||
|
||
// Login the student | ||
cy.get("@student").then((student) => { | ||
cy.visit(`/api/v1/login/dev?userId=${student.user.id}`); | ||
}); | ||
cy.get("@queue").then((queue) => | ||
cy.visit(`course/${queue.courseId}/queue/${queue.id}`).then(() => { | ||
cy.get("body").should( | ||
"contain", | ||
"A TA tried to help you, but couldn't reach you. Are you still in the queue? If you are, make sure you have Teams open, and rejoin the queue." | ||
); | ||
|
||
cy.get("button").contains("Rejoin Queue").click(); | ||
cy.contains( | ||
"You are now in a priority queue, you will be helped soon. You were last helped by User." | ||
); | ||
}) | ||
); | ||
}); | ||
}); |
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
Oops, something went wrong.
aa72ed8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: