Merged in bugfix/flaky_notifications_test (pull request #131)
Fix notification settings cypress test
This commit is contained in:
commit
b4bf838ad7
|
|
@ -1,6 +1,6 @@
|
|||
import { login } from "./helpers";
|
||||
|
||||
describe("notifications.cy.js", () => {
|
||||
describe("notification list page", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand("cypress_reset");
|
||||
cy.manageCommand("create_default_notifications");
|
||||
|
|
@ -9,6 +9,7 @@ describe("notifications.cy.js", () => {
|
|||
it("can paginate notifications", () => {
|
||||
login("admin", "test");
|
||||
cy.visit("/notifications");
|
||||
cy.wait(2000);
|
||||
|
||||
cy.get('[data-cy="no-notifications"]').should("not.exist");
|
||||
cy.get("[data-cy^=notification-idx-]").should("have.length", 7);
|
||||
|
|
@ -21,8 +22,7 @@ describe("notifications.cy.js", () => {
|
|||
|
||||
// We load additional 7 notifications
|
||||
cy.get('[data-cy="load-more-notifications"]').click();
|
||||
cy.get("[data-cy^=notification-idx-]").should("have.length", 13);
|
||||
cy.get('[data-cy="load-more-notifications"]').should("not.exist");
|
||||
cy.get("[data-cy^=notification-idx-]").should("have.length", 14);
|
||||
|
||||
for (let i = 0; i < 7; i++) {
|
||||
cy.get(`[data-cy=notification-idx-${i}]`).within(() => {
|
||||
|
|
@ -94,19 +94,24 @@ describe("email notification settings", () => {
|
|||
login("admin", "test");
|
||||
cy.visit("/settings");
|
||||
cy.wait(1000);
|
||||
|
||||
// Checking prerequisites
|
||||
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').should("not.be.checked");
|
||||
cy.get('[data-cy="it-checkbox-INFORMATION"]').should("not.be.checked");
|
||||
cy.get('[data-cy="it-checkbox-PROGRESS"]').should("not.be.checked");
|
||||
|
||||
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').click({ force: true });
|
||||
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').check({ force: true });
|
||||
cy.get('[data-cy="it-checkbox-INFORMATION"]').check({ force: true });
|
||||
|
||||
cy.reload();
|
||||
cy.wait(1000);
|
||||
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').should("be.checked");
|
||||
cy.get('[data-cy="it-checkbox-INFORMATION"]').should("not.be.checked");
|
||||
cy.get('[data-cy="it-checkbox-INFORMATION"]').should("be.checked");
|
||||
cy.get('[data-cy="it-checkbox-PROGRESS"]').should("not.be.checked");
|
||||
|
||||
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').click({ force: true });
|
||||
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').uncheck({ force: true });
|
||||
cy.get('[data-cy="it-checkbox-INFORMATION"]').uncheck({ force: true });
|
||||
|
||||
cy.reload();
|
||||
cy.wait(1000);
|
||||
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]').should("not.be.checked");
|
||||
|
|
|
|||
|
|
@ -55,15 +55,17 @@ const _ = Cypress._;
|
|||
Cypress.Commands.add("manageCommand", (command, preCommand = "") => {
|
||||
const execCommand = `${preCommand} python server/manage.py ${command} --settings=config.settings.test_cypress`;
|
||||
console.log(execCommand);
|
||||
// hack to add my asdf python instance to the path
|
||||
// so I can run the test directly from within IntelliJ
|
||||
let pythonPaths = [
|
||||
"/Users/daniel/workspace/vbv_lernwelt/.direnv/python-3.10.6/bin",
|
||||
"/Users/eliabieri/iterativ/vbv_lernwelt/.direnv/python-3.10.6/bin",
|
||||
];
|
||||
let bashCommand = `PATH=${pythonPaths.join(":")}:$PATH && ${execCommand}`;
|
||||
return cy
|
||||
.exec(
|
||||
// hack to add my asdf python instance to the path
|
||||
// so I can run the test directly from within IntelliJ
|
||||
`PATH=/Users/daniel/workspace/vbv_lernwelt/.direnv/python-3.10.6/bin:$PATH && ${execCommand}`,
|
||||
{
|
||||
failOnNonZeroExit: false,
|
||||
}
|
||||
)
|
||||
.exec(`bash -c "${bashCommand}"`, {
|
||||
failOnNonZeroExit: true,
|
||||
})
|
||||
.then((result) => {
|
||||
if (result.code) {
|
||||
throw new Error(`Execution of "${command}" failed
|
||||
|
|
|
|||
|
|
@ -22,9 +22,10 @@ from vbv_lernwelt.notify.models import Notification
|
|||
def command(create_completion):
|
||||
print("cypress reset data")
|
||||
CourseCompletion.objects.all().delete()
|
||||
Notification.objects.all().delete()
|
||||
Notification.objects.all().mark_all_as_deleted()
|
||||
AssignmentCompletion.objects.all().delete()
|
||||
User.objects.all().update(language="de")
|
||||
User.objects.all().update(additional_json_data={})
|
||||
|
||||
if create_completion:
|
||||
print("create completion data for test course")
|
||||
|
|
|
|||
Loading…
Reference in New Issue