Automatische Tests und Passwort Vergessen
This commit is contained in:
@@ -2,14 +2,14 @@ import fuelList from "#components/Ausweis/brennstoffListe.js";
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { Enums } from "@ibcornelsen/database/client";
|
||||
|
||||
console.log(Enums);
|
||||
|
||||
|
||||
import "cypress-file-upload"
|
||||
|
||||
describe("Verbrauchsausweis erstellen Schritt 1", () => {
|
||||
it("erstellt einen neuen Verbrauchsausweis Wohngebäude.", () => {
|
||||
cy.visit("/energieausweis-erstellen/verbrauchsausweis-wohngebaeude");
|
||||
|
||||
console.log(Enums);
|
||||
|
||||
|
||||
// cy.wait(1000);
|
||||
|
||||
|
||||
25
src/cypress/e2e/auth/login.cy.ts
Normal file
25
src/cypress/e2e/auth/login.cy.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME, API_REFRESH_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import {faker} from "@faker-js/faker";
|
||||
|
||||
describe('Benutzer Login', () => {
|
||||
// Wir generieren uns einen zufälligen Nutzer
|
||||
const email = "user@ib-cornelsen.de"
|
||||
const password = "passwort"
|
||||
|
||||
it("meldet einen Nutzer an und leitet auf die Startseite weiter", () => {
|
||||
cy.visit("/auth/login")
|
||||
|
||||
cy.wait(1000)
|
||||
|
||||
cy.get('input[name="email"]').type(email)
|
||||
cy.get('input[name="passwort"]').type(password)
|
||||
|
||||
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")
|
||||
})
|
||||
})
|
||||
31
src/cypress/e2e/auth/logout.cy.ts
Normal file
31
src/cypress/e2e/auth/logout.cy.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME, API_REFRESH_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import {faker} from "@faker-js/faker";
|
||||
|
||||
describe('Benutzer Logout', () => {
|
||||
// Wir generieren uns einen zufälligen Nutzer
|
||||
const email = "user@ib-cornelsen.de"
|
||||
const password = "passwort"
|
||||
|
||||
it("meldet einen Nutzer an und leitet auf die Startseite weiter", () => {
|
||||
cy.visit("/auth/login")
|
||||
|
||||
cy.wait(1000)
|
||||
|
||||
cy.get('input[name="email"]').type(email)
|
||||
cy.get('input[name="passwort"]').type(password)
|
||||
|
||||
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")
|
||||
})
|
||||
|
||||
it("meldet einen Nutzer ab und leitet auf die Login Seite weiter", () => {
|
||||
cy.visit("/auth/logout")
|
||||
|
||||
cy.url().should("include", "/auth/login")
|
||||
})
|
||||
})
|
||||
24
src/cypress/e2e/auth/passwort-vergessen.cy.ts
Normal file
24
src/cypress/e2e/auth/passwort-vergessen.cy.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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")
|
||||
|
||||
cy.wait(1000)
|
||||
|
||||
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,7 +1,7 @@
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME, API_REFRESH_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import {faker} from "@faker-js/faker";
|
||||
|
||||
describe('Benutzer Authentifizierung', () => {
|
||||
describe('Benutzer Registrierung', () => {
|
||||
// Wir generieren uns einen zufälligen Nutzer
|
||||
const email = faker.internet.email()
|
||||
const password = faker.internet.password()
|
||||
Reference in New Issue
Block a user