Weitere Tests, Besseres Typechecking, Alle Ausweise und Verbesserter Verbrauchsausweis Gewerbe
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import fuelList from "#components/Ausweis/fuelList";
|
||||
import fuelList from "#components/Ausweis/brennstoffListe";
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { Enums } from "@ibcornelsen/database/client";
|
||||
import "cypress-file-upload"
|
||||
|
||||
describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
||||
it("erstellt einen neuen Verbrauchsausweis Wohngebäude.", () => {
|
||||
cy.visit("/verbrauchsausweis");
|
||||
cy.visit("/energieausweis-erstellen/verbrauchsausweis-wohnen");
|
||||
|
||||
cy.wait(1000);
|
||||
|
||||
@@ -108,5 +109,138 @@ describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
||||
cy.get("input[name='verbrauch_5']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
||||
cy.get("input[name='verbrauch_6']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
||||
}
|
||||
});
|
||||
|
||||
// Warmwasser enthalten und bekannt
|
||||
const warmwasserEnthalten = Math.random() > 0.5;
|
||||
const anteilBekannt = Math.random() > 0.5;
|
||||
|
||||
if (warmwasserEnthalten) {
|
||||
cy.get("input[name='warmwasser_enthalten']").check();
|
||||
|
||||
if (anteilBekannt) {
|
||||
// Der Anteil ist bekannt, wir müssen ihn also angeben.
|
||||
cy.get("input[name='warmwasser_anteil_bekannt']").check();
|
||||
|
||||
cy.get("input[name='anteil_warmwasser_1']").type(faker.number.int({ min: 0, max: 50 }).toString());
|
||||
|
||||
if (zusaetzlicheHeizquelle) {
|
||||
// Zusätzliche Heizquelle existiert, also müssen wir auch hier den Anteil angeben.
|
||||
cy.get("input[name='anteil_warmwasser_2']").type(faker.number.int({ min: 0, max: 50 }).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Alternative Energieversorgungssysteme
|
||||
if (Math.random() > 0.5) cy.get("input[name='alternative_heizung']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='alternative_warmwasser']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='alternative_lueftung']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='alternative_kuehlung']").check();
|
||||
|
||||
// Gebäudetyp
|
||||
cy.get("select[name='gebaeudetyp']").then(($dropdown) => {
|
||||
const options = $dropdown.find('option');
|
||||
// Select the option at the random index
|
||||
cy.get("select[name='gebaeudetyp']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string);
|
||||
});
|
||||
|
||||
// Gebäudeteil
|
||||
cy.get("select[name='gebaeudeteil']").then(($dropdown) => {
|
||||
const options = $dropdown.find('option');
|
||||
// Select the option at the random index
|
||||
cy.get("select[name='gebaeudeteil']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string);
|
||||
});
|
||||
|
||||
// Lüftung
|
||||
cy.get("select[name='lueftung']").then(($dropdown) => {
|
||||
const options = $dropdown.find('option');
|
||||
// Select the option at the random index
|
||||
cy.get("select[name='lueftung']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string);
|
||||
});
|
||||
|
||||
// Kühlung
|
||||
cy.get("select[name='kuehlung']").then(($dropdown) => {
|
||||
const options = $dropdown.find('option');
|
||||
// Select the option at the random index
|
||||
cy.get("select[name='kuehlung']").select(options.eq(faker.number.int({ min: 1, max: options.length - 1 })).val() as string);
|
||||
});
|
||||
|
||||
// Leerstand
|
||||
cy.get("input[name='leerstand']").should("have.attr", "type", "number").type(faker.number.int({ min: 0, max: 30 }).toString());
|
||||
|
||||
// Heizungsanlage Daten
|
||||
if (Math.random() > 0.5) cy.get("input[name='zentralheizung']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='einzelofen']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='durchlauf_erhitzer']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='standard_kessel']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='solarsystem_warmwasser']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='waermepumpe']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='niedertemperatur_kessel']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='brennwert_kessel']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='warmwasser_rohre_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='heizungsrohre_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='zirkulation']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='raum_temperatur_regler']").check();
|
||||
|
||||
// Heizungsanlage Bilder
|
||||
cy.get("input[name='heizung_image']").should("have.attr", "type", "file").attachFile("images/heizungsanlage/1.jpeg", { subjectType: "input" });
|
||||
cy.get("input[name='heizung_image']").should("have.attr", "type", "file").attachFile("images/heizungsanlage/2.jpeg", { subjectType: "input" });
|
||||
|
||||
// Fenster Daten
|
||||
if (Math.random() > 0.5) cy.get("input[name='einfach_verglasung']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='doppel_verglasung']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='isolier_verglasung']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='dreifach_verglasung']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='fenster_dicht']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='fenster_teilweise_undicht']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='tueren_dicht']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='tueren_undicht']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='rolllaeden_kaesten_gedaemmt']").check();
|
||||
|
||||
// Fenster Bilder
|
||||
cy.get("input[name='fenster_image']").should("have.attr", "type", "file").attachFile("images/fenster/1.jpeg", { subjectType: "input" });
|
||||
cy.get("input[name='fenster_image']").should("have.attr", "type", "file").attachFile("images/fenster/2.jpeg", { subjectType: "input" });
|
||||
|
||||
// Wärmedämmung Daten
|
||||
if (Math.random() > 0.5) cy.get("input[name='aussenwand_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='keller_wand_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='keller_decke_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='dachgeschoss_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='oberste_geschossdecke_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("input[name='oberste_geschossdecke_min_12cm_gedaemmt']").check();
|
||||
|
||||
// Wärmedämmung Bilder
|
||||
cy.get("input[name='daemmung_image']").should("have.attr", "type", "file").attachFile("images/daemmung/1.jpeg", { subjectType: "input" });
|
||||
cy.get("input[name='daemmung_image']").should("have.attr", "type", "file").attachFile("images/daemmung/2.jpeg", { subjectType: "input" });
|
||||
|
||||
// Gebäude Bild
|
||||
cy.get("input[name='gebaeude_image']").should("have.attr", "type", "file").attachFile("images/gebaeude/1.jpeg", { subjectType: "input" });
|
||||
|
||||
// Jetzt können wir den Verbrauchsausweis erstellen.
|
||||
cy.get("form[name='ausweis'] button[type='submit']").click({ force: true });
|
||||
|
||||
// Wir sind nicht eingeloggt also sollte jetzt ein Login Screen erscheinen.
|
||||
// Wir klicken auf registrieren und erstellen einen neuen Benutzer, danach loggen wir uns mit diesem ein.
|
||||
cy.get("button[name='registrieren']").click();
|
||||
|
||||
const email = faker.internet.email();
|
||||
const passwort = faker.internet.password();
|
||||
const vorname = faker.person.firstName();
|
||||
const nachname = faker.person.lastName();
|
||||
|
||||
cy.get("form[name='signup'] input[name='email']").should("be.visible").should("have.attr", "type", "email").type(email);
|
||||
cy.get("form[name='signup'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
||||
cy.get("form[name='signup'] input[name='vorname']").should("be.visible").should("have.attr", "type", "text").type(vorname);
|
||||
cy.get("form[name='signup'] input[name='nachname']").should("be.visible").should("have.attr", "type", "text").type(nachname);
|
||||
|
||||
cy.get("form[name='signup'] button[type='submit']").click();
|
||||
|
||||
// Wir sind jetzt registriert und können uns nun einloggen.
|
||||
// Die Email sollte automatisch eingetragen sein, da wir uns gerade registriert haben.
|
||||
cy.get("form[name='login'] input[name='email']").should("be.visible").should("have.attr", "type", "email").should("contain.value", email);
|
||||
cy.get("form[name='login'] input[name='passwort']").should("be.visible").should("have.attr", "type", "password").type(passwort);
|
||||
|
||||
cy.get("form[name='login'] button[type='submit']").click();
|
||||
|
||||
// Der Ausweis sollte jetzt schon erstellt worden sein.
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user