Fix cypress tests
This commit is contained in:
parent
dacda2e19a
commit
0c5e48aa30
|
|
@ -1,16 +1,22 @@
|
||||||
// ids for cypress test data
|
// ids for cypress test data
|
||||||
export const ADMIN_USER_ID = "872efd96-3bd7-4a1e-a239-2d72cad9f604"
|
export const ADMIN_USER_ID = "872efd96-3bd7-4a1e-a239-2d72cad9f604";
|
||||||
export const TEST_SUPERVISOR1_USER_ID = "a9a8b741-f115-4521-af2d-7dfef673b8c5"
|
export const TEST_SUPERVISOR1_USER_ID = "a9a8b741-f115-4521-af2d-7dfef673b8c5";
|
||||||
export const TEST_TRAINER1_USER_ID = "b9e71f59-c44f-4290-b93a-9b3151e9a2fc"
|
export const TEST_TRAINER1_USER_ID = "b9e71f59-c44f-4290-b93a-9b3151e9a2fc";
|
||||||
export const TEST_TRAINER2_USER_ID = "299941ae-1e4b-4f45-8180-876c3ad340b4"
|
export const TEST_TRAINER2_USER_ID = "299941ae-1e4b-4f45-8180-876c3ad340b4";
|
||||||
export const TEST_STUDENT1_USER_ID = "65c73ad0-6d53-43a9-a4a4-64143f27b03a"
|
export const TEST_STUDENT1_USER_ID = "65c73ad0-6d53-43a9-a4a4-64143f27b03a";
|
||||||
export const TEST_STUDENT2_USER_ID = "19c40d94-15cc-4198-aaad-ef707c4b0900"
|
export const TEST_STUDENT2_USER_ID = "19c40d94-15cc-4198-aaad-ef707c4b0900";
|
||||||
export const TEST_STUDENT3_USER_ID = "bcf94dba-53bc-474b-a22d-e4af39aa042b"
|
export const TEST_STUDENT3_USER_ID = "bcf94dba-53bc-474b-a22d-e4af39aa042b";
|
||||||
export const TEST_MENTOR1_USER_ID = "d1f5f5a9-5b0a-4e1a-9e1a-9e9b5b5e1b1b"
|
export const TEST_MENTOR1_USER_ID = "d1f5f5a9-5b0a-4e1a-9e1a-9e9b5b5e1b1b";
|
||||||
export const TEST_STUDENT1_VV_USER_ID = "5ff59857-8de5-415e-a387-4449f9a0337a"
|
export const TEST_STUDENT1_VV_USER_ID = "5ff59857-8de5-415e-a387-4449f9a0337a";
|
||||||
export const TEST_STUDENT2_VV_AND_VV_MENTOR_USER_ID = "7e8ebf0b-e6e2-4022-88f4-6e663ba0a9db"
|
export const TEST_STUDENT2_VV_AND_VV_MENTOR_USER_ID =
|
||||||
export const TEST_USER_EMPTY_ID = "daecbabe-4ab9-4edf-a71f-4119042ccb02"
|
"7e8ebf0b-e6e2-4022-88f4-6e663ba0a9db";
|
||||||
|
export const TEST_USER_EMPTY_ID = "daecbabe-4ab9-4edf-a71f-4119042ccb02";
|
||||||
|
|
||||||
export const TEST_COURSE_SESSION_BERN_ID = -1;
|
export const TEST_COURSE_SESSION_BERN_ID = -1;
|
||||||
export const TEST_COURSE_SESSION_ZURICH_ID = -2;
|
export const TEST_COURSE_SESSION_ZURICH_ID = -2;
|
||||||
|
export const TEST_COURSE_SESSION_VV_ID = 1;
|
||||||
|
|
||||||
|
export const COURSE_PROFILE_LEBEN_ID = -1;
|
||||||
|
export const COURSE_PROFILE_NICHTLEBEN_ID = -2;
|
||||||
|
export const COURSE_PROFILE_KRANKENZUSATZ_ID = -3;
|
||||||
|
export const COURSE_PROFILE_ALL_ID = -99;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
import { TEST_USER_EMPTY_ID } from "../../consts";
|
import {
|
||||||
|
COURSE_PROFILE_ALL_ID,
|
||||||
|
COURSE_PROFILE_NICHTLEBEN_ID,
|
||||||
|
TEST_COURSE_SESSION_VV_ID,
|
||||||
|
TEST_USER_EMPTY_ID
|
||||||
|
} from "../../consts";
|
||||||
import { login } from "../helpers";
|
import { login } from "../helpers";
|
||||||
|
|
||||||
describe("checkout.cy.js", () => {
|
describe("checkout.cy.js", () => {
|
||||||
|
|
@ -32,6 +37,10 @@ describe("checkout.cy.js", () => {
|
||||||
cy.get("#organisationDetailName").type("FdH GmbH");
|
cy.get("#organisationDetailName").type("FdH GmbH");
|
||||||
cy.get('[data-cy="continue-button"]').click();
|
cy.get('[data-cy="continue-button"]').click();
|
||||||
|
|
||||||
|
cy.get('[data-cy="dropdown-select"]').click();
|
||||||
|
cy.get('[data-cy="dropdown-select-option-Nichtleben"]').click();
|
||||||
|
cy.get('[data-cy="continue-button"]').click();
|
||||||
|
|
||||||
cy.loadUser("id", TEST_USER_EMPTY_ID).then((u) => {
|
cy.loadUser("id", TEST_USER_EMPTY_ID).then((u) => {
|
||||||
expect(u.organisation_detail_name).to.equal("FdH GmbH");
|
expect(u.organisation_detail_name).to.equal("FdH GmbH");
|
||||||
// 2 -> andere Krankenversicherer
|
// 2 -> andere Krankenversicherer
|
||||||
|
|
@ -121,6 +130,12 @@ describe("checkout.cy.js", () => {
|
||||||
cy.loadCheckoutInformation("user_id", TEST_USER_EMPTY_ID).then((ci) => {
|
cy.loadCheckoutInformation("user_id", TEST_USER_EMPTY_ID).then((ci) => {
|
||||||
expect(ci.state).to.equal("paid");
|
expect(ci.state).to.equal("paid");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cy.loadCourseSessionUser("user_id", TEST_USER_EMPTY_ID).then((csu) => {
|
||||||
|
expect(csu.role).to.equal("MEMBER");
|
||||||
|
expect(csu.course_session).to.equal(TEST_COURSE_SESSION_VV_ID);
|
||||||
|
expect(csu.chosen_profile).to.equal(COURSE_PROFILE_NICHTLEBEN_ID);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("can checkout and pay Versicherungsvermittlerin with Cembra invoice", () => {
|
it("can checkout and pay Versicherungsvermittlerin with Cembra invoice", () => {
|
||||||
|
|
@ -143,6 +158,10 @@ describe("checkout.cy.js", () => {
|
||||||
cy.get('[data-cy="dropdown-select-option-Baloise"]').click();
|
cy.get('[data-cy="dropdown-select-option-Baloise"]').click();
|
||||||
cy.get('[data-cy="continue-button"]').click();
|
cy.get('[data-cy="continue-button"]').click();
|
||||||
|
|
||||||
|
cy.get('[data-cy="dropdown-select"]').click();
|
||||||
|
cy.get('[data-cy="dropdown-select-option-Allbranche"]').click();
|
||||||
|
cy.get('[data-cy="continue-button"]').click();
|
||||||
|
|
||||||
// Adressdaten ausfüllen
|
// Adressdaten ausfüllen
|
||||||
cy.get('[data-cy="account-checkout-title"]').should(
|
cy.get('[data-cy="account-checkout-title"]').should(
|
||||||
"contain",
|
"contain",
|
||||||
|
|
@ -236,5 +255,32 @@ describe("checkout.cy.js", () => {
|
||||||
// 7 -> Baloise
|
// 7 -> Baloise
|
||||||
expect(u.organisation).to.equal(7);
|
expect(u.organisation).to.equal(7);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// pay
|
||||||
|
cy.get('[data-cy="pay-button"]').click();
|
||||||
|
|
||||||
|
cy.get('[data-cy="checkout-success-title"]').should(
|
||||||
|
"contain",
|
||||||
|
"Gratuliere",
|
||||||
|
);
|
||||||
|
// wait for payment callback
|
||||||
|
cy.wait(3000);
|
||||||
|
cy.get('[data-cy="start-vv-button"]').click();
|
||||||
|
|
||||||
|
// back on dashboard page
|
||||||
|
cy.get('[data-cy="db-course-title"]').should(
|
||||||
|
"contain",
|
||||||
|
"Versicherungsvermittler",
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.loadCheckoutInformation("user_id", TEST_USER_EMPTY_ID).then((ci) => {
|
||||||
|
expect(ci.state).to.equal("paid");
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.loadCourseSessionUser("user_id", TEST_USER_EMPTY_ID).then((csu) => {
|
||||||
|
expect(csu.role).to.equal("MEMBER");
|
||||||
|
expect(csu.course_session).to.equal(TEST_COURSE_SESSION_VV_ID);
|
||||||
|
expect(csu.chosen_profile).to.equal(COURSE_PROFILE_ALL_ID);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,17 @@ Cypress.Commands.add("loadUser", (key, value) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Cypress.Commands.add("loadCourseSessionUser", (key, value) => {
|
||||||
|
return loadObjectJson(
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
"vbv_lernwelt.course.models.CourseSessionUser",
|
||||||
|
"vbv_lernwelt.course.serializers.CypressCourseSessionUserSerializer",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Cypress.Commands.add("makeSelfEvaluation", (answers) => {
|
Cypress.Commands.add("makeSelfEvaluation", (answers) => {
|
||||||
for (let i = 0; i < answers.length; i++) {
|
for (let i = 0; i < answers.length; i++) {
|
||||||
const answer = answers[i]
|
const answer = answers[i]
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ from vbv_lernwelt.course.models import (
|
||||||
CourseCompletion,
|
CourseCompletion,
|
||||||
CourseConfiguration,
|
CourseConfiguration,
|
||||||
CourseSession,
|
CourseSession,
|
||||||
|
CourseSessionUser,
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.iam.permissions import course_session_permissions
|
from vbv_lernwelt.iam.permissions import course_session_permissions
|
||||||
from vbv_lernwelt.learnpath.models import CourseProfile
|
from vbv_lernwelt.learnpath.models import CourseProfile
|
||||||
|
|
@ -117,6 +118,12 @@ class CourseSessionSerializer(serializers.ModelSerializer):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
class CypressCourseSessionUserSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = CourseSessionUser
|
||||||
|
fields = "__all__"
|
||||||
|
|
||||||
|
|
||||||
class CircleDocumentSerializer(serializers.ModelSerializer):
|
class CircleDocumentSerializer(serializers.ModelSerializer):
|
||||||
learning_sequence = serializers.SerializerMethodField()
|
learning_sequence = serializers.SerializerMethodField()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,18 @@ logger = structlog.get_logger(__name__)
|
||||||
def create_course_profiles():
|
def create_course_profiles():
|
||||||
from vbv_lernwelt.learnpath.models import CourseProfile
|
from vbv_lernwelt.learnpath.models import CourseProfile
|
||||||
|
|
||||||
CourseProfile.objects.create(
|
CourseProfile.objects.get_or_create(
|
||||||
id=COURSE_PROFILE_LEBEN_ID, code=COURSE_PROFILE_LEBEN_CODE
|
id=COURSE_PROFILE_LEBEN_ID, code=COURSE_PROFILE_LEBEN_CODE
|
||||||
)
|
)
|
||||||
CourseProfile.objects.create(
|
CourseProfile.objects.get_or_create(
|
||||||
id=COURSE_PROFILE_NICHTLEBEN_ID, code=COURSE_PROFILE_NICHTLEBEN_CODE
|
id=COURSE_PROFILE_NICHTLEBEN_ID, code=COURSE_PROFILE_NICHTLEBEN_CODE
|
||||||
)
|
)
|
||||||
CourseProfile.objects.create(
|
CourseProfile.objects.get_or_create(
|
||||||
id=COURSE_PROFILE_KRANKENZUSATZ_ID, code=COURSE_PROFILE_KRANKENZUSATZ_CODE
|
id=COURSE_PROFILE_KRANKENZUSATZ_ID, code=COURSE_PROFILE_KRANKENZUSATZ_CODE
|
||||||
)
|
)
|
||||||
CourseProfile.objects.create(id=COURSE_PROFILE_ALL_ID, code=COURSE_PROFILE_ALL_CODE)
|
CourseProfile.objects.get_or_create(
|
||||||
|
id=COURSE_PROFILE_ALL_ID, code=COURSE_PROFILE_ALL_CODE
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def assign_circles_to_profiles():
|
def assign_circles_to_profiles():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue