Skip to content

Commit

Permalink
[FIX] zim not loading in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabhg71 committed Oct 19, 2023
1 parent 9eb511d commit 1ebf46e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/e2e/spec/gutenberg_ro.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ function runTests (driver, modes) {
const archiveFiles = await driver.findElement(By.id('archiveFiles'));
if (!isFileLoaded) await archiveFiles.sendKeys(gutenbergRoBaseFile);
filesLength = await driver.executeScript('return document.getElementById("archiveFiles").files.length');

// In new browsers Files are loaded using the FileSystem API, so we have to set the local archives using JavaScript
// which were selected using the file input
await driver.executeScript('window.setLocalArchiveFromFileSelect();');
// Check that we loaded 1 file
assert.equal(1, filesLength);
} else {
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/spec/legacy-ray_charles.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ function runTests (driver, modes) {
filesLength = await driver.executeScript('return document.getElementById("archiveFiles").files.length');
return filesLength === 15;
}, 5000);
// In new browsers Files are loaded using the FileSystem API, so we have to set the local archives using JavaScript
// which were selected using the file input
await driver.executeScript('window.setLocalArchiveFromFileSelect();');
// Check that we loaded 15 files
assert.equal(15, filesLength);
} else {
Expand Down
1 change: 1 addition & 0 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,7 @@ function archiveReadyCallback (archive) {
function setLocalArchiveFromFileSelect () {
setLocalArchiveFromFileList(document.getElementById('archiveFiles').files);
}
window.setLocalArchiveFromFileSelect = setLocalArchiveFromFileSelect;

/**
* Reads a remote archive with given URL, and returns the response in a Promise.
Expand Down

0 comments on commit 1ebf46e

Please sign in to comment.