From 596924c92cbda5b935eda5f8d28d156accdb3dd9 Mon Sep 17 00:00:00 2001 From: Jason Madigan Date: Wed, 21 Aug 2024 16:32:48 +0100 Subject: [PATCH] test adjustments --- tests/topology.test.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/topology.test.js b/tests/topology.test.js index 2ef8779..176ac75 100644 --- a/tests/topology.test.js +++ b/tests/topology.test.js @@ -16,18 +16,23 @@ describe('PolicyTopology Page', function () { }); it('should render and interact with dropdown', async function () { - const dropdownButton = await page.waitForSelector('#pf-dropdown-toggle-id-2'); - await dropdownButton.click(); - console.log('Dropdown found, attempting to click'); + try { + const dropdownButton = await page.waitForSelector('[data-ouia-component-type="PF4/DropdownToggle"]'); + await dropdownButton.click(); - const gatewayItem = await page.waitForSelector('text=Gateway'); - const listenerItem = await page.waitForSelector('text=Listener'); + await page.waitForSelector('.pf-c-dropdown__menu', { visible: true }); - expect(gatewayItem).to.not.be.null; - expect(listenerItem).to.not.be.null; - console.log('Gateway and Listener items found'); + const gatewayItem = await page.waitForSelector('text=Gateway'); + const listenerItem = await page.waitForSelector('text=Listener'); - await gatewayItem.click(); - console.log('Clicked on Gateway item'); + expect(gatewayItem).to.not.be.null; + expect(listenerItem).to.not.be.null; + + await gatewayItem.click(); + } catch (error) { + const rootContent = await page.evaluate(() => document.querySelector('#root').innerHTML); + console.error('Error encountered, dumping #root content:\n', rootContent); + throw error; + } }); });