Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Lazily set up ElementAppPage subfixtures to avoid conflicting on netw…
Browse files Browse the repository at this point in the history
…ork routing

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Feb 19, 2024
1 parent 6a1ca23 commit 6112276
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions playwright/pages/ElementAppPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,23 @@ import { Spotlight } from "./Spotlight";
export class ElementAppPage {
public constructor(public readonly page: Page) {}

public settings = new Settings(this.page);
public client: Client = new Client(this.page);
public timeline: Timeline = new Timeline(this.page);
// We create these lazily on first access to avoid calling setup code which might cause conflicts,
// e.g. the network routing code in the client subfixture.
private _settings?: Settings;
public get settings(): Settings {
if (!this._settings) this._settings = new Settings(this.page);
return this._settings;
}
private _client?: Client;
public get client(): Client {
if (!this._client) this._client = new Client(this.page);
return this._client;
}
private _timeline?: Timeline;
public get timeline(): Timeline {
if (!this._timeline) this._timeline = new Timeline(this.page);
return this._timeline;
}

/**
* Open the top left user menu, returning a Locator to the resulting context menu.
Expand Down

0 comments on commit 6112276

Please sign in to comment.