|
@@ -33,6 +33,7 @@ describe('Application life cycle test', function () {
|
|
|
var app;
|
|
|
var username = process.env.USERNAME;
|
|
|
var password = process.env.PASSWORD;
|
|
|
+ var TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 5000;
|
|
|
var email, token;
|
|
|
|
|
|
before(function (done) {
|
|
@@ -58,7 +59,7 @@ describe('Application life cycle test', function () {
|
|
|
browser.findElement(by.id('user_login')).sendKeys(username);
|
|
|
browser.findElement(by.id('user_pass')).sendKeys(password);
|
|
|
browser.findElement(by.tagName('form')).submit();
|
|
|
- browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), 4000).then(function () { done(); });
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//h1[text()="Dashboard"]')), TIMEOUT).then(function () { done(); });
|
|
|
}
|
|
|
|
|
|
xit('build app', function () {
|
|
@@ -112,21 +113,21 @@ describe('Application life cycle test', function () {
|
|
|
it('can login', login);
|
|
|
|
|
|
it('is an admin dashboard', function (done) {
|
|
|
- browser.wait(until.elementLocated(by.xpath('//div[@class="wp-menu-name" and contains(text(), "Plugins")]')), 4000).then(function () { done(); });
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//div[@class="wp-menu-name" and contains(text(), "Plugins")]')), TIMEOUT).then(function () { done(); });
|
|
|
});
|
|
|
|
|
|
it('can edit', function (done) {
|
|
|
browser.get('https://' + app.fqdn + '/wp-admin/post.php?post=1&action=edit');
|
|
|
- browser.wait(until.elementLocated(by.xpath('//input[@id="title"]')), 4000);
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//input[@id="title"]')), TIMEOUT);
|
|
|
browser.findElement(by.xpath('//input[@id="title"]')).sendKeys(Key.chord(Key.CONTROL, 'a'));
|
|
|
browser.findElement(by.xpath('//input[@id="title"]')).sendKeys('Hello Cloudron!');
|
|
|
browser.findElement(by.xpath('//input[@id="publish"]')).click();
|
|
|
- browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "Post updated.")]')), 4000).then(function () { done(); });
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "Post updated.")]')), TIMEOUT).then(function () { done(); });
|
|
|
});
|
|
|
|
|
|
it('can upload media', function (done) {
|
|
|
browser.get('https://' + app.fqdn + '/wp-admin/media-new.php?browser-uploader');
|
|
|
- browser.wait(until.elementLocated(by.id('async-upload')), 4000);
|
|
|
+ browser.wait(until.elementLocated(by.id('async-upload')), TIMEOUT);
|
|
|
browser.findElement(by.xpath('//input[@id="async-upload" and @type="file"]')).sendKeys(path.resolve(__dirname, '../icon.png'));
|
|
|
browser.findElement(by.id('html-upload')).click();
|
|
|
|
|
@@ -134,14 +135,14 @@ describe('Application life cycle test', function () {
|
|
|
return browser.getCurrentUrl().then(function (url) {
|
|
|
return url === 'https://' + app.fqdn + '/wp-admin/upload.php';
|
|
|
});
|
|
|
- }, 4000).then(function () { done(); });
|
|
|
+ }, TIMEOUT).then(function () { done(); });
|
|
|
});
|
|
|
|
|
|
var mediaLink;
|
|
|
|
|
|
it('can see media', function (done) {
|
|
|
browser.get('https://' + app.fqdn + '/wp-admin/upload.php?item=5'); // there's got to be a better way..
|
|
|
- browser.wait(until.elementLocated(by.xpath('//*[text()="Attachment Details"]')), 4000);
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//*[text()="Attachment Details"]')), TIMEOUT);
|
|
|
browser.findElement(by.xpath('//img[@class="details-image"]')).getAttribute('src').then(function (srcLink) {
|
|
|
console.log('media is located at ', srcLink);
|
|
|
mediaLink = srcLink;
|