mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-18 10:23:07 +00:00
This reverts commit 583c3eb4a6.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
import { getByTestId, getButtonByText } from './elements';
|
||||
import { waitForSplashScreenToDisappear } from './waiting';
|
||||
|
||||
/**
|
||||
* Get the platform-specific modifier key (Meta for Mac, Control for Windows/Linux)
|
||||
@@ -22,10 +23,10 @@ export async function pressModifierEnter(page: Page): Promise<void> {
|
||||
* Waits for the element to be visible before clicking to avoid flaky tests
|
||||
*/
|
||||
export async function clickElement(page: Page, testId: string): Promise<void> {
|
||||
// Splash screen waits are handled by navigation helpers (navigateToContext, navigateToMemory, etc.)
|
||||
// before any clickElement calls, so we skip the splash check here to avoid blocking when
|
||||
// other fixed overlays (e.g. HeaderActionsPanel backdrop at z-[60]) are present on the page.
|
||||
// Wait for splash screen to disappear first (safety net)
|
||||
await waitForSplashScreenToDisappear(page, 5000);
|
||||
const element = page.locator(`[data-testid="${testId}"]`);
|
||||
// Wait for element to be visible and stable before clicking
|
||||
await element.waitFor({ state: 'visible', timeout: 10000 });
|
||||
await element.click();
|
||||
}
|
||||
|
||||
@@ -54,16 +54,13 @@ export async function waitForElementHidden(
|
||||
*/
|
||||
export async function waitForSplashScreenToDisappear(page: Page, timeout = 5000): Promise<void> {
|
||||
try {
|
||||
// Check if splash screen is disabled or already shown (fastest check)
|
||||
const splashDisabled = await page.evaluate(() => {
|
||||
return (
|
||||
localStorage.getItem('automaker-disable-splash') === 'true' ||
|
||||
localStorage.getItem('automaker-splash-shown-session') === 'true'
|
||||
);
|
||||
// Check if splash screen is shown via sessionStorage first (fastest check)
|
||||
const splashShown = await page.evaluate(() => {
|
||||
return sessionStorage.getItem('automaker-splash-shown') === 'true';
|
||||
});
|
||||
|
||||
// If splash is disabled or already shown, it won't appear, so we're done
|
||||
if (splashDisabled) {
|
||||
// If splash is already marked as shown, it won't appear, so we're done
|
||||
if (splashShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,11 +69,8 @@ export async function waitForSplashScreenToDisappear(page: Page, timeout = 5000)
|
||||
// We check for elements that match the splash screen pattern
|
||||
await page.waitForFunction(
|
||||
() => {
|
||||
// Check if splash is disabled or already shown
|
||||
if (
|
||||
localStorage.getItem('automaker-disable-splash') === 'true' ||
|
||||
localStorage.getItem('automaker-splash-shown-session') === 'true'
|
||||
) {
|
||||
// Check if splash is marked as shown in sessionStorage
|
||||
if (sessionStorage.getItem('automaker-splash-shown') === 'true') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user