Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy PR for Adding selenium ui test #1296

Open
wants to merge 68 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d26d69b
Adding selenium ui test
THEBOSS0369 Dec 6, 2024
8ec21d3
Merge branch 'main' into selenium-uitest
THEBOSS0369 Dec 25, 2024
d303ac3
Testing
THEBOSS0369 Dec 25, 2024
93356f2
Merge remote-tracking branch 'origin/selenium-uitest' into selenium-u…
THEBOSS0369 Dec 25, 2024
0647493
Testing
THEBOSS0369 Dec 25, 2024
487edc2
Testing
THEBOSS0369 Dec 25, 2024
744e08d
Testing
THEBOSS0369 Dec 25, 2024
065824e
Testing
THEBOSS0369 Dec 25, 2024
1ffee45
Testing 8
THEBOSS0369 Dec 28, 2024
d4e5702
Testing 9
THEBOSS0369 Dec 28, 2024
1833190
Testing 9
THEBOSS0369 Dec 28, 2024
e094798
testing 11
THEBOSS0369 Dec 28, 2024
1c5f3a5
Testing 12
THEBOSS0369 Dec 28, 2024
cde4771
Testing 13
THEBOSS0369 Dec 28, 2024
cff2d2c
Testing 14
THEBOSS0369 Dec 28, 2024
1a767e0
Testing 15
THEBOSS0369 Dec 29, 2024
32d7a30
Testing 16
THEBOSS0369 Dec 29, 2024
a6b0b17
Testing 17
THEBOSS0369 Dec 29, 2024
4ae5d21
Testing 18
THEBOSS0369 Dec 29, 2024
b28dff5
Testing 19 starting from start
THEBOSS0369 Dec 30, 2024
b19198f
Testing 20
THEBOSS0369 Dec 30, 2024
33cbd3c
Testing 21
THEBOSS0369 Dec 30, 2024
2a18cdb
Testing 22 coming close
THEBOSS0369 Dec 30, 2024
d9e7392
Testing 23 coming close
THEBOSS0369 Dec 30, 2024
0499f26
Testing 24
THEBOSS0369 Dec 30, 2024
ee74423
Testing 25 more close
THEBOSS0369 Dec 30, 2024
1ee1e15
Testing 25 more close
THEBOSS0369 Dec 30, 2024
c40a1c0
Adding firefox 70 tests to see it passes or not
THEBOSS0369 Dec 30, 2024
752a080
Adding firefox 70 tests to see it passes or not
THEBOSS0369 Dec 30, 2024
1ad5e91
Testing 26 some different tricks
THEBOSS0369 Dec 30, 2024
9cf59b3
Testing 26 some different tricks
THEBOSS0369 Dec 30, 2024
6f9db7e
Testing 26 some different tricks
THEBOSS0369 Dec 30, 2024
c26cef5
Testing 27
THEBOSS0369 Dec 30, 2024
6df7bee
Testing 28
THEBOSS0369 Dec 30, 2024
6b18ac3
Test are running on all browser except firefox
THEBOSS0369 Dec 30, 2024
8f5bd7a
firefox fixing attempt 1
THEBOSS0369 Dec 30, 2024
07494cd
firefox fixing attempt 2
THEBOSS0369 Dec 30, 2024
5fa5baf
firefox fixing attempt 3
THEBOSS0369 Dec 30, 2024
92d6ec8
Checking it passes in every browser except ff 70 and edge18
THEBOSS0369 Dec 30, 2024
3b6c7ec
firefox fixing attempt 4
THEBOSS0369 Dec 31, 2024
f1c8bda
firefox fixing attempt 5
THEBOSS0369 Dec 31, 2024
0af215c
Fixing ff issue last attempt
THEBOSS0369 Dec 31, 2024
4715236
Attempting tests in other browsers execept firefox
THEBOSS0369 Dec 31, 2024
d06cd61
Merge branch 'main' into selenium-uitest
Jaifroid Jan 9, 2025
46f522c
Use await for driver.quit()
Jaifroid Jan 9, 2025
b231c48
Reverse order of tests in Edge 18
Jaifroid Jan 9, 2025
df083d1
Try running drivers in sync
Jaifroid Jan 9, 2025
5a217dc
Revert "Try running drivers in sync"
Jaifroid Jan 9, 2025
d9a7eeb
Try different approach
Jaifroid Jan 9, 2025
f9a1470
Revert "Try different approach"
Jaifroid Jan 9, 2025
da557df
Do not load drivers too soon
Jaifroid Jan 9, 2025
984fa47
Use Promises
Jaifroid Jan 9, 2025
d123a2a
Adding Tonedear Test in FF70 for verification
THEBOSS0369 Jan 10, 2025
f73bfeb
Revert "Adding Tonedear Test in FF70 for verification"
Jaifroid Jan 10, 2025
5d838ea
Revert "Use Promises"
Jaifroid Jan 10, 2025
a3eac1c
Revert "Do not load drivers too soon"
Jaifroid Jan 10, 2025
61deb0d
Try timeout approach
Jaifroid Jan 10, 2025
218185e
Correct the syntax
Jaifroid Jan 10, 2025
d9db9d3
Temporarily disabling all BS tests except Edge
Jaifroid Jan 10, 2025
c643066
Use single driver for Edge Legacy tests
Jaifroid Jan 10, 2025
6178c1c
Ensure source verification is switched off with noPrompts
Jaifroid Jan 10, 2025
b900c46
Revert "Temporarily disabling all BS tests except Edge"
Jaifroid Jan 10, 2025
16bd5f7
Commented out the console log
THEBOSS0369 Jan 10, 2025
32eca48
Commenting out the tonedear tests for FF70
THEBOSS0369 Jan 10, 2025
eccdd97
Removing unnecessary lines of codes and allowing only J Query mode fo…
THEBOSS0369 Jan 11, 2025
c31897b
Update tonedear.e2e.spec.js
THEBOSS0369 Jan 14, 2025
0225cad
copied the code from main pr
THEBOSS0369 Jan 18, 2025
cc3f471
Merge branch 'main' into selenium-uitest
THEBOSS0369 Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/e2e/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import path from 'path';

