You've already forked element-web
mirror of
https://github.com/element-hq/element-web.git
synced 2025-07-30 08:43:13 +03:00
Fix flaky playwright tests (#28984)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
1a21b718d8
commit
540580504d
@ -9,12 +9,21 @@ Please see LICENSE files in the repository root for full details.
|
||||
import http from "http";
|
||||
import express from "express";
|
||||
import { AddressInfo } from "net";
|
||||
import { TestInfo } from "@playwright/test";
|
||||
|
||||
import { randB64Bytes } from "../utils/rand.ts";
|
||||
|
||||
export class OAuthServer {
|
||||
private server?: http.Server;
|
||||
private sub?: string;
|
||||
|
||||
public onTestStarted(testInfo: TestInfo): void {
|
||||
this.sub = testInfo.testId;
|
||||
}
|
||||
|
||||
public start(): number {
|
||||
if (this.server) this.stop();
|
||||
const token = randB64Bytes(16);
|
||||
|
||||
const app = express();
|
||||
|
||||
@ -28,7 +37,7 @@ export class OAuthServer {
|
||||
const code = req.body.code;
|
||||
if (code === "valid_auth_code") {
|
||||
res.send({
|
||||
access_token: "oauth_access_token",
|
||||
access_token: token,
|
||||
token_type: "Bearer",
|
||||
expires_in: "3600",
|
||||
});
|
||||
@ -43,7 +52,7 @@ export class OAuthServer {
|
||||
|
||||
// return an OAuth2 user info object
|
||||
res.send({
|
||||
sub: "alice",
|
||||
sub: this.sub,
|
||||
name: "Alice",
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user