class EntityClickViewComponent { constructor(page) { this.page = page; } entityClickView() { return this.page.locator('.entityClickView'); } async getEntityName() { const el = this.entityClickView().locator('#entityName'); if ((await el.count()) === 0) return null; return (await el.textContent()) || ''; } async getEntityHealth() { const healthText = this.entityClickView().locator('div').filter({ hasText: /Health/i }).first(); if ((await healthText.count()) === 0) return null; const text = (await healthText.textContent()) || ''; const match = text.match(/(\d+)/); return match ? match[1] : null; } async clickDetailedView() { await this.entityClickView().locator('button').filter({ hasText: 'Detailed' }).click(); } async clickPlainView() { await this.entityClickView().locator('button').filter({ hasText: 'Plain' }).click(); } } module.exports = EntityClickViewComponent;