Skip to content

Commit

Permalink
New test
Browse files Browse the repository at this point in the history
  • Loading branch information
THEBOSS0369 committed Nov 17, 2024
1 parent f1c5ec1 commit 66aeef5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/runners/firefox/firefox.e2e.runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ 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
// 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();
const driver_for_tonedear = await loadFirefoxDriver();

await legacyRayCharles.runTests(driver_for_ray_charles);
await gutenbergRo.runTests(driver_for_gutenberg);
Expand Down
31 changes: 31 additions & 0 deletions tests/e2e/spec/tonedear.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,37 @@ function runTests (driver, modes) {
}
});

it('Navigate to "Android & iOS App"', async function () {
if (!serviceWorkerAPI) {
console.log('\x1b[33m%s\x1b[0m', ' - Following test skipped:');
this.skip();
}

// Switch to iframe if necessary (adjust based on your app's structure)
await driver.switchTo().frame('articleContent'); // Adjust this if your app uses a different iframe

// Wait until the index has loaded
await driver.wait(async function () {
const contentAvailable = await driver.executeScript('return document.getElementById("mw-content-text");');
return contentAvailable;
}, 20000);

// Locate the Android & iOS App link using a specific XPath
const appLink = await driver.wait(until.elementLocated(By.xpath("//ul[contains(@class, 'navbar-nav navbar-right')]/li[1]/a")), 20000); // Adjusted XPath

// Ensure it's visible before clicking
await driver.wait(until.elementIsVisible(appLink), 20000);

// Click the link to navigate
await appLink.click();

// Optionally, wait for a moment to allow navigation to complete
await driver.sleep(1000);

// Switch back to default content if needed
await driver.switchTo().defaultContent();
});

it('Verify Android and iOS store images in ' + (mode === 'jquery' ? 'Restricted' : 'ServiceWorker') + ' mode', async function () {
if (!serviceWorkerAPI && mode === 'jquery') {
// Restricted mode test for data URIs
Expand Down

0 comments on commit 66aeef5

Please sign in to comment.