diff --git a/test/test.js b/test/test.js index a4f59d7..4648829 100644 --- a/test/test.js +++ b/test/test.js @@ -54,55 +54,26 @@ describe('Application life cycle test', function () { await browser.findElement(By.id('accessKey')).sendKeys(accessKey); await browser.findElement(By.id('secretKey')).sendKeys(secretKey); await browser.findElement(By.xpath('//button[contains(text(), "Login")]')).click(); - await waitForElement(By.xpath('//h4[contains(text(), "Dashboard")]')); - } - - 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..."]')); + await waitForElement(By.xpath('//h4[contains(text(), "Buckets")]')); } async function logout() { 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 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() { - await browser.get(`https://${app.fqdn}/`); - await waitForElement(By.xpath('//div/span[contains(text(), "Bucket")]')); - await browser.findElement(By.xpath('//div/span[contains(text(), "Bucket")]')).click(); - await waitForElement(By.xpath('//button[text()="Create Bucket"]')); - await browser.findElement(By.xpath('//button[text()="Create Bucket"]')).click(); + await browser.get(`https://${app.fqdn}/buckets`); + await waitForElement(By.xpath('//button/span[text()="Create Bucket"]')); + await browser.findElement(By.xpath('//button/span[text()="Create Bucket"]')).click(); await browser.sleep(2000); await browser.findElement(By.xpath('//input[@id="bucket-name"]')).sendKeys(BUCKET); await browser.findElement(By.xpath('//button[text()="Create Bucket"]')).click(); 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() { await browser.get(`https://${app.fqdn}/buckets`); 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 get app information', getAppInfo); - it('can login', old_login.bind(null, 'minioadmin', 'minioadmin')); - it('can add buckets', old_addBucket); - it('can logout', old_logout); + it('can login', login.bind(null, 'minioadmin', 'minioadmin')); + it('can add buckets', addBucket); + it('can logout', logout); 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 get app information', getAppInfo);