Skip to content

Commit

Permalink
Fix flakey test
Browse files Browse the repository at this point in the history
  • Loading branch information
serav authored and serav committed Nov 14, 2024
1 parent 2a54584 commit aed83b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/e2e/MediaCo/portal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit aed83b9

Please sign in to comment.