chore: fixes to tests

This commit is contained in:
Stefan Benz
2024-11-15 13:34:06 +01:00
parent 7e4285b0bd
commit 96f1db9a84
4 changed files with 8 additions and 17 deletions

View File

@@ -1,8 +1,6 @@
import fetch from "node-fetch";
import {Page} from "@playwright/test";
import {registerWithPasskey} from "./register";
import {loginWithPassword} from "./login";
import {changePassword} from "./password";
import {getUserByUsername, removeUser} from './zitadel';
export interface userProps {
@@ -59,7 +57,11 @@ class User {
}
async remove() {
await removeUser(this.getUserId())
const resp = await getUserByUsername(this.getUsername())
if (!resp || !resp.result || !resp.result[0]) {
return
}
await removeUser(resp.result[0].userId)
return
}
@@ -90,12 +92,6 @@ class User {
public getFullName() {
return this.props.firstName + " " + this.props.lastName
}
public async doPasswordChange(page: Page, password: string) {
await loginWithPassword(page, this.getUsername(), this.getPassword())
await changePassword(page, this.getUsername(), password)
this.props.password = password
}
}
export class PasswordUser extends User {
@@ -191,11 +187,6 @@ export class PasskeyUser extends User {
}
public async remove() {
const resp = await getUserByUsername(this.getUsername())
if (!resp || !resp.result || !resp.result[0]) {
return
}
this.setUserId(resp.result[0].userId)
await super.remove()
}