Fix flaky playwright tests (#28959)

* Fix playwright flaky tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Wipe mailhog between test runs

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Delint

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-01-13 09:32:00 +00:00
committed by GitHub
parent f99d7ce2bb
commit e14a3b64c3
11 changed files with 105 additions and 44 deletions

View File

@@ -0,0 +1,30 @@
/*
Copyright 2024 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { AbstractStartedContainer, GenericContainer, StartedTestContainer, Wait } from "testcontainers";
import mailhog from "mailhog";
export class MailhogContainer extends GenericContainer {
constructor() {
super("mailhog/mailhog:latest");
this.withExposedPorts(8025).withWaitStrategy(Wait.forListeningPorts());
}
public override async start(): Promise<StartedMailhogContainer> {
return new StartedMailhogContainer(await super.start());
}
}
export class StartedMailhogContainer extends AbstractStartedContainer {
public readonly client: mailhog.API;
constructor(container: StartedTestContainer) {
super(container);
this.client = mailhog({ host: container.getHost(), port: container.getMappedPort(8025) });
}
}