const { test } = require('@playwright/test'); const USER = process.env.FD_USER || 'e2e@flowdeck.local'; const PASS = process.env.FD_PASS || 'e2e-secret-123'; const WS = 'Workspace E2E DOM ' + Date.now(); async function uiLogin(page) { await page.goto('/auth/login?provider=local'); await page.fill('#email', USER); await page.fill('#password', PASS); await page.click('.btn-primary'); await page.waitForURL('**/workspaces', { timeout: 10000 }); } async function createAndEnterWorkspace(page, wsName) { await page.waitForSelector('.ws-card.btn-new', { timeout: 8000 }); await page.click('.ws-card.btn-new'); await page.fill('.dialog-input', wsName); await page.click('.dialog-box .btn-primary'); await page.waitForTimeout(1000); await page.click(`.ws-card:has-text("${wsName}")`); await page.waitForURL('**/local-workspace**', { timeout: 10000 }); await page.waitForTimeout(1500); } test('explore DOM: local-workspace tree complet', async ({ page }) => { await uiLogin(page); await createAndEnterWorkspace(page, WS); console.log('URL:', page.url()); // Attendre que le tree soit monté await page.waitForTimeout(2000); // Dump tout le HTML de la sidebar/tree const html = await page.evaluate(() => document.body.innerHTML.slice(0, 15000)); console.log('=== BODY HTML (15k) ==='); console.log(html); // Chercher tous les elements avec data-ws-action const wsActions = await page.evaluate(() => [...document.querySelectorAll('[data-ws-action]')].map(e => ({ action: e.getAttribute('data-ws-action'), tag: e.tagName, cls: e.className, text: (e.innerText||'').slice(0,30), })) ); console.log('DATA-WS-ACTION ELEMENTS:', JSON.stringify(wsActions, null, 1)); // Tous les boutons + leurs textes const btns = await page.evaluate(() => [...document.querySelectorAll('button, a[role=button]')].map(b => ({ cls: (b.className||'').slice(0,40), text: (b.innerText||'').trim().slice(0,30), id: b.id, action: b.getAttribute('data-ws-action') || b.getAttribute('data-action'), })) ); console.log('ALL BUTTONS:', JSON.stringify(btns.filter(x=>/new|creat|add|page|file|folder/i.test(x.text+' '+x.cls)), null, 1)); // Chercher les inputs const inputs = await page.evaluate(() => [...document.querySelectorAll('input')].map(i => ({ id: i.id, ph: i.placeholder, cls: i.className, type: i.type, })) ); console.log('ALL INPUTS:', JSON.stringify(inputs, null, 1)); await page.screenshot({ path: 'shots/ws_dom_dump.png', fullPage: true }); });