Skip to content

Commit

Permalink
Test are running on all browser except firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
THEBOSS0369 committed Dec 30, 2024
1 parent 6df7bee commit 6b18ac3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/runners/firefox/firefox70.bs.runner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Builder } from 'selenium-webdriver';
import gutenbergRo from '../../spec/gutenberg_ro.e2e.spec.js';
// import tonedear from '../../spec/tonedear.e2e.spec.js';
import tonedear from '../../spec/tonedear.e2e.spec.js';
/* eslint-disable camelcase */

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

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

// Run test in SW mode only
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 tonedear.runTests(driver_tonedear_fx, ['serviceworker']);
await tonedear.runTests(driver_tonedear_fx, ['serviceworker']);
19 changes: 19 additions & 0 deletions tests/e2e/spec/tonedear.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,25 @@ function runTests (driver, modes) {
return visibility.every((isVisible) => isVisible);
}, 10000, 'No visible store images found after 30 seconds');

const androidImage = await driver.findElement(By.css('img[alt="Get it on Google Play"]'));
const iosImage = await driver.findElement(By.css('img[alt="Get the iOS app"]'));

// Wait for images to load and verify dimensions
await driver.wait(async function () {
const androidLoaded = await driver.executeScript('return arguments[0].complete && arguments[0].naturalWidth > 0 && arguments[0].naturalHeight > 0;', androidImage);
const iosLoaded = await driver.executeScript('return arguments[0].complete && arguments[0].naturalWidth > 0 && arguments[0].naturalHeight > 0;', iosImage);
return androidLoaded && iosLoaded;
}, 5000, 'Images did not load successfully');

const androidWidth = await driver.executeScript('return arguments[0].naturalWidth;', androidImage);
const androidHeight = await driver.executeScript('return arguments[0].naturalHeight;', androidImage);

const iosWidth = await driver.executeScript('return arguments[0].naturalWidth;', iosImage);
const iosHeight = await driver.executeScript('return arguments[0].naturalHeight;', iosImage);

assert.ok(androidWidth > 0 && androidHeight > 0, 'Android image has valid dimensions');
assert.ok(iosWidth > 0 && iosHeight > 0, 'iOS image has valid dimensions');

// Switch back to the main content after finishing the checks
await driver.switchTo().defaultContent();
} catch (err) {
Expand Down

0 comments on commit 6b18ac3

Please sign in to comment.