const rayCharlesBaseFile = path.resolve('./tests/zims/legacy-ray-charles/wikipedia_en_ray_charles_2015-06.zimaa');
const gutenbergRoBaseFile = path.resolve('./tests/zims/gutenberg-ro/gutenberg_ro_all_2023-08.zim');
const tonedearBaseFile = path.resolve('./tests/zims/tonedear/tonedear.com_en_2024-09.zim');
const downloadDir = path.resolve('./tests/');

export default {
rayCharlesBaseFile: rayCharlesBaseFile,
gutenbergRoBaseFile: gutenbergRoBaseFile,
tonedearBaseFile: tonedearBaseFile,
downloadDir: downloadDir
};
4 changes: 3 additions & 1 deletion tests/e2e/runners/chrome/chrome60.bs.runner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Builder } from 'selenium-webdriver';
import { Options } from 'selenium-webdriver/chrome.js';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedear from '../../spec/tonedear.e2e.spec.js';
import paths from '../../paths.js';

/* eslint-disable camelcase */
Expand Down Expand Up @@ -37,8 +38,9 @@ async function loadChromeDriver () {
// Maximize the window so that full browser state is visible in the screenshots
// await driver_chrome.manage().window().maximize(); // Not supported in this version / Selenium

console.log('\x1b[33m%s\x1b[0m', 'Running Gutenberg tests only for this browser version');
console.log('\x1b[33m%s\x1b[0m', 'Running Gutenberg and Tonedear tests only for this browser version');
console.log(' ');

// make sure to use await running tests or we are charged unnecessarily on Browserstack
await gutenbergRo.runTests(await loadChromeDriver());
await tonedear.runTests(await loadChromeDriver());
19 changes: 11 additions & 8 deletions tests/e2e/runners/chrome/chromium.e2e.runner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Builder } from 'selenium-webdriver';
import { Options } from 'selenium-webdriver/chrome.js';
import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
// import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
// import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedearTests from '../../spec/tonedear.e2e.spec.js';
import paths from '../../paths.js';

/* eslint-disable camelcase */
Expand All @@ -20,10 +21,12 @@ async function loadChromiumDriver () {
return driver;
};

// Preserve the order of loading, because when a user runs these on local machine, the second driver will be on top of and cover the first one
// so we need to use the second one first
const driver_for_gutenberg = await loadChromiumDriver();
const driver_for_ray_charles = await loadChromiumDriver();
// Preserve the order of loading, because when a user runs these on local machine, the third driver will be on top of and cover the first one
// so we need to use the third one first
const driver_for_tonedear = await loadChromiumDriver();
// const driver_for_gutenberg = await loadChromiumDriver();
// const driver_for_ray_charles = await loadChromiumDriver();

await legacyRayCharles.runTests(driver_for_ray_charles);
await gutenbergRo.runTests(driver_for_gutenberg);
// await legacyRayCharles.runTests(driver_for_ray_charles);
// await gutenbergRo.runTests(driver_for_gutenberg);
await tonedearTests.runTests(driver_for_tonedear);
12 changes: 8 additions & 4 deletions tests/e2e/runners/edge/edge18.bs.runner.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Builder } from 'selenium-webdriver';
import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedear from '../../spec/tonedear.e2e.spec.js';

/* eslint-disable camelcase */

