Fix tests

This commit is contained in:
Girish Ramakrishnan 2024-03-04 12:05:45 +01:00
parent aa4cdb2de9
commit ba33f68bc8
3 changed files with 610 additions and 82 deletions

670
test/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,10 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"chromedriver": "^120.0.1", "chromedriver": "^122.0.4",
"expect.js": "^0.3.1", "expect.js": "^0.3.1",
"mocha": "^10.2.0", "mocha": "^10.3.0",
"selenium-webdriver": "^4.16.0", "selenium-webdriver": "^4.18.1",
"superagent": "^8.1.2" "superagent": "^8.1.2"
} }
} }

View File

@ -67,6 +67,17 @@ describe('Application life cycle test', function () {
await waitForElement(By.xpath('//span[text()="Actions"]')); await waitForElement(By.xpath('//span[text()="Actions"]'));
} }
async function logout() {
await browser.get('https://' + app.fqdn);
await waitForElement(By.xpath('//span[text()="Actions"]'));
await browser.findElement(By.xpath('//span[text()="Actions"]')).click();
await browser.sleep(4000);
await waitForElement(By.xpath('//span[text()="Log Out"]'));
await browser.findElement(By.xpath('//span[text()="Log Out"]')).click();
await browser.sleep(4000);
await waitForElement(By.id('user'));
}
async function loadPage() { async function loadPage() {
await browser.get('https://' + app.fqdn); await browser.get('https://' + app.fqdn);
await waitForElement(By.xpath('//span[text()="Actions"]')); await waitForElement(By.xpath('//span[text()="Actions"]'));
@ -114,6 +125,7 @@ describe('Application life cycle test', function () {
it('can login', login.bind(null, username, password)); it('can login', login.bind(null, username, password));
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can add folder', addFolder);
it('can logout', logout);
it('backup app', async function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); }); it('backup app', async function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
it('restore app', async function () { it('restore app', async function () {
@ -125,6 +137,7 @@ describe('Application life cycle test', function () {
it('can login', login.bind(null, username, password)); it('can login', login.bind(null, username, password));
it('can load page', loadPage); it('can load page', loadPage);
it('can check folder', checkFolder); it('can check folder', checkFolder);
it('can logout', logout);
it('move to different location', async function () { it('move to different location', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
@ -136,6 +149,7 @@ describe('Application life cycle test', function () {
it('can login', login.bind(null, username, password)); it('can login', login.bind(null, username, password));
it('can load page', loadPage); it('can load page', loadPage);
it('can check folder', checkFolder); it('can check folder', checkFolder);
it('can logout', logout);
it('uninstall app', async function () { it('uninstall app', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
@ -151,6 +165,8 @@ describe('Application life cycle test', function () {
it('can login', login.bind(null, username, password)); it('can login', login.bind(null, username, password));
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can add folder', addFolder);
it('can logout', logout);
it('can update', async function () { it('can update', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
execSync('cloudron update --app ' + LOCATION, EXEC_ARGS); execSync('cloudron update --app ' + LOCATION, EXEC_ARGS);