From aed83b9fee7d1c7657672125b9097f580ed50b7a Mon Sep 17 00:00:00 2001 From: serav Date: Wed, 13 Nov 2024 19:00:46 -0500 Subject: [PATCH] Fix flakey test --- tests/e2e/MediaCo/portal.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/e2e/MediaCo/portal.spec.js b/tests/e2e/MediaCo/portal.spec.js index e96ca74a3..2088425f6 100644 --- a/tests/e2e/MediaCo/portal.spec.js +++ b/tests/e2e/MediaCo/portal.spec.js @@ -106,27 +106,27 @@ test.describe('E2E test', () => { const filePath = path.join(__dirname, '../../../assets/img/cableinfo.jpg'); const attachmentID = await page.locator('div[id="attachment-ID"]').textContent(); - await page.setInputFiles(`#${attachmentID}`, filePath); const pCoreVersion = await page.evaluate(() => window.PCore.getPCoreVersion()); const isInfinity23OrHigher = ['8.23.0', '23.1.1'].includes(pCoreVersion); + // Need to be waiting for the transaction before code to trigger the transaction await Promise.all([ page.waitForResponse( `${endpoints.serverConfig.infinityRestServerUrl}${ endpoints.serverConfig.appAlias ? `/app/${endpoints.serverConfig.appAlias}` : '' }/api/application/v2/attachments/upload` - ) + ), + page.setInputFiles(`#${attachmentID}`, filePath) ]); - await page.locator('button:has-text("submit")').click(); - await Promise.all([ page.waitForResponse( `${endpoints.serverConfig.infinityRestServerUrl}${ endpoints.serverConfig.appAlias ? `/app/${endpoints.serverConfig.appAlias}` : '' }/api/application/v2/cases/${currentCaseID}/attachments${isInfinity23OrHigher ? '?includeThumbnail=false' : ''}` - ) + ), + page.locator('button:has-text("submit")').click() ]); const attachmentCount = await page.locator('div[id="attachments-count"]').textContent();