// Input capabilities
const capabilities = {
'browserstack.idleTimeout': 300,
'bstack:options': {
os: 'Windows',
osVersion: '10',
Expand Down Expand Up @@ -35,8 +37,10 @@ async function loadEdgeLegacyDriver () {
return driver;
};

const driver_edge_legacy = await loadEdgeLegacyDriver();
await legacyRayCharles.runTests(driver_edge_legacy);
// For this runner, we must use a single driver for all tests to avoid the other drivers
// timing out while earlier tests complete
const singleDriver = await loadEdgeLegacyDriver();

const driver_edge_gutenberg = await loadEdgeLegacyDriver();
await gutenbergRo.runTests(driver_edge_gutenberg);
await legacyRayCharles.runTests(singleDriver, null, true);
await gutenbergRo.runTests(singleDriver, null, true);
await tonedear.runTests(singleDriver);
2 changes: 2 additions & 0 deletions tests/e2e/runners/edge/ieMode.e2e.runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Builder } from 'selenium-webdriver';
import { Options } from 'selenium-webdriver/ie.js';
import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedear from '../../spec/tonedear.e2e.spec.js';

/* eslint-disable camelcase */

Expand All @@ -18,3 +19,4 @@ async function loadIEModeDriver () {

await legacyRayCharles.runTests(await loadIEModeDriver(), ['jquery']);
await gutenbergRo.runTests(await loadIEModeDriver(), ['jquery']);
await tonedear.runTests(await loadIEModeDriver(), ['jquery']);
19 changes: 11 additions & 8 deletions tests/e2e/runners/edge/microsoftEdge.e2e.runner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Builder } from 'selenium-webdriver';
import { Options } from 'selenium-webdriver/edge.js';
import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
// import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
// import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedearTests from '../../spec/tonedear.e2e.spec.js';
/* eslint-disable camelcase */

async function loadMSEdgeDriver () {
Expand All @@ -17,10 +18,12 @@ async function loadMSEdgeDriver () {
return driver;
};

// Preserve the order of loading, because when a user runs these on local machine, the second driver will be on top of and cover the first one
// so we need to use the second one first
const driver_for_gutenberg = await loadMSEdgeDriver();
const driver_for_ray_charles = await loadMSEdgeDriver();
// Preserve the order of loading, because when a user runs these on local machine, the third driver will be on top of and cover the first one
// so we need to use the third one first
const driver_for_tonedear = await loadMSEdgeDriver();
// const driver_for_gutenberg = await loadMSEdgeDriver();
// const driver_for_ray_charles = await loadMSEdgeDriver();

await legacyRayCharles.runTests(driver_for_ray_charles);
await gutenbergRo.runTests(driver_for_gutenberg);
// await legacyRayCharles.runTests(driver_for_ray_charles);
// await gutenbergRo.runTests(driver_for_gutenberg);
await tonedearTests.runTests(driver_for_tonedear);
19 changes: 11 additions & 8 deletions tests/e2e/runners/firefox/firefox.e2e.runner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Builder } from 'selenium-webdriver';
import firefox from 'selenium-webdriver/firefox.js';
import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
// import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
// import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedearTests from '../../spec/tonedear.e2e.spec.js';
import paths from '../../paths.js';

/* eslint-disable camelcase */
Expand All @@ -23,10 +24,12 @@ async function loadFirefoxDriver () {
return driver;
};

// Preserve the order of loading, because when a user runs these on local machine, the second driver will be on top of and cover the first one
// so we need to use the second one first
const driver_for_gutenberg = await loadFirefoxDriver();
const driver_for_ray_charles = await loadFirefoxDriver();
// Preserve the order of loading, because when a user runs these on local machine, the third driver will be on top of and cover the first one
// so we need to use the third one first
const driver_for_tonedear = await loadFirefoxDriver();
// const driver_for_gutenberg = await loadFirefoxDriver();
// const driver_for_ray_charles = await loadFirefoxDriver();

await legacyRayCharles.runTests(driver_for_ray_charles);
await gutenbergRo.runTests(driver_for_gutenberg);
// await legacyRayCharles.runTests(driver_for_ray_charles);
// await gutenbergRo.runTests(driver_for_gutenberg);
await tonedearTests.runTests(driver_for_tonedear);
9 changes: 7 additions & 2 deletions tests/e2e/runners/firefox/firefox70.bs.runner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Builder } from 'selenium-webdriver';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedear from '../../spec/tonedear.e2e.spec.js';
/* eslint-disable camelcase */

// Input capabilities
Expand Down Expand Up @@ -31,9 +32,13 @@ async function loadFirefoxDriver () {
};

const driver_gutenberg_fx = await loadFirefoxDriver();
const driver_tonedear_fx = await loadFirefoxDriver();

// Run test in SW mode only
console.log('\x1b[33m%s\x1b[0m', 'Running Gutenberg tests in ServiceWorker mode only for this browser version');
console.log('\x1b[33m%s\x1b[0m', 'Running Gutenberg and Tonedear tests in ServiceWorker mode only for this browser version');
console.log(' ');

