diff --git a/src/WrapperApp/components/NavDrawer/NavDrawer.test.ts b/src/WrapperApp/components/NavDrawer/NavDrawer.test.ts index 63c132cb..70959e71 100644 --- a/src/WrapperApp/components/NavDrawer/NavDrawer.test.ts +++ b/src/WrapperApp/components/NavDrawer/NavDrawer.test.ts @@ -16,9 +16,24 @@ describe('NavDrawer component', () => { await driver.quit(); }, 30000); + // this function hides the react error overlay, as its presence interferes with the tests when running locally + async function hideErrorOverlay() { + try { + const overlay = await driver.wait( + until.elementLocated(By.id('webpack-dev-server-client-overlay')), + 1000 // short timeout to avoid unnecessary waiting + ); + await driver.executeScript("arguments[0].style.display = 'none';", overlay); + } catch (error) { + // overlay not found within timeout, proceed without hiding it + } + } + //this test checks if the menu button (upper left corner, next to the yaptide logo) has rendered test('renders a menu button', async () => { await driver.get('http://localhost:3000'); + //hide react overlay if present + await hideErrorOverlay(); const menuButton = await driver.findElement( By.xpath("//button[@aria-label = 'Toggle drawer button']") ); @@ -28,6 +43,8 @@ describe('NavDrawer component', () => { //this test check if the menu button works (closes and opens the menu drawer) test('closes and opens the drawer on click', async () => { await driver.get('http://localhost:3000'); + //hide react overlay if present + await hideErrorOverlay(); //find the menu button and then click it const menuButton = await driver.findElement( diff --git a/src/__tests__/FlukaConverter.test.ts b/src/__tests__/FlukaConverter.test.ts index ba7efd2b..38f2d1e4 100644 --- a/src/__tests__/FlukaConverter.test.ts +++ b/src/__tests__/FlukaConverter.test.ts @@ -21,10 +21,26 @@ describe('Fluka Converter', () => { await driver.quit(); }, 30_000); + // this function hides the react error overlay, as its presence interferes with the tests when running locally + async function hideErrorOverlay() { + try { + const overlay = await driver.wait( + until.elementLocated(By.id('webpack-dev-server-client-overlay')), + 1000 // short timeout to avoid unnecessary waiting + ); + await driver.executeScript("arguments[0].style.display = 'none';", overlay); + } catch (error) { + // overlay not found within timeout, proceed without hiding it + } + } + //this test checks if converter works correctly - opens an example and generates config files test('converter generates correct files', async () => { await driver.get('http://localhost:3000'); + //hide react overlay if present + await hideErrorOverlay(); + // Wait for the application to load expect( await driver.wait( diff --git a/src/__tests__/ShieldhitConverter.test.ts b/src/__tests__/ShieldhitConverter.test.ts index 14d7fb2b..360eb37f 100644 --- a/src/__tests__/ShieldhitConverter.test.ts +++ b/src/__tests__/ShieldhitConverter.test.ts @@ -22,10 +22,26 @@ describe('ShieldhitConverter', () => { await driver.quit(); }, 30_000); + // this function hides the react error overlay, as its presence interferes with the tests when running locally + async function hideErrorOverlay() { + try { + const overlay = await driver.wait( + until.elementLocated(By.id('webpack-dev-server-client-overlay')), + 1000 // short timeout to avoid unnecessary waiting + ); + await driver.executeScript("arguments[0].style.display = 'none';", overlay); + } catch (error) { + // overlay not found within timeout, proceed without hiding it + } + } + //this test checks if converter works correctly - opens an example and generates config files test('converter generates correct files', async () => { await driver.get('http://localhost:3000'); + //hide react overlay if present + await hideErrorOverlay(); + // Wait for the application to load expect( await driver.wait( diff --git a/src/__tests__/TopasConverter.test.ts b/src/__tests__/TopasConverter.test.ts index 9e97b9dc..b2116f6f 100644 --- a/src/__tests__/TopasConverter.test.ts +++ b/src/__tests__/TopasConverter.test.ts @@ -21,11 +21,27 @@ describe('TopasConverter', () => { await driver.quit(); }, 30_000); + // this function hides the react error overlay, as its presence interferes with the tests when running locally + async function hideErrorOverlay() { + try { + const overlay = await driver.wait( + until.elementLocated(By.id('webpack-dev-server-client-overlay')), + 1000 // short timeout to avoid unnecessary waiting + ); + await driver.executeScript("arguments[0].style.display = 'none';", overlay); + } catch (error) { + // overlay not found within timeout, proceed without hiding it + } + } + //this test checks if converter works correctly - opens an example and generates config files // expected to fail because Topas was temporarily removed from the project xtest('converter generates correct files', async () => { await driver.get('http://localhost:3000'); + //hide react overlay if present + await hideErrorOverlay(); + // Wait for the application to load expect( await driver.wait(