Additional fixes

This commit is contained in:
Elia Bieri 2023-06-20 15:13:53 +02:00
parent 8a7453ce0e
commit 3f7b27c266
2 changed files with 16 additions and 11 deletions

View File

@ -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(() => {
@ -109,6 +109,9 @@ describe("email notification settings", () => {
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]') cy.get('[data-cy="it-checkbox-USER_INTERACTION"]')
.should("exist") .should("exist")
.check({ force: true }); .check({ force: true });
cy.get('[data-cy="it-checkbox-USER_INTERACTION"]')
.should("exist")
.should("be.checked");
cy.reload(); cy.reload();
cy.wait(1000); cy.wait(1000);

View File

@ -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