feature/ci (#84)
Co-authored-by: openhands <openhands@all-hands.dev> Reviewed-on: https://codeberg.org/johba/harb/pulls/84
This commit is contained in:
parent
beefe22f90
commit
4277f19b68
41 changed files with 3149 additions and 298 deletions
|
|
@ -67,10 +67,72 @@ test.describe('Acquire & Stake', () => {
|
|||
try {
|
||||
console.log('[TEST] Loading app...');
|
||||
await page.goto(`${STACK_WEBAPP_URL}/app/`, { waitUntil: 'domcontentloaded' });
|
||||
console.log('[TEST] App loaded, waiting for wallet to initialize...');
|
||||
console.log('[TEST] App loaded, waiting for Vue app to mount...');
|
||||
|
||||
// Wait for wallet to be fully recognized
|
||||
await page.waitForTimeout(3_000);
|
||||
// Wait for the Vue app to fully mount by waiting for a key element
|
||||
// The navbar-title is always present regardless of connection state
|
||||
const navbarTitle = page.locator('.navbar-title').first();
|
||||
await expect(navbarTitle).toBeVisible({ timeout: 30_000 });
|
||||
console.log('[TEST] Vue app mounted, navbar is visible');
|
||||
|
||||
// Trigger a resize event to force Vue's useMobile composable to recalculate
|
||||
// This ensures the app recognizes the desktop screen width set by wallet-provider
|
||||
await page.evaluate(() => {
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
});
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Give extra time for wallet connectors to initialize
|
||||
await page.waitForTimeout(2_000);
|
||||
|
||||
// Connect wallet flow:
|
||||
// The wallet-provider sets screen.width to 1280 to ensure desktop mode.
|
||||
// We expect the desktop Connect button to be visible.
|
||||
console.log('[TEST] Looking for Connect button...');
|
||||
|
||||
// Desktop Connect button
|
||||
const connectButton = page.locator('.connect-button--disconnected').first();
|
||||
|
||||
let panelOpened = false;
|
||||
|
||||
// Wait for the Connect button with a reasonable timeout
|
||||
if (await connectButton.isVisible({ timeout: 5_000 })) {
|
||||
console.log('[TEST] Found desktop Connect button, clicking...');
|
||||
await connectButton.click();
|
||||
panelOpened = true;
|
||||
} else {
|
||||
// Debug: Log current screen.width and navbar-end contents
|
||||
const screenWidth = await page.evaluate(() => window.screen.width);
|
||||
const navbarEndHtml = await page.locator('.navbar-end').innerHTML().catch(() => 'not found');
|
||||
console.log(`[TEST] DEBUG: screen.width = ${screenWidth}`);
|
||||
console.log(`[TEST] DEBUG: navbar-end HTML = ${navbarEndHtml.substring(0, 500)}`);
|
||||
console.log('[TEST] Connect button not visible - checking for mobile fallback...');
|
||||
|
||||
// Fallback to mobile login icon (SVG in navbar-end when disconnected)
|
||||
const mobileLoginIcon = page.locator('.navbar-end svg').first();
|
||||
if (await mobileLoginIcon.isVisible({ timeout: 2_000 })) {
|
||||
console.log('[TEST] Found mobile login icon, clicking...');
|
||||
await mobileLoginIcon.click();
|
||||
panelOpened = true;
|
||||
} else {
|
||||
console.log('[TEST] No Connect button or mobile icon visible - wallet may already be connected');
|
||||
}
|
||||
}
|
||||
|
||||
if (panelOpened) {
|
||||
await page.waitForTimeout(1_000);
|
||||
|
||||
// Look for the injected wallet connector in the slideout panel
|
||||
console.log('[TEST] Looking for wallet connector in panel...');
|
||||
const injectedConnector = page.locator('.connectors-element').first();
|
||||
if (await injectedConnector.isVisible({ timeout: 5_000 })) {
|
||||
console.log('[TEST] Clicking first wallet connector...');
|
||||
await injectedConnector.click();
|
||||
await page.waitForTimeout(2_000);
|
||||
} else {
|
||||
console.log('[TEST] WARNING: No wallet connector found in panel');
|
||||
}
|
||||
}
|
||||
|
||||
// Check if wallet shows as connected in UI
|
||||
console.log('[TEST] Checking for wallet display...');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue