Add device record for proper testing
This commit is contained in:
24
test/test.js
24
test/test.js
@@ -29,6 +29,8 @@ describe('Application life cycle test', function () {
|
||||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||
const ADMIN_USERNAME = 'admin'; // the login form is called email but accepts usernames
|
||||
const ADMIN_PASSWORD = 'admin';
|
||||
const DEVICE_NAME = 'FancyDevice';
|
||||
const DEVICE_IDENTIFIER = 'device1';
|
||||
|
||||
var browser, app;
|
||||
|
||||
@@ -74,11 +76,27 @@ describe('Application life cycle test', function () {
|
||||
await waitForElement(By.xpath('//input[@name="email"]'));
|
||||
}
|
||||
|
||||
async function addDevice() {
|
||||
await browser.get(`https://${app.fqdn}/settings/device`);
|
||||
await waitForElement(By.id(':r3:'));
|
||||
await browser.findElement(By.id(':r3:')).sendKeys(DEVICE_NAME);
|
||||
await browser.findElement(By.id(':r4:')).sendKeys(DEVICE_IDENTIFIER);
|
||||
await browser.findElement(By.xpath('//button[text()="Save"]')).click();
|
||||
await waitForElement(By.xpath(`//span[text()="${DEVICE_NAME}"]`));
|
||||
}
|
||||
|
||||
async function deviceExists() {
|
||||
await browser.get(`https://${app.fqdn}`);
|
||||
await waitForElement(By.xpath(`//span[text()="${DEVICE_NAME}"]`));
|
||||
}
|
||||
|
||||
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
||||
it('install app', function () { execSync(`cloudron install --location ${LOCATION}`, EXEC_ARGS); });
|
||||
|
||||
it('can get app information', getAppInfo);
|
||||
it('can login as admin', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('can add device', addDevice);
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
// Email through LDAP is not supported, needs fixing
|
||||
@@ -91,6 +109,7 @@ describe('Application life cycle test', function () {
|
||||
it('can restart app', function () { execSync(`cloudron restart --app ${app.id}`); });
|
||||
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('backup app', function () { execSync(`cloudron backup create --app ${app.id}`, EXEC_ARGS); });
|
||||
@@ -103,6 +122,7 @@ describe('Application life cycle test', function () {
|
||||
});
|
||||
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('move to different location', async function () {
|
||||
@@ -113,6 +133,7 @@ describe('Application life cycle test', function () {
|
||||
|
||||
it('can get app information', getAppInfo);
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('uninstall app', async function () {
|
||||
@@ -125,11 +146,14 @@ describe('Application life cycle test', function () {
|
||||
it('can install app', function () { execSync(`cloudron install --appstore-id org.traccar.cloudronapp --location ${LOCATION}`, EXEC_ARGS); });
|
||||
it('can get app information', getAppInfo);
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('can add device', addDevice);
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('can update', function () { execSync(`cloudron update --app ${app.id}`, EXEC_ARGS); });
|
||||
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('can login as normal user with username', login.bind(null, process.env.USERNAME, process.env.PASSWORD));
|
||||
|
Reference in New Issue
Block a user