mirror of
https://git.cloudron.io/cloudron/freshrss-app
synced 2025-09-29 08:13:24 +00:00
Fix test
This commit is contained in:
23
test/test.js
23
test/test.js
@@ -119,25 +119,18 @@ describe('Application life cycle test', function () {
|
||||
await waitForElement(By.xpath('//div[@id="notification" and contains(@class, "good")]'));
|
||||
}
|
||||
|
||||
async function addUser(username, password, relogin = true) {
|
||||
await browser.get(`${baseUrl()}/i/?c=user&a=manage`);
|
||||
async function enableApi(relogin = true) {
|
||||
await browser.get(`${baseUrl()}/i/?c=auth`);
|
||||
|
||||
if (relogin) {
|
||||
// needs a relogin for admin confirmation
|
||||
await waitForElement(By.id('passwordPlain'));
|
||||
await browser.findElement(By.id('passwordPlain')).sendKeys(admin_password);
|
||||
await browser.findElement(By.id('loginButton')).click();
|
||||
await browser.sleep(3000);
|
||||
console.log('Clicking the login button');
|
||||
await browser.findElement(By.xpath('//button[contains(.,"Login")]')).click();
|
||||
}
|
||||
|
||||
await waitForElement(By.id('new_user_name'));
|
||||
await browser.findElement(By.id('new_user_name')).sendKeys(username);
|
||||
await browser.findElement(By.id('new_user_passwordPlain')).sendKeys(password);
|
||||
await browser.findElement(By.xpath('//button[text()="Create"]')).click();
|
||||
await waitForElement(By.xpath('//div[@id="notification" and contains(@class, "good")]'));
|
||||
}
|
||||
|
||||
async function enableApi() {
|
||||
await browser.get(`${baseUrl()}/i/?c=auth`);
|
||||
await waitForElement(By.id('api_enabled'));
|
||||
await browser.findElement(By.id('api_enabled')).click();
|
||||
await browser.findElement(By.xpath('//button[text()="Submit"]')).click();
|
||||
@@ -171,8 +164,7 @@ describe('Application life cycle test', function () {
|
||||
|
||||
it('can login', login.bind(null, admin_username, admin_password));
|
||||
it('can subscribe', addSubscription);
|
||||
it('can add users', addUser.bind(null, 'test', admin_password));
|
||||
it('can enable API', enableApi);
|
||||
it('can enable API', enableApi.bind(null, true /* relogin */));
|
||||
it('can check configuration', checkApiConfiguration);
|
||||
it('subscription exists', subscriptionExists);
|
||||
it('can get static extension file', getStaticExtensionFile);
|
||||
@@ -187,7 +179,7 @@ describe('Application life cycle test', function () {
|
||||
it('can make user Administrator', function () { execSync(`cloudron exec --app ${app.id} -- bash -c "php cli/reconfigure.php --default-user ${USERNAME}"`); });
|
||||
it('can login OIDC', loginOIDC.bind(null, USERNAME, PASSWORD));
|
||||
it('can subscribe', addSubscription);
|
||||
it('can enable API', enableApi);
|
||||
it('can enable API', enableApi.bind(null, false /* relogin */));
|
||||
it('can check configuration', checkApiConfiguration);
|
||||
it('subscription exists', subscriptionExists);
|
||||
it('can get static extension file', getStaticExtensionFile);
|
||||
@@ -237,7 +229,6 @@ describe('Application life cycle test', function () {
|
||||
expect(app).to.be.an('object');
|
||||
});
|
||||
|
||||
it('can add users', addUser.bind(null, 'test', admin_password, false));
|
||||
it('subscription exists', subscriptionExists);
|
||||
it('can get static extension file', getStaticExtensionFile);
|
||||
|
||||
|
Reference in New Issue
Block a user