Fix tests for UI changes

This commit is contained in:
Girish Ramakrishnan 2022-01-30 10:19:09 -08:00
parent ce95621eb4
commit c0a34431df
1 changed files with 8 additions and 37 deletions

View File

@ -54,55 +54,26 @@ describe('Application life cycle test', function () {
await browser.findElement(By.id('accessKey')).sendKeys(accessKey); await browser.findElement(By.id('accessKey')).sendKeys(accessKey);
await browser.findElement(By.id('secretKey')).sendKeys(secretKey); await browser.findElement(By.id('secretKey')).sendKeys(secretKey);
await browser.findElement(By.xpath('//button[contains(text(), "Login")]')).click(); await browser.findElement(By.xpath('//button[contains(text(), "Login")]')).click();
await waitForElement(By.xpath('//h4[contains(text(), "Dashboard")]')); await waitForElement(By.xpath('//h4[contains(text(), "Buckets")]'));
}
async function old_login(accessKey='minioadmin', secretKey='minioadmin') {
await browser.get(`https://${app.fqdn}/minio/login`);
await waitForElement(By.id('accessKey'));
await browser.findElement(By.id('accessKey')).sendKeys(accessKey);
await browser.findElement(By.id('secretKey')).sendKeys(secretKey);
await browser.findElement(By.xpath('//button[@type="submit"]')).click();
await waitForElement(By.xpath('//input[@placeholder="Search Buckets..."]'));
} }
async function logout() { async function logout() {
await browser.get(`https://${app.fqdn}/`); await browser.get(`https://${app.fqdn}/`);
await waitForElement(By.xpath('//div/span[contains(text(), "Dashboard")]')); await waitForElement(By.xpath('//h4[contains(text(), "Buckets")]'));
await browser.findElement(By.xpath('//div/span[contains(text(), "Logout")]')).click(); await browser.findElement(By.xpath('//div/span[contains(text(), "Logout")]')).click();
await waitForElement(By.id('accessKey')); await waitForElement(By.id('accessKey'));
} }
async function old_logout() {
await browser.get(`https://${app.fqdn}/`);
await waitForElement(By.xpath('//input[@placeholder="Search Buckets..."]'));
await browser.findElement(By.xpath('//div/button[@id="top-right-menu"]')).click();
await browser.findElement(By.xpath('//ul/li/a[@id="logout"]')).click();
await waitForElement(By.id('accessKey'));
}
async function addBucket() { async function addBucket() {
await browser.get(`https://${app.fqdn}/`); await browser.get(`https://${app.fqdn}/buckets`);
await waitForElement(By.xpath('//div/span[contains(text(), "Bucket")]')); await waitForElement(By.xpath('//button/span[text()="Create Bucket"]'));
await browser.findElement(By.xpath('//div/span[contains(text(), "Bucket")]')).click(); await browser.findElement(By.xpath('//button/span[text()="Create Bucket"]')).click();
await waitForElement(By.xpath('//button[text()="Create Bucket"]'));
await browser.findElement(By.xpath('//button[text()="Create Bucket"]')).click();
await browser.sleep(2000); await browser.sleep(2000);
await browser.findElement(By.xpath('//input[@id="bucket-name"]')).sendKeys(BUCKET); await browser.findElement(By.xpath('//input[@id="bucket-name"]')).sendKeys(BUCKET);
await browser.findElement(By.xpath('//button[text()="Create Bucket"]')).click(); await browser.findElement(By.xpath('//button[text()="Create Bucket"]')).click();
await waitForElement(By.xpath(`//a[contains(text(), "${BUCKET}")]`)); await waitForElement(By.xpath(`//a[contains(text(), "${BUCKET}")]`));
} }
async function old_addBucket() {
await browser.get(`https://${app.fqdn}/`);
await waitForElement(By.xpath('//input[@placeholder="Search Buckets..."]'));
await browser.findElement(By.xpath('//div/button[@id="fe-action-toggle"]')).click();
await browser.findElement(By.xpath('//ul/a[@id="show-make-bucket"]')).click();
await browser.findElement(By.xpath('//input[@placeholder="Bucket Name"]')).sendKeys(BUCKET);
await browser.findElement(By.xpath('//*[@class="modal-body"]/form')).submit();
await waitForElement(By.xpath(`//*[@class="main"]/a[text()="${BUCKET}"]`));
}
async function checkBucket() { async function checkBucket() {
await browser.get(`https://${app.fqdn}/buckets`); await browser.get(`https://${app.fqdn}/buckets`);
await waitForElement(By.xpath(`//h1[contains(text(), "${BUCKET}")]`)); await waitForElement(By.xpath(`//h1[contains(text(), "${BUCKET}")]`));
@ -182,9 +153,9 @@ describe('Application life cycle test', function () {
it('can install app', function () { execSync('cloudron install --appstore-id io.minio.cloudronapp --location ' + LOCATION, EXEC_ARGS); }); it('can install app', function () { execSync('cloudron install --appstore-id io.minio.cloudronapp --location ' + LOCATION, EXEC_ARGS); });
it('can get app information', getAppInfo); it('can get app information', getAppInfo);
it('can login', old_login.bind(null, 'minioadmin', 'minioadmin')); it('can login', login.bind(null, 'minioadmin', 'minioadmin'));
it('can add buckets', old_addBucket); it('can add buckets', addBucket);
it('can logout', old_logout); it('can logout', logout);
it('can update', function () { execSync(`cloudron update --app ${LOCATION}`, EXEC_ARGS); }); it('can update', function () { execSync(`cloudron update --app ${LOCATION}`, EXEC_ARGS); });
it('can configure', function () { execSync(`cloudron configure --app ${LOCATION} --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS); }); it('can configure', function () { execSync(`cloudron configure --app ${LOCATION} --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS); });
it('can get app information', getAppInfo); it('can get app information', getAppInfo);