Skip to content

Commit

Permalink
[ENABLE] test for edge 18 working
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabhg71 committed Sep 4, 2023
1 parent 92ec71f commit 26bf0e8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions tests/e2e/runners/edge/edge18.bs.runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
15 changes: 11 additions & 4 deletions tests/e2e/spec/gutenberg_ro.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
});
Expand Down

0 comments on commit 26bf0e8

Please sign in to comment.