From 6f63008dd3f2387e7a0e57534abee5dd138766f8 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 18 Jan 2024 11:47:58 +0100 Subject: [PATCH] Fix tests --- test/test.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/test.js b/test/test.js index 5f3be72..5f4a2dc 100644 --- a/test/test.js +++ b/test/test.js @@ -19,8 +19,6 @@ const execSync = require('child_process').execSync, { Builder, By, Key, until } = require('selenium-webdriver'), { Options } = require('selenium-webdriver/chrome'); -const rl = readlinePromises.createInterface({ input: process.stdin, output: process.stdout }); - if (!process.env.USERNAME || !process.env.PASSWORD || !process.env.EMAIL) { console.log('USERNAME, EMAIL and PASSWORD env vars need to be set'); process.exit(1); @@ -131,16 +129,19 @@ describe('Application life cycle test', function () { if (error) return; // sometimes it doesn't appear, maybe it's cached in local storage await browser.findElement(By.xpath('//a[contains(text(), "Configure my instance")]')).click(); // this opens a new window - let say_cmd = await getOS() == "Darwin" ? "say" : "spd-say"; + const say_cmd = await getOS() == "Darwin" ? "say" : "spd-say"; execSync(`${say_cmd} "Close the newly opened configuration tab."`); + const rl = readlinePromises.createInterface({ input: process.stdin, output: process.stdout }); await rl.question('Is tab closed? '); } async function uploadVideo() { - browser.get('https://' + app.fqdn + '/videos/upload'); - await browser.sleep(2000); - await browser.findElement(By.xpath('//input[@id="videofile" and @type="file"]')).sendKeys(path.resolve(__dirname, './Cloudron Test Video.mp4')); + await browser.get(`https://${app.fqdn}/videos/upload#upload`); + await browser.sleep(3000); + await browser.wait(until.elementLocated(By.id('videofile')), TEST_TIMEOUT); // do not do element visible check . it fails, no clue why + await browser.findElement(By.id('videofile')).sendKeys(path.resolve(__dirname, './Cloudron Test Video.mp4')); + console.log('waiting 10 seconds for upload'); await browser.sleep(10000); // wait for upload await waitForElement(By.xpath('//div[@class="submit-container"]//span[text()="Publish"]'));