diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1b59dbed8..faf656854 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -98,13 +98,6 @@ jobs: BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} run: npx http-server --silent -p 8099 & - - name: Run BrowserStack tests on Edge Legacy 18 / Win10 - if: github.event_name == 'push' && github.event.pull_request.head.repo.full_name == github.repository - env: - BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} - BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - run: npx mocha tests/e2e/runners/edge/edge18.bs.runner.js - - name: Run BrowserStack tests on Firefox Legacy 56 / Win10 if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository env: @@ -139,6 +132,15 @@ jobs: BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} run: npx mocha tests/e2e/runners/safari/safari14.bs.runner.js + + # [DEV] Test on Edge18 are bit flaky, so we are retrying 2 times + - name: Run BrowserStack tests on Edge Legacy 18 / Win10 + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + run: npx mocha tests/e2e/runners/edge/edge18.bs.runner.js --retries 2 + - name: Stop BrowserStackLocal if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository diff --git a/tests/e2e/runners/edge/edge18.bs.runner.js b/tests/e2e/runners/edge/edge18.bs.runner.js index f15715d21..e759d9e8f 100644 --- a/tests/e2e/runners/edge/edge18.bs.runner.js +++ b/tests/e2e/runners/edge/edge18.bs.runner.js @@ -30,15 +30,13 @@ async function loadEdgeLegacyDriver () { .usingServer('https://hub-cloud.browserstack.com/wd/hub') .withCapabilities(capabilities) .build(); + // Maximize the window so that full browser state is visible in the screenshots + await driver.manage().window().maximize(); return driver; }; -// Maximize the window so that full browser state is visible in the screenshots // const driver_edge_legacy = await loadEdgeLegacyDriver(); -// await driver_edge_legacy.manage().window().maximize(); // await legacyRayCharles.runTests(driver_edge_legacy); -// Maximize the window so that full browser state is visible in the screenshots const driver_edge_gutenberg = await loadEdgeLegacyDriver(); -await driver_edge_gutenberg.manage().window().maximize(); await gutenbergRo.runTests(driver_edge_gutenberg); diff --git a/tests/e2e/spec/gutenberg_ro.e2e.spec.js b/tests/e2e/spec/gutenberg_ro.e2e.spec.js index 6bfce83dc..4b6a0d7ab 100644 --- a/tests/e2e/spec/gutenberg_ro.e2e.spec.js +++ b/tests/e2e/spec/gutenberg_ro.e2e.spec.js @@ -30,9 +30,9 @@ import fs from 'fs'; /* global describe, it */ // Get the BrowserStack environment variable -const BROWSERSTACK = !!process.env.BROWSERSTACK_LOCAL_IDENTIFIER; +// const BROWSERSTACK = !!process.env.BROWSERSTACK_LOCAL_IDENTIFIER; // DEV: For local testing, use line below instead -// const BROWSERSTACK = true; +const BROWSERSTACK = true; const port = BROWSERSTACK ? '8099' : '8080'; const gutenbergRoBaseFile = BROWSERSTACK ? '/tests/zims/gutenberg-ro/gutenberg_ro_all_2023-08.zim' : paths.gutenbergRoBaseFile @@ -233,9 +233,16 @@ function runTests (driver, modes) { console.log('\x1b[33m%s\x1b[0m', ' Test skipped.'); return; } + // We switch to default Content and back to Iframe because the If we are retrying the test + // It will make sure reset the iframe + await driver.switchTo().defaultContent(); + await driver.switchTo().frame('articleContent'); + let firstBookName = ''; await driver.wait(until.elementIsVisible(driver.findElement(By.id('alpha_sort')))).click(); - await driver.sleep(1500); - const firstBookName = await driver.wait(until.elementLocated(By.xpath('/html/body/div[4]/div/table/tbody/tr[1]/td[1]/div[2]/div/div/span[2]')), 4000).getText(); + await driver.sleep(4000); + + const bookList = await driver.wait(until.elementsLocated(By.className('table-title')), 1500) + firstBookName = await bookList[0].getText(); // get the text of first result and check if it is the same as expected assert.equal(firstBookName, 'Creierul, O Enigma Descifrata'); });