Tests Verbessert
12
bun.lock
@@ -11,7 +11,7 @@
|
||||
"@ibcornelsen/api": "link:@ibcornelsen/api",
|
||||
"@ibcornelsen/database": "link:@ibcornelsen/database",
|
||||
"@ibcornelsen/ui": "^0.0.2",
|
||||
"@mollie/api-client": "^3.7.0",
|
||||
"@mollie/api-client": "^4.1.0",
|
||||
"@pdfme/common": "^5.2.16",
|
||||
"@pdfme/generator": "^5.2.16",
|
||||
"@pdfme/ui": "^5.2.16",
|
||||
@@ -315,7 +315,7 @@
|
||||
|
||||
"@mdx-js/mdx": ["@mdx-js/mdx@3.1.0", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdx": "^2.0.0", "collapse-white-space": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "estree-util-scope": "^1.0.0", "estree-walker": "^3.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "markdown-extensions": "^2.0.0", "recma-build-jsx": "^1.0.0", "recma-jsx": "^1.0.0", "recma-stringify": "^1.0.0", "rehype-recma": "^1.0.0", "remark-mdx": "^3.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", "source-map": "^0.7.0", "unified": "^11.0.0", "unist-util-position-from-estree": "^2.0.0", "unist-util-stringify-position": "^4.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-/QxEhPAvGwbQmy1Px8F899L5Uc2KZ6JtXwlCgJmjSTBedwOZkByYcBG4GceIGPXRDsmfxhHazuS+hlOShRLeDw=="],
|
||||
|
||||
"@mollie/api-client": ["@mollie/api-client@3.7.0", "", { "dependencies": { "axios": "^0.27.2" } }, "sha512-8pYq08xwv7VJIQvOJU+3nThZbXuNLhtD8iJQQ4UYW67kxHw4eC6cVE9SNVtUuHRfxTwcKLv5wrZd9jFb3BFqiA=="],
|
||||
"@mollie/api-client": ["@mollie/api-client@4.1.0", "", { "dependencies": { "@types/node-fetch": "^2.6.11", "node-fetch": "^2.7.0", "ruply": "^1.0.1" } }, "sha512-cSPigdR7cK9k6YgW2QuX0Jk++TLNxZwi5QR1Nmuq2wrSBcQOswZHaGmCP1nSZgdIJtzfXpZxg4qptzGe1VkYZw=="],
|
||||
|
||||
"@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],
|
||||
|
||||
@@ -549,6 +549,8 @@
|
||||
|
||||
"@types/node": ["@types/node@22.13.0", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-ClIbNe36lawluuvq3+YYhnIN2CELi+6q8NpnM7PYp4hBn/TatfboPgVSm2rwKRfnV2M+Ty9GWDFI64KEe+kysA=="],
|
||||
|
||||
"@types/node-fetch": ["@types/node-fetch@2.6.12", "", { "dependencies": { "@types/node": "*", "form-data": "^4.0.0" } }, "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA=="],
|
||||
|
||||
"@types/nodemailer": ["@types/nodemailer@6.4.17", "", { "dependencies": { "@types/node": "*" } }, "sha512-I9CCaIp6DTldEg7vyUTZi8+9Vo0hi1/T8gv3C89yk1rSAAzoKQ8H8ki/jBYJSFoH/BisgLP8tkZMlQ91CIquww=="],
|
||||
|
||||
"@types/pug": ["@types/pug@2.0.10", "", {}, "sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA=="],
|
||||
@@ -675,8 +677,6 @@
|
||||
|
||||
"aws4": ["aws4@1.13.2", "", {}, "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw=="],
|
||||
|
||||
"axios": ["axios@0.27.2", "", { "dependencies": { "follow-redirects": "^1.14.9", "form-data": "^4.0.0" } }, "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ=="],
|
||||
|
||||
"axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="],
|
||||
|
||||
"babel-runtime": ["babel-runtime@6.26.0", "", { "dependencies": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" } }, "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g=="],
|
||||
@@ -1073,8 +1073,6 @@
|
||||
|
||||
"flattie": ["flattie@1.1.1", "", {}, "sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ=="],
|
||||
|
||||
"follow-redirects": ["follow-redirects@1.15.9", "", {}, "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="],
|
||||
|
||||
"fontkit": ["fontkit@2.0.4", "", { "dependencies": { "@swc/helpers": "^0.5.12", "brotli": "^1.3.2", "clone": "^2.1.2", "dfa": "^1.2.0", "fast-deep-equal": "^3.1.3", "restructure": "^3.0.0", "tiny-inflate": "^1.0.3", "unicode-properties": "^1.4.0", "unicode-trie": "^2.0.0" } }, "sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g=="],
|
||||
|
||||
"foreground-child": ["foreground-child@3.3.0", "", { "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" } }, "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg=="],
|
||||
@@ -1915,6 +1913,8 @@
|
||||
|
||||
"run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],
|
||||
|
||||
"ruply": ["ruply@1.0.1", "", {}, "sha512-p39LnaaJyuucPGlgaB0KiyifpcuOkn24+Hq5y0ejAD/LlH+mRAbkHn2tckCLgHir+S+nis1WYG+TYEC4zHX0WQ=="],
|
||||
|
||||
"rw": ["rw@1.3.3", "", {}, "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="],
|
||||
|
||||
"rxjs": ["rxjs@7.8.1", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg=="],
|
||||
|
||||
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 141 KiB |
@@ -25,7 +25,7 @@
|
||||
"@ibcornelsen/api": "link:@ibcornelsen/api",
|
||||
"@ibcornelsen/database": "link:@ibcornelsen/database",
|
||||
"@ibcornelsen/ui": "^0.0.2",
|
||||
"@mollie/api-client": "^3.7.0",
|
||||
"@mollie/api-client": "^4.1.0",
|
||||
"@pdfme/common": "^5.2.16",
|
||||
"@pdfme/generator": "^5.2.16",
|
||||
"@pdfme/ui": "^5.2.16",
|
||||
|
||||
BIN
persistent/images/img-1017697d-6806-431f-8cb0-083be6851402.webp
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
persistent/images/img-1fc02565-7612-431a-aa6c-59911f5c7a73.webp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
persistent/images/img-425b7b43-c12f-43eb-b20b-5ea23bae2712.webp
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
persistent/images/img-8be88072-7bdd-43e2-a5b4-1a716f934762.webp
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
persistent/images/img-ea69cea0-813a-469e-b603-2ae68086001a.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
@@ -11,6 +11,7 @@ export const createCaller = createCallerFactory({
|
||||
"auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
|
||||
"bilder/[uid]": await import("../src/pages/api/bilder/[uid].ts"),
|
||||
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
||||
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
|
||||
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
||||
"user": await import("../src/pages/api/user/index.ts"),
|
||||
"user/self": await import("../src/pages/api/user/self.ts"),
|
||||
|
||||
@@ -5,7 +5,6 @@ import { exclude } from "#lib/exclude.js";
|
||||
import Cookies from "js-cookie";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import { AufnahmeClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js";
|
||||
// import { addNotification } from "@ibcornelsen/ui";
|
||||
|
||||
export async function verbrauchsausweisWohnenSpeichern(
|
||||
ausweis: VerbrauchsausweisWohnenClient,
|
||||
@@ -74,7 +73,7 @@ export async function verbrauchsausweisWohnenSpeichern(
|
||||
}
|
||||
})
|
||||
} else {
|
||||
await api["verbrauchsausweis-wohnen"].PUT.fetch({
|
||||
const { uid } = await api["verbrauchsausweis-wohnen"].PUT.fetch({
|
||||
ausweis,
|
||||
uid_aufnahme: aufnahme.uid
|
||||
}, {
|
||||
@@ -82,6 +81,8 @@ export async function verbrauchsausweisWohnenSpeichern(
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
ausweis.uid = uid;
|
||||
}
|
||||
|
||||
for (const bild of bilder) {
|
||||
|
||||
@@ -44,6 +44,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
placeholder="Anlass"
|
||||
bind:value={ausweis.ausstellgrund}
|
||||
required
|
||||
data-cy="ausstellgrund"
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
{#each Object.entries(Enums.Ausstellgrund) as [name, ausstellgrund]}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<script lang="ts">
|
||||
import AusweisWeiter from "#modules/VerbrauchsausweisWohnen/AusweisWeiter.svelte";
|
||||
import Hilfe from "#components/Ausweis/Hilfe.svelte";
|
||||
import { AufnahmeClient, BenutzerClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "./types.js";
|
||||
import {
|
||||
AufnahmeClient,
|
||||
BenutzerClient,
|
||||
ObjektClient,
|
||||
UploadedGebaeudeBild,
|
||||
VerbrauchsausweisWohnenClient,
|
||||
} from "./types.js";
|
||||
|
||||
export let ausweis: VerbrauchsausweisWohnenClient;
|
||||
export let bilder: UploadedGebaeudeBild[];
|
||||
@@ -10,12 +16,11 @@
|
||||
export let aufnahme: AufnahmeClient;
|
||||
|
||||
export let spaeterWeitermachen;
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="grid grid-cols-[1fr_min-content_min-content_min-content] grid-rows-[min_content_1fr] gap-x-2 self-start justify-self-end mt-8">
|
||||
|
||||
<div
|
||||
class="grid grid-cols-[1fr_min-content_min-content_min-content] grid-rows-[min_content_1fr] gap-x-2 self-start justify-self-end mt-8"
|
||||
>
|
||||
<div></div>
|
||||
|
||||
<Hilfe />
|
||||
@@ -33,6 +38,4 @@
|
||||
bind:aufnahme
|
||||
></AusweisWeiter>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,28 +1,14 @@
|
||||
<script lang="ts">
|
||||
import AusweisWeiter from "#modules/VerbrauchsausweisWohnen/AusweisWeiter.svelte";
|
||||
import Hilfe from "#components/Ausweis/Hilfe.svelte";
|
||||
import { AufnahmeClient, BenutzerClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "./types.js";
|
||||
|
||||
export let ausweis: VerbrauchsausweisWohnenClient;
|
||||
export let bilder: UploadedGebaeudeBild[];
|
||||
export let user: BenutzerClient;
|
||||
export let objekt: ObjektClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
export let spaeterWeitermachen;
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="w-full grid grid-cols-[min-content_1fr_min-content_min-content] grid-rows-[min_content_1fr] gap-x-2 self-start justify-self-end mt-8">
|
||||
|
||||
<div
|
||||
class="w-full grid grid-cols-[min-content_1fr_min-content_min-content] grid-rows-[min_content_1fr] gap-x-2 self-start justify-self-end mt-8"
|
||||
>
|
||||
<button class="button justify-self-start">Zurück</button>
|
||||
|
||||
<div></div>
|
||||
|
||||
<button class="button">Speichern</button>
|
||||
|
||||
<button class="button">kostenpflichtig bestellen</button
|
||||
>
|
||||
|
||||
|
||||
</div>
|
||||
<button class="button">kostenpflichtig bestellen</button>
|
||||
</div>
|
||||
|
||||
@@ -80,12 +80,12 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.lueftung}
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option value="Fensterlüftung">Fensterlüftung</option>
|
||||
<option value="Schachtlüftung">Schachtlüftung</option>
|
||||
<option value="Lüftungsanlage ohne Wärmerückgewinnung"
|
||||
<option value="Fensterlueftung">Fensterlüftung</option>
|
||||
<option value="Schachtlueftung">Schachtlüftung</option>
|
||||
<option value="LueftungsanlageOhneWaermerueckgewinnung"
|
||||
>Lüftungsanlage ohne Wärmerückgewinnung</option
|
||||
>
|
||||
<option value="Lüftungsanlage mit Wärmerückgewinnung"
|
||||
<option value="LueftungsanlageMitWaermerueckgewinnung"
|
||||
>Lüftungsanlage mit Wärmerückgewinnung</option
|
||||
>
|
||||
</select>
|
||||
|
||||
@@ -4,31 +4,24 @@
|
||||
export let checked: boolean | null | undefined;
|
||||
export let name: string;
|
||||
export let label: string;
|
||||
|
||||
export let help: string;
|
||||
export let value: string;
|
||||
|
||||
function clickCheckbox(e){
|
||||
e.target.firstChild.click();
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="input-standard"
|
||||
>
|
||||
<div class="input-standard">
|
||||
<div
|
||||
class="grid grid-cols-[40px_1fr] items-center justify-items-start h-[38px] ring-1 ring-black/15 bg-white active:bg-green-100 cursor-pointer"
|
||||
on:click={() => clickCheckbox(event)} on:keydown={() => clickCheckbox(event)}
|
||||
>
|
||||
|
||||
<input
|
||||
id={name}
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
{name}
|
||||
bind:checked={checked}
|
||||
value={value}
|
||||
bind:checked
|
||||
{value}
|
||||
data-cy={name}
|
||||
/>
|
||||
|
||||
<label class="w-full cursor-pointer" for={name}>{label}</label>
|
||||
|
||||
@@ -138,6 +138,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
class="checkbox"
|
||||
name="zusaetzliche_heizquelle_1"
|
||||
bind:checked={ausweis.zusaetzliche_heizquelle}
|
||||
data-cy="zusaetzliche_heizquelle"
|
||||
/>
|
||||
<label
|
||||
for="zusaetzliche_heizquelle_1"
|
||||
@@ -414,6 +415,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
name="brennstoff_2"
|
||||
bind:value={aufnahme.brennstoff_2}
|
||||
required
|
||||
data-cy="brennstoff_2"
|
||||
>
|
||||
<option disabled selected value={false}
|
||||
>Bitte auswählen</option
|
||||
@@ -445,6 +447,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
<select
|
||||
class="rounded-s-none"
|
||||
name="einheit_2"
|
||||
data-cy="einheit_2"
|
||||
bind:value={ausweis.einheit_2}
|
||||
disabled={!aufnahme.brennstoff_2}
|
||||
required
|
||||
|
||||
@@ -1,286 +1,296 @@
|
||||
import fuelList from "#components/Ausweis/brennstoffListe.js";
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { Enums } from "@ibcornelsen/database/client";
|
||||
|
||||
console.log(Enums);
|
||||
import { type Enums } from "@ibcornelsen/database/client";
|
||||
|
||||
|
||||
import "cypress-file-upload"
|
||||
import moment from "moment";
|
||||
|
||||
describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
||||
it("erstellt einen neuen Verbrauchsausweis Wohngebäude.", () => {
|
||||
cy.visit("/energieausweis-erstellen/verbrauchsausweis-wohngebaeude");
|
||||
|
||||
// cy.wait(1000);
|
||||
cy.wait(1000);
|
||||
|
||||
// // Wir überprüfen, ob alle Ausstelgründe vorhanden sind, diese sollten genau so viele sein wie in der Datenbank vorhanden sind.
|
||||
// cy.get("input[name='ausstellgrund']")
|
||||
// .should("have.length", Object.values(Enums.Ausstellgrund).length)
|
||||
// .eq(
|
||||
// faker.number.int({
|
||||
// min: 0,
|
||||
// max: Object.values(Enums.Ausstellgrund).length - 1,
|
||||
// })
|
||||
// )
|
||||
// .check();
|
||||
// Wir überprüfen, ob alle Ausstelgründe vorhanden sind, diese sollten genau so viele sein wie in der Datenbank vorhanden sind.
|
||||
cy.get("select[data-cy='ausstellgrund']")
|
||||
.select(
|
||||
faker.number.int({
|
||||
min: 0,
|
||||
max: (["Modernisierung", "Neubau", "Sonstiges", "Verkauf", "Vermietung"] as Enums.Ausstellgrund[]).length - 1,
|
||||
})
|
||||
)
|
||||
|
||||
// // Jetzt Füllen wir das Baujahr vom Gebäude aus.
|
||||
// cy.get("input[name='baujahr_gebaeude']")
|
||||
// .should("have.attr", "type", "number")
|
||||
// .type(
|
||||
// faker.number.int({ min: 1900, max: 2021 }).toString() +
|
||||
// "{enter}",
|
||||
// { delay: 50 }
|
||||
// );
|
||||
// Jetzt Füllen wir das Baujahr vom Gebäude aus.
|
||||
cy.get("input[name='baujahr_gebaeude']")
|
||||
.should("have.attr", "type", "number")
|
||||
.type(
|
||||
faker.number.int({ min: 1900, max: 2021 }).toString() +
|
||||
"{enter}",
|
||||
{ delay: 50 }
|
||||
);
|
||||
|
||||
// // Jetzt Füllen wir das Baujahr der Heizung aus.
|
||||
// cy.get("input[name='baujahr_heizung']")
|
||||
// .should("have.attr", "type", "number")
|
||||
// .type(
|
||||
// faker.number.int({ min: 1900, max: 2021 }).toString() +
|
||||
// "{enter}",
|
||||
// { delay: 50 }
|
||||
// );
|
||||
// Jetzt Füllen wir das Baujahr der Heizung aus.
|
||||
cy.get("input[name='baujahr_heizung']")
|
||||
.should("have.attr", "type", "number")
|
||||
.type(
|
||||
faker.number.int({ min: 1900, max: 2021 }).toString() +
|
||||
"{enter}",
|
||||
{ delay: 50 }
|
||||
);
|
||||
|
||||
// // Anzahl Einheiten
|
||||
// cy.get("input[name='einheiten']")
|
||||
// .should("have.attr", "type", "number")
|
||||
// .type(faker.number.int({ min: 1, max: 5 }).toString());
|
||||
// Anzahl Einheiten
|
||||
cy.get("input[name='einheiten']")
|
||||
.should("have.attr", "type", "number")
|
||||
.type(faker.number.int({ min: 1, max: 5 }).toString());
|
||||
|
||||
// // Sanierungsstatus
|
||||
// cy.get("select[name='saniert']").select(
|
||||
// Math.random() > 0.5 ? "true" : "false"
|
||||
// );
|
||||
// Sanierungsstatus
|
||||
cy.get("select[name='saniert']").select(
|
||||
Math.random() > 0.5 ? "true" : "false"
|
||||
);
|
||||
|
||||
// // Adresse
|
||||
// cy.get("input[name='adresse']").type(faker.location.streetAddress());
|
||||
// Adresse
|
||||
cy.get("input[name='adresse']").type(faker.location.streetAddress());
|
||||
|
||||
// // Postleitzahl
|
||||
// cy.get("input[name='plz']").type(
|
||||
// faker.location.zipCode({
|
||||
// format: "#####",
|
||||
// })
|
||||
// );
|
||||
// Postleitzahl
|
||||
cy.get("input[name='plz']").type(
|
||||
faker.location.zipCode({
|
||||
format: "#####",
|
||||
})
|
||||
);
|
||||
|
||||
// // TODO: Ort - Dieser wird aus der Datenbank abgefragt, wir müssen also warten, bis der Dropdown da ist.
|
||||
// TODO: Ort - Dieser wird aus der Datenbank abgefragt, wir müssen also warten, bis der Dropdown da ist.
|
||||
|
||||
// // Flaeche
|
||||
// cy.get("input[name='flaeche']")
|
||||
// .should("have.attr", "type", "number")
|
||||
// .type(faker.number.int({ min: 50, max: 1000 }).toString());
|
||||
// Flaeche
|
||||
cy.get("input[name='flaeche']")
|
||||
.should("have.attr", "type", "number")
|
||||
.type(faker.number.int({ min: 50, max: 1000 }).toString());
|
||||
|
||||
// // Nutzflaeche
|
||||
// cy.get("input[name='nutzflaeche']")
|
||||
// .should("have.attr", "type", "number")
|
||||
// .type(faker.number.int({ min: 50, max: 1000 }).toString());
|
||||
// Nutzflaeche
|
||||
cy.get("input[name='nutzflaeche']")
|
||||
.should("have.attr", "type", "number")
|
||||
.type(faker.number.int({ min: 50, max: 1000 }).toString());
|
||||
|
||||
// // Keller
|
||||
// cy.get("select[name='keller']").find("option:not([disabled])").should("have.length", Object.values(Enums.Heizungsstatus).length).parent().select(faker.number.int({
|
||||
// max: Object.values(Enums.Heizungsstatus).length,
|
||||
// min: 1
|
||||
// }));
|
||||
// Keller
|
||||
cy.get("select[name='keller']").find("option:not([disabled])").should("have.length", (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length).parent().select(faker.number.int({
|
||||
max: (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length,
|
||||
min: 1
|
||||
}));
|
||||
|
||||
// // Dachgeschoss
|
||||
// cy.get("select[name='dachgeschoss']").find("option:not([disabled])").should("have.length", Object.values(Enums.Heizungsstatus).length).parent().select(faker.number.int({
|
||||
// max: Object.values(Enums.Heizungsstatus).length,
|
||||
// min: 1
|
||||
// }));
|
||||
// Dachgeschoss
|
||||
cy.get("select[name='dachgeschoss']").find("option:not([disabled])").should("have.length", (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length).parent().select(faker.number.int({
|
||||
max: (["BEHEIZT", "NICHT_VORHANDEN", "UNBEHEIZT"] as Enums.Heizungsstatus[]).length,
|
||||
min: 1
|
||||
}));
|
||||
|
||||
// // Brennstoff und Einheit 1
|
||||
// const brennstoffKombo = fuelList[faker.number.int({ min: 0, max: fuelList.length - 1 })];
|
||||
// Brennstoff und Einheit 1
|
||||
const brennstoffKombo = fuelList[faker.number.int({ min: 0, max: fuelList.length - 1 })];
|
||||
|
||||
// cy.get("select[name='brennstoff_1']").select(brennstoffKombo[0]);
|
||||
// cy.get("select[name='einheit_1']").select(brennstoffKombo[1]);
|
||||
cy.get("select[name='brennstoff_1']").select(brennstoffKombo[0]);
|
||||
cy.get("select[name='einheit_1']").select(brennstoffKombo[1]);
|
||||
|
||||
// // Verbrauchszeitraum
|
||||
// cy.get("select[name='energieverbrauch_zeitraum_monat']").select(faker.number.int({ min: 1, max: 12 }).toString());
|
||||
// cy.get("select[name='energieverbrauch_zeitraum_jahr']").select(faker.number.int({ min: 2018, max: 2019 }).toString());
|
||||
let availableDates = [];
|
||||
const startDate = moment()
|
||||
.subtract(4, "years")
|
||||
.subtract(6, "months");
|
||||
const endDate = moment().subtract(3, "years");
|
||||
|
||||
// // Verbrauch
|
||||
// cy.get("input[name='verbrauch_1']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
||||
// cy.get("input[name='verbrauch_2']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
||||
// cy.get("input[name='verbrauch_3']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
||||
for (let m = moment(startDate); m.isBefore(endDate); m.add(1, "month")) {
|
||||
availableDates.push({
|
||||
year: m.year(),
|
||||
month: m.month(),
|
||||
});
|
||||
}
|
||||
|
||||
// Verbrauchszeitraum
|
||||
cy.get("select[name='energieverbrauch_zeitraum_monat']").select(availableDates[0].month.toString());
|
||||
cy.get("select[name='energieverbrauch_zeitraum_jahr']").select(availableDates[0].year.toString());
|
||||
|
||||
// Verbrauch
|
||||
cy.get("input[name='verbrauch_1']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||
cy.get("input[name='verbrauch_2']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||
cy.get("input[name='verbrauch_3']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||
|
||||
|
||||
// const zusaetzlicheHeizquelle = Math.random() > 0.5;
|
||||
const zusaetzlicheHeizquelle = Math.random() > 0.5;
|
||||
|
||||
// if (zusaetzlicheHeizquelle) {
|
||||
// cy.get("input[name='zusaetzliche_heizquelle']").check();
|
||||
if (zusaetzlicheHeizquelle) {
|
||||
cy.get("[data-cy='zusaetzliche_heizquelle']").check();
|
||||
|
||||
// // Brennstoff und Einheit 2
|
||||
// const brennstoffKombo2 = fuelList[faker.number.int({ min: 0, max: fuelList.length - 1 })];
|
||||
// Brennstoff und Einheit 2
|
||||
const brennstoffKombo2 = fuelList[faker.number.int({ min: 0, max: fuelList.length - 1 })];
|
||||
|
||||
// cy.get("select[name='brennstoff_2']").select(brennstoffKombo2[0]);
|
||||
// cy.get("select[name='einheit_2']").select(brennstoffKombo2[1]);
|
||||
cy.get("[data-cy='brennstoff_2']").select(brennstoffKombo2[0], { force: true });
|
||||
cy.get("[data-cy='einheit_2']").select(brennstoffKombo2[1], { force: true });
|
||||
|
||||
// // Verbrauch
|
||||
// cy.get("input[name='verbrauch_4']").type(faker.number.int({ min: 4000, max: 15000 }).toString());
|
||||
// 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());
|
||||
// }
|
||||
// Verbrauch
|
||||
cy.get("input[name='verbrauch_4']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||
cy.get("input[name='verbrauch_5']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||
cy.get("input[name='verbrauch_6']").type(faker.number.int({ min: 4000, max: 15000 }).toString(), { force: true });
|
||||
}
|
||||
|
||||
// // Warmwasser enthalten und bekannt
|
||||
// const warmwasserEnthalten = Math.random() > 0.5;
|
||||
// const anteilBekannt = Math.random() > 0.5;
|
||||
// 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 (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();
|
||||
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());
|
||||
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());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
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(), {force: true});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // 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();
|
||||
// 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ä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);
|
||||
// });
|
||||
// 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);
|
||||
// });
|
||||
// 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);
|
||||
// });
|
||||
// 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, { force: true });
|
||||
});
|
||||
|
||||
// // Leerstand
|
||||
// cy.get("input[name='leerstand']").should("have.attr", "type", "number").type(faker.number.int({ min: 0, max: 30 }).toString());
|
||||
// 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 Daten
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='zentralheizung']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='einzelofen']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='durchlauf_erhitzer']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='standard_kessel']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='solarsystem_warmwasser']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='waermepumpe']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='niedertemperatur_kessel']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='brennwert_kessel']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='warmwasser_rohre_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='heizungsrohre_gedaemmt']").check();
|
||||
if (Math.random() > 0.5) cy.get("[data-cy='zirkulation']").check();
|
||||
// if (Math.random() > 0.5) cy.get("[data-cy='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" });
|
||||
// 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 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" });
|
||||
// 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 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" });
|
||||
// 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" });
|
||||
// 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 });
|
||||
// Jetzt können wir den Verbrauchsausweis erstellen.
|
||||
cy.get("form[name='ausweis'] button[data-cy='weiter']").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();
|
||||
// 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("[data-cy='registrieren']").click();
|
||||
|
||||
// const email = faker.internet.email();
|
||||
// const passwort = "test1234";
|
||||
// const vorname = faker.person.firstName();
|
||||
// const nachname = faker.person.lastName();
|
||||
const email = faker.internet.email();
|
||||
const passwort = "test1234";
|
||||
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'] 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();
|
||||
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);
|
||||
// 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();
|
||||
cy.get("form[name='login'] button[type='submit']").click();
|
||||
|
||||
// // Der Ausweis sollte jetzt schon erstellt worden sein und wir sollten auf die kundendaten seite weitergeleitet worden sein.
|
||||
// cy.url().should("contain", "/kundendaten");
|
||||
// Der Ausweis sollte jetzt schon erstellt worden sein und wir sollten auf die kundendaten seite weitergeleitet worden sein.
|
||||
cy.url().should("contain", "/kundendaten");
|
||||
|
||||
// cy.wait(1000)
|
||||
cy.wait(1000)
|
||||
|
||||
// // Wir füllen jetzt die Kundendaten aus.
|
||||
// cy.get("select[name='anrede']").select(Math.random() > 0.5 ? "Herr" : "Frau");
|
||||
// cy.get("input[name='vorname']").should("contain.value", vorname);
|
||||
// cy.get("input[name='name']").should("contain.value", nachname);
|
||||
// cy.get("input[name='email']").should("contain.value", email);
|
||||
// cy.get("input[name='telefon']").type(faker.phone.number());
|
||||
// Wir füllen jetzt die Kundendaten aus.
|
||||
cy.get("select[name='anrede']").select(Math.random() > 0.5 ? "Herr" : "Frau");
|
||||
cy.get("input[name='vorname']").should("contain.value", vorname);
|
||||
cy.get("input[name='name']").should("contain.value", nachname);
|
||||
cy.get("input[name='email']").should("contain.value", email);
|
||||
cy.get("input[name='telefon']").type(faker.phone.number());
|
||||
|
||||
// cy.get("input[name='rechnung_empfaenger']").type(`${vorname} ${nachname}`);
|
||||
// cy.get("input[name='rechnung_strasse']").type(faker.location.streetAddress());
|
||||
// // TODO: Random Plz generieren, allerdings muss die auch in der Datenbank vorhanden sein...
|
||||
// cy.get("input[name='rechnung_plz']").type("2103");
|
||||
// // Jetzt sollte der PLZ Container erscheinen, dort klicken wir einfach das erste Element an.
|
||||
// cy.get("div[data-test='plz-container']").children().first().click();
|
||||
// cy.get("input[name='rechnung_telefon']").type(faker.phone.number());
|
||||
// cy.get("input[name='rechnung_email']").type(faker.internet.email());
|
||||
// cy.get("button[data-test='paypal']").click();
|
||||
cy.get("input[name='rechnung_empfaenger']").type(`${vorname} ${nachname}`);
|
||||
cy.get("input[name='rechnung_strasse']").type(faker.location.streetAddress());
|
||||
// TODO: Random Plz generieren, allerdings muss die auch in der Datenbank vorhanden sein...
|
||||
cy.get("input[name='rechnung_plz']").type("2103");
|
||||
// Jetzt sollte der PLZ Container erscheinen, dort klicken wir einfach das erste Element an.
|
||||
cy.get("div[data-test='plz-container']").children().first().click();
|
||||
cy.get("input[name='rechnung_telefon']").type(faker.phone.number());
|
||||
cy.get("input[name='rechnung_email']").type(faker.internet.email());
|
||||
cy.get("button[data-test='paypal']").click();
|
||||
|
||||
// // Datenschutz und AGB akzeptieren, dann schicken wir das Formular ab.
|
||||
// cy.get("input[name='agb-akzeptieren']").check()
|
||||
// cy.get("input[name='datenschutz-akzeptieren']").check()
|
||||
// cy.get("button[type='submit']").click();
|
||||
// Datenschutz und AGB akzeptieren, dann schicken wir das Formular ab.
|
||||
cy.get("input[name='agb-akzeptieren']").check()
|
||||
cy.get("input[name='datenschutz-akzeptieren']").check()
|
||||
cy.get("button[type='submit']").click();
|
||||
|
||||
// cy.origin('https://www.mollie.com', () => {
|
||||
// // Jetzt sind wir auf der Mollie Seite, dort wählen wir den "paid" status aus
|
||||
// cy.get("input[type='radio'][name='final_state'][value='paid']").check();
|
||||
// // Da wird unser Test fehlschlagen, da die localhost domain von Mollie aus nicht erreichbar ist.
|
||||
// })
|
||||
cy.origin('https://www.mollie.com', () => {
|
||||
// Jetzt sind wir auf der Mollie Seite, dort wählen wir den "paid" status aus
|
||||
cy.get("input[type='radio'][name='final_state'][value='paid']").check();
|
||||
// Da wird unser Test fehlschlagen, da die localhost domain von Mollie aus nicht erreichbar ist.
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME, API_REFRESH_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import {faker} from "@faker-js/faker";
|
||||
|
||||
describe('Benutzer Passwort Vergessen', () => {
|
||||
// Wir generieren uns einen zufälligen Nutzer
|
||||
const email = "user@ib-cornelsen.de"
|
||||
const password = "passwort"
|
||||
|
||||
it("fordert ein neues Passwort an", () => {
|
||||
cy.visit("/auth/passwort-vergessen")
|
||||
@@ -14,11 +10,5 @@ describe('Benutzer Passwort Vergessen', () => {
|
||||
cy.get('input[name="email"]').type(email)
|
||||
|
||||
cy.get('button[type="submit"]').click()
|
||||
|
||||
cy.url().should("include", "/dashboard")
|
||||
|
||||
// Wir sollten nun einen Access Token und Refresh Token in unseren Cookies sehen.
|
||||
cy.getCookie(API_ACCESS_TOKEN_COOKIE_NAME).should("exist")
|
||||
cy.getCookie(API_REFRESH_TOKEN_COOKIE_NAME).should("exist")
|
||||
})
|
||||
})
|
||||
@@ -1,15 +0,0 @@
|
||||
import { appRouter, t } from "@ibcornelsen/api";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "./constants.js";
|
||||
|
||||
export const createCaller = function (opts: any) {
|
||||
// 1. create a caller-function for your router
|
||||
const createCaller = t.createCallerFactory(appRouter);
|
||||
|
||||
const token = Buffer.from(opts.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value ?? "", "utf-8").toString("base64");
|
||||
// 2. create a caller using your `Context`
|
||||
return createCaller({
|
||||
authorization: `Bearer ${token}`,
|
||||
ip: "",
|
||||
req: opts.request
|
||||
});
|
||||
}
|
||||
5
src/lib/mollie.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createMollieClient } from "@mollie/api-client";
|
||||
|
||||
export const TEST_MOLLIE_API_TOKEN = "test_jenmp2Pq3j3N6HeQxwx7qbHasWMdnx";
|
||||
|
||||
export const mollieClient = createMollieClient({ apiKey: TEST_MOLLIE_API_TOKEN })
|
||||
@@ -1,8 +0,0 @@
|
||||
import { VerbrauchsausweisWohnenValidator } from "@ibcornelsen/api/src/validators";
|
||||
import { z } from "zod";
|
||||
|
||||
export const verbrauchsausweisWohnenPDFValidator = VerbrauchsausweisWohnenValidator.merge(z.object({
|
||||
pdf: z.object({
|
||||
brennstoff: z.string()
|
||||
})
|
||||
}))
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
<button class="button" type="submit">Einloggen</button>
|
||||
<div class="flex flex-row justify-between" style="margin-top: 10px">
|
||||
<a on:click={() => navigate("signup")} class="cursor-pointer" name="registrieren">Registrieren</a>
|
||||
<a on:click={() => navigate("signup")} class="cursor-pointer" data-cy="registrieren">Registrieren</a>
|
||||
<a href="/user/passwort_vergessen">Passwort Vergessen?</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -88,4 +88,4 @@
|
||||
</div>
|
||||
</Overlay>
|
||||
|
||||
<button on:click={ausweisAbschicken} type="button" class="button">Weiter</button>
|
||||
<button on:click={ausweisAbschicken} type="button" class="button" data-cy="weiter">Weiter</button>
|
||||
@@ -137,7 +137,7 @@
|
||||
"",
|
||||
`${location.pathname}?uid=${result.uid_ausweis}`
|
||||
);
|
||||
window.location.href = `/kundendaten?uid=${result.uid_ausweis}`;
|
||||
// window.location.href = `/kundendaten?uid=${result.uid_ausweis}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ Viele Grüße,
|
||||
IBCornelsen`
|
||||
})
|
||||
|
||||
if (info.rejected) {
|
||||
if (info.rejected.length > 0) {
|
||||
throw new APIError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
message: "Etwas ist schiefgelaufen, bitte versuchen sie es erneut."
|
||||
|
||||
142
src/pages/api/rechnung/index.ts
Normal file
@@ -0,0 +1,142 @@
|
||||
import { z } from "zod";
|
||||
import { Enums, RechnungSchema, prisma } from "@ibcornelsen/database/server";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import { mollieClient } from "#lib/mollie.js";
|
||||
import { PaymentMethod } from "@mollie/api-client";
|
||||
import { defineApiRoute } from "astro-typesafe-api/server";
|
||||
import {
|
||||
authorizationHeaders,
|
||||
authorizationMiddleware,
|
||||
} from "#lib/middleware/authorization.js";
|
||||
|
||||
export const PUT = defineApiRoute({
|
||||
meta: {
|
||||
contentTypes: ["application/json"],
|
||||
description:
|
||||
"Erstellt eine neue Rechnung mit der ein Energieausweis bezahlt werden kann. Gibt eine Checkout URL zurück, welche der Nutzer folgen muss, um zum Kaufabschluss zu gelangen.",
|
||||
summary: "Erstellt eine neue Rechnung zu einem Energieausweis Vorgang.",
|
||||
tags: ["Rechnungen"],
|
||||
},
|
||||
input: z
|
||||
.object({
|
||||
ausweisart: z.nativeEnum(Enums.Ausweisart),
|
||||
uid: z.string().uuid(),
|
||||
})
|
||||
.merge(
|
||||
RechnungSchema.omit({
|
||||
benutzer_id: true,
|
||||
bezahlt_am: true,
|
||||
erstellt_am: true,
|
||||
id: true,
|
||||
status: true,
|
||||
uid: true,
|
||||
betrag: true,
|
||||
storniert_am: true,
|
||||
transaktions_referenz: true,
|
||||
})
|
||||
),
|
||||
output: z.object({
|
||||
checkout_url: z.string(),
|
||||
uid: z.string().uuid(),
|
||||
}),
|
||||
headers: authorizationHeaders,
|
||||
middleware: authorizationMiddleware,
|
||||
async fetch(input, ctx, user) {
|
||||
// Wir erstellen eine Mollie Payment Referenz und eine neue Rechnung in unserer Datenbank, daraufhin geben
|
||||
// wir eine Checkout URL zurück auf die der Nutzer weitergeleitet werden kann.
|
||||
|
||||
const { uid, ausweisart, bezahlmethode, services } = input;
|
||||
|
||||
// TODO: Services Implementieren
|
||||
|
||||
if (ausweisart === Enums.Ausweisart.BedarfsausweisWohnen) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Bedarfsausweis Wohnen wird noch nicht unterstützt.",
|
||||
});
|
||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message:
|
||||
"Verbrauchsausweis Gewerbe wird noch nicht unterstützt.",
|
||||
});
|
||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||
// Wir müssen überprüfen, ob dem Nutzer der Ausweis tatsächlich gehört.
|
||||
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
|
||||
where: {
|
||||
uid,
|
||||
},
|
||||
});
|
||||
|
||||
if (!ausweis) {
|
||||
throw new TRPCError({
|
||||
code: "NOT_FOUND",
|
||||
message: "Ausweis nicht gefunden.",
|
||||
});
|
||||
}
|
||||
|
||||
if (ausweis.benutzer_id !== user.id) {
|
||||
throw new TRPCError({
|
||||
code: "UNAUTHORIZED",
|
||||
message: "Ausweis gehört nicht dem Nutzer.",
|
||||
});
|
||||
}
|
||||
|
||||
// Wir erstellen eine neue Rechnung in unserer Datenbank.
|
||||
const rechnung = await prisma.rechnung.create({
|
||||
data: {
|
||||
benutzer_id: user.id,
|
||||
betrag: 0,
|
||||
bezahlmethode: bezahlmethode,
|
||||
status: Enums.Rechnungsstatus.open,
|
||||
aufnahme_id: ausweis.aufnahme_id,
|
||||
},
|
||||
select: {
|
||||
uid: true,
|
||||
betrag: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!rechnung) {
|
||||
throw new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
message: "Rechnung konnte nicht erstellt werden.",
|
||||
});
|
||||
}
|
||||
|
||||
// Wir erstellen eine Mollie Payment Referenz.
|
||||
const payment = await mollieClient.payments.create({
|
||||
amount: {
|
||||
value: "45.00",
|
||||
currency: "EUR",
|
||||
},
|
||||
metadata: {
|
||||
rechnung_uid: rechnung.uid,
|
||||
},
|
||||
method: input.bezahlmethode as PaymentMethod,
|
||||
description: "Verbrauchsausweis Wohnen 2016",
|
||||
redirectUrl: "https://ibcornelsen.de/payment/success",
|
||||
webhookUrl: "http://api.ibcornelsen.de/v1/webhooks/mollie",
|
||||
});
|
||||
|
||||
const checkoutUrl = payment.getCheckoutUrl();
|
||||
|
||||
if (!checkoutUrl) {
|
||||
throw new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
message: "Checkout URL konnte nicht erstellt werden.",
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
uid: rechnung.uid,
|
||||
checkout_url: checkoutUrl,
|
||||
};
|
||||
} else {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Ausweisart nicht unterstützt.",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
30
src/trpc.ts
@@ -1,30 +0,0 @@
|
||||
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
|
||||
import cookies from 'js-cookie';
|
||||
import type { AppRouter } from '@ibcornelsen/api';
|
||||
import { Buffer } from 'buffer';
|
||||
|
||||
let url: string = 'http://localhost:3001/';
|
||||
|
||||
if (typeof window !== "undefined" && window.location.hostname !== "localhost") {
|
||||
url = "http://rpc.ibcornelsen.de/"
|
||||
}
|
||||
|
||||
|
||||
export const client = createTRPCProxyClient<AppRouter>({
|
||||
links: [
|
||||
httpBatchLink({
|
||||
url,
|
||||
headers() {
|
||||
const accessToken = cookies.get('accessToken');
|
||||
if (!accessToken) return {};
|
||||
|
||||
const buffer = Buffer.from(accessToken, 'utf-8');
|
||||
const base64 = buffer.toString('base64')
|
||||
|
||||
return {
|
||||
'Authorization': `Bearer ${base64}`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||