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