Fix tests

This commit is contained in:
Girish Ramakrishnan 2024-01-18 11:47:58 +01:00
parent f97551091d
commit 6f63008dd3

View file

@ -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"]'));