Qa 83/login logout of vortex#22898
Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
| * Removes ELECTRON_RUN_AS_NODE (set by pnpm) and isolates user data. | ||
| */ | ||
| function buildElectronEnv(userDataDir: string): Record<string, string> { | ||
| const env: Record<string, string> = {}; |
There was a problem hiding this comment.
As far as I can see, this is copied verbatim (+/- a few comments) from vortex-app.ts. There are currently ~150 lines of duplication between the two fixtures, lets extract those functions into their own file and import them into the fixtures to avoid divergence between the two.
As far as I can see the duplicated functions are: resolveMainDir, resolveElectronBinary, buildElectronEnv, waitForMainWindow
| await use(mainWindow); | ||
| return; | ||
| } catch (error) { | ||
| if (!mainWindow.isClosed()) { |
There was a problem hiding this comment.
So although your code avoids this at runtime, calling use twice within the same fixture is violating the playwright fixture contract. This is potential for undefined behaviour. Additionally we're potentially dropping relevant errors from the first use call.
I suggest something like:
vortexWindow: async ({ vortexApp }, use) => {
const waitForReady = async (win: Page) => {
await win.waitForLoadState("domcontentloaded");
await win.waitForFunction(
() => (document.body?.innerText?.length ?? 0) > 0,
{ timeout: 60_000 },
);
};
let mainWindow = await waitForMainWindow(vortexApp);
try {
await waitForReady(mainWindow);
} catch (error) {
if (!mainWindow.isClosed()) throw error;
mainWindow = await waitForMainWindow(vortexApp);
await waitForReady(mainWindow);
}
await use(mainWindow);
},
Additionally I can see that waitForReady functionality has already diverged between this fixture and the other one. Why not create a new function waitForRenderReady to avoid this going forward.
|
This PR has conflicts. You need to rebase the PR before it can be merged. |
|
This PR has been marked as stale due to inactivity. |
Adding a logout test for Vortex
Added premium user for Vortex
Because all tests need to be independent from one another. I have created a vortex-app-isolated fixture that launches a fresh Electron app and fresh user-data directory per test.