await gutenbergRo.runTests(driver_gutenberg_fx, ['serviceworker']);
await gutenbergRo.runTests(driver_gutenberg_fx);
// Skipping Tonedear tests in SW mode for Firefox 70 due to unsupported navigation issues
// Reason-> Because the browsers below Firefox 77 does not support the replaceAll method, which is used in the Zimit
await tonedear.runTests(driver_tonedear_fx, ['jquery']);
16 changes: 10 additions & 6 deletions tests/e2e/runners/safari/safari14.bs.runner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Builder } from 'selenium-webdriver';
import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
// import legacyRayCharles from '../../spec/legacy-ray_charles.e2e.spec.js';
// import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
import tonedearTests from '../../spec/tonedear.e2e.spec.js';

/* eslint-disable camelcase */

Expand Down Expand Up @@ -37,8 +38,11 @@ console.log(' ');
console.log('\x1b[33m%s\x1b[0m', 'Running tests in JQuery mode only for this browser version')
console.log(' ');

const driver_legacy_safari = await loadSafariDriver();
await legacyRayCharles.runTests(driver_legacy_safari, ['jquery']);
// const driver_legacy_safari = await loadSafariDriver();
// await legacyRayCharles.runTests(driver_legacy_safari, ['jquery']);

const driver_gutenberg_safari = await loadSafariDriver();
await gutenbergRo.runTests(driver_gutenberg_safari, ['jquery']);
// const driver_gutenberg_safari = await loadSafariDriver();
// await gutenbergRo.runTests(driver_gutenberg_safari, ['jquery']);

const driver_tonedear_safari = await loadSafariDriver();
await tonedearTests.runTests(driver_tonedear_safari, ['jquery']);
9 changes: 5 additions & 4 deletions tests/e2e/spec/gutenberg_ro.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ const gutenbergRoBaseFile = BROWSERSTACK ? '/tests/zims/gutenberg-ro/gutenberg_r
* Run the tests
* @param {WebDriver} driver Selenium WebDriver object
* @param {Array} modes Array of modes to run the tests in
* @param {boolean} keepDriver Whether to keep the driver open after the tests have run
* @returns {Promise<void>} A Promise for the completion of the tests
*/
function runTests (driver, modes) {
function runTests (driver, modes, keepDriver) {
let browserName, browserVersion;
driver.getCapabilities().then(function (caps) {
browserName = caps.get('browserName');
Expand Down Expand Up @@ -180,7 +181,7 @@ function runTests (driver, modes) {
} else {
// Skip remaining SW mode tests if the browser does not support the SW API
console.log('\x1b[33m%s\x1b[0m', ' Skipping SW mode tests because browser does not support API');
await driver.quit();
if (!keepDriver) await driver.quit();
}
// Disable source verification in SW mode as the dialogue box gave incosistent test results in automated tests
if (mode === 'serviceworker') {
Expand Down Expand Up @@ -397,8 +398,8 @@ function runTests (driver, modes) {
assert.ok(downloadFileStatus);

// exit if every test and mode is completed
if (mode === modes[modes.length - 1]) {
return driver.quit();
if (mode === modes[modes.length - 1] && !keepDriver) {
await driver.quit();
}
});
});
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/spec/legacy-ray_charles.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ console.log('\nLoading archive:\n' + rayCharlesAllParts + '\n');
* Run the tests
* @param {WebDriver} driver Selenium WebDriver object
* @param {array} modes Array of modes to run the tests in
* @param {boolean} keepDriver Whether to keep the driver open after the tests have run
* @returns {Promise<void>} A Promise for the completion of the tests
*/
function runTests (driver, modes) {
function runTests (driver, modes, keepDriver) {
let browserName, browserVersion;
driver.getCapabilities().then(function (caps) {
browserName = caps.get('browserName');
Expand Down Expand Up @@ -192,7 +193,7 @@ function runTests (driver, modes) {
} else {
// Skip remaining SW mode tests if the browser does not support the SW API
console.log('\x1b[33m%s\x1b[0m', ' Skipping SW mode tests because browser does not support API');
await driver.quit();
if (!keepDriver) await driver.quit();
}
// Disable source verification in SW mode as the dialogue box gave incosistent test results in automated tests
if (mode === 'serviceworker') {
Expand Down Expand Up @@ -345,7 +346,7 @@ function runTests (driver, modes) {
const title = await driver.findElement(By.id('titleHeading')).getText();
assert.equal('Ray Charles', title);
// If we have reached the last mode, quit the driver
if (mode === modes[modes.length - 1]) {
if (mode === modes[modes.length - 1] && !keepDriver) {
await driver.quit();
}
});
Expand Down
Loading
Loading