Corrected indentation. No code changes.

This commit is contained in:
LeeDr 2015-10-29 15:32:33 -05:00 committed by Joe Fleming
parent cb7ae4f738
commit a07ced84a2
3 changed files with 566 additions and 567 deletions

View file

@ -35,26 +35,26 @@ define(function (require) {
// start each test with an empty kibana index
return scenarioManager.reload('emptyKibana')
// and load a minimal set of makelogs data
.then(function loadIfEmptyMakelogs() {
return scenarioManager.loadIfEmpty('makelogs');
})
.then(function () {
return common.tryForTime(25000, function () {
return remote.get(url.format(_.assign(config.kibana, {
pathname: ''
})))
.then(function () {
return common.sleep(2000);
})
.then(function () {
return remote.getCurrentUrl()
.then(function (currentUrl) {
expect(currentUrl).to.contain('settings');
});
// and load a minimal set of makelogs data
.then(function loadIfEmptyMakelogs() {
return scenarioManager.loadIfEmpty('makelogs');
})
.then(function () {
return common.tryForTime(25000, function () {
return remote.get(url.format(_.assign(config.kibana, {
pathname: ''
})))
.then(function () {
return common.sleep(2000);
})
.then(function () {
return remote.getCurrentUrl()
.then(function (currentUrl) {
expect(currentUrl).to.contain('settings');
});
});
});
});
},
teardown: function unloadMakelogs() {
@ -68,36 +68,35 @@ define(function (require) {
var testSubName = 'testSettingsInitialState';
return settingsPage.getTimeBasedEventsCheckbox().isSelected()
.then(function (selected) {
expect(selected).to.be.ok();
})
.then(function () {
return settingsPage.getNameIsPatternCheckbox().isSelected()
.then(function (nameIsPatternSelected) {
expect(nameIsPatternSelected).to.not.be.ok();
});
})
.then(function () {
return settingsPage.getIndexPatternField()
.then(function (patternField) {
return patternField.getProperty('value')
.then(function (pattern) {
common.log('patternField value = ' + pattern);
expect(pattern).to.be('logstash-*');
});
});
})
.then(function () {
return settingsPage.getTimeFieldNameField().isSelected()
.then(function (timeFieldIsSelected) {
common.log('timeField isSelected = ' + timeFieldIsSelected);
expect(timeFieldIsSelected).to.not.be.ok();
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
.then(function (selected) {
expect(selected).to.be.ok();
})
.then(function () {
return settingsPage.getNameIsPatternCheckbox().isSelected()
.then(function (nameIsPatternSelected) {
expect(nameIsPatternSelected).to.not.be.ok();
});
})
.then(function () {
return settingsPage.getIndexPatternField()
.then(function (patternField) {
return patternField.getProperty('value')
.then(function (pattern) {
common.log('patternField value = ' + pattern);
expect(pattern).to.be('logstash-*');
});
});
})
.then(function () {
return settingsPage.getTimeFieldNameField().isSelected()
.then(function (timeFieldIsSelected) {
common.log('timeField isSelected = ' + timeFieldIsSelected);
expect(timeFieldIsSelected).to.not.be.ok();
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
},
/*
@ -107,23 +106,23 @@ define(function (require) {
var testSubName = 'testCreateButtonDisabledUntilTimeFieldSelected';
return settingsPage.getCreateButton().isEnabled()
.then(function (enabled) {
expect(enabled).to.not.be.ok();
})
.then(function () {
// select a time field and check that Create button is enabled
return settingsPage
.selectTimeFieldOption('@timestamp');
})
.then(function () {
return settingsPage.getCreateButton().isEnabled()
.then(function (enabled) {
expect(enabled).to.not.be.ok();
})
.then(function () {
// select a time field and check that Create button is enabled
return settingsPage
.selectTimeFieldOption('@timestamp');
})
.then(function () {
return settingsPage.getCreateButton().isEnabled()
.then(function (enabled) {
expect(enabled).to.be.ok();
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
expect(enabled).to.be.ok();
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
},
@ -134,23 +133,23 @@ define(function (require) {
var testSubName = 'testSettingsCheckboxHide';
return settingsPage.getTimeBasedEventsCheckbox()
.then(function (selected) {
// uncheck the 'time-based events' checkbox
return selected.click();
})
// try to find the name is pattern checkbox (shouldn't find it)
.then(function () {
return settingsPage.getNameIsPatternCheckbox();
})
.then(function (selected1) {
expect(
true, false, 'Did not expect to find the Name is Pattern checkbox when the TimeBasedEvents checkbox is unchecked'
);
})
.catch(function (reason) {
// it's OK. We expected not to find the getNameIsPatternCheckbox.
return;
});
.then(function (selected) {
// uncheck the 'time-based events' checkbox
return selected.click();
})
// try to find the name is pattern checkbox (shouldn't find it)
.then(function () {
return settingsPage.getNameIsPatternCheckbox();
})
.then(function (selected1) {
expect(
true, false, 'Did not expect to find the Name is Pattern checkbox when the TimeBasedEvents checkbox is unchecked'
);
})
.catch(function (reason) {
// it's OK. We expected not to find the getNameIsPatternCheckbox.
return;
});
},
// Index pattern field list
@ -159,290 +158,123 @@ define(function (require) {
// select a time field and then Create button
return settingsPage.selectTimeFieldOption('@timestamp')
.then(function () {
return settingsPage.getCreateButton().click();
.then(function () {
return settingsPage.getCreateButton().click();
})
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
common.log(getIndexPageHeading.getVisibleText());
})
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
common.log(getIndexPageHeading.getVisibleText());
})
.then(function () {
// delete the index pattern
return common.tryForTime(3000, function () {
return settingsPage.clickDeletePattern();
});
})
.then(function () {
return common.tryForTime(3000, function () {
return remote.getAlertText();
});
})
.then(function () {
return remote.acceptAlert();
})
// getting the current URL which shows 'logstash-*' pattern
.then(function () {
return remote.getCurrentUrl()
.then(function (currentUrl) {
common.log('currentUrl = ' + currentUrl);
});
})
// pollUntil we find the Create button
.then(pollUntil(function (value) {
var element = document.getElementsByClassName('btn-success')[0];
return element ? element : null;
}, ['Configure an index pattern'], 8000))
.then(function () {
common.log('success');
})
// getting the current URL which no longer includes 'logstash-*'
.then(function () {
return remote.getCurrentUrl()
.then(function (currentUrl) {
common.log('currentUrl = ' + currentUrl);
});
});
// delete the index pattern
return common.tryForTime(3000, function () {
return settingsPage.clickDeletePattern();
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
.then(function () {
return common.tryForTime(3000, function () {
return remote.getAlertText();
});
})
.then(function () {
return remote.acceptAlert();
})
// getting the current URL which shows 'logstash-*' pattern
.then(function () {
return remote.getCurrentUrl()
.then(function (currentUrl) {
common.log('currentUrl = ' + currentUrl);
});
})
// pollUntil we find the Create button
.then(pollUntil(function (value) {
var element = document.getElementsByClassName('btn-success')[0];
return element ? element : null;
}, ['Configure an index pattern'], 8000))
.then(function () {
common.log('success');
})
// getting the current URL which no longer includes 'logstash-*'
.then(function () {
return remote.getCurrentUrl()
.then(function (currentUrl) {
common.log('currentUrl = ' + currentUrl);
});
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
},
testIndexPatternResultsHeader: function () {
var testSubName = 'testIndexPatternResultsHeader';
return settingsPage.selectTimeFieldOption('@timestamp')
.then(function () {
return settingsPage.getCreateButton().click();
})
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
return getIndexPageHeading.getVisibleText()
.then(function (pageText) {
expect(pageText).to.be('logstash-*');
});
});
})
.then(function () {
return settingsPage.getTableHeader()
.then(function (header) {
common.log('header.length = ' + header.length); // 6 name type format analyzed indexed controls
expect(header.length).to.be(6);
return header[0].getVisibleText()
.then(function (text) {
common.log('header[0] = ' + text); // name
expect(text).to.be('name');
return header;
});
})
.then(function (header) {
return header[1].getVisibleText()
.then(function (text) {
common.log('header[1] = ' + text);
expect(text).to.be('type');
return header;
});
})
.then(function (header) {
return header[2].getVisibleText()
.then(function (text) {
common.log('header[2] = ' + text);
expect(text).to.be('format');
return header;
});
})
.then(function (header) {
return header[3].getVisibleText()
.then(function (text) {
common.log('header[3] = ' + text);
expect(text).to.be('analyzed');
return header;
});
})
.then(function (header) {
return header[4].getVisibleText()
.then(function (text) {
common.log('header[4] = ' + text);
expect(text).to.be('indexed');
return header;
});
})
.then(function (header) {
return header[5].getVisibleText()
.then(function (text) {
common.log('header[5] = ' + text);
expect(text).to.be('controls');
return header;
});
})
.then(function () {
return common.tryForTime(3000, function () {
// delete the index pattern -X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X
return settingsPage.clickDeletePattern();
});
})
.then(function () {
return common.tryForTime(3000, function () {
return remote.getAlertText();
});
})
.then(function () {
return remote.getAlertText()
.then(function (alertText) {
common.log('alertText = ' + alertText);
expect(alertText).to.be(expectedAlertText);
});
})
.then(function () {
return remote.acceptAlert();
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
.then(function () {
return settingsPage.getCreateButton().click();
})
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
return getIndexPageHeading.getVisibleText()
.then(function (pageText) {
expect(pageText).to.be('logstash-*');
});
});
},
testIndexPatternResultsSort: function () {
var testSubName = 'testIndexPatternResultsSort';
return settingsPage.selectTimeFieldOption('@timestamp')
.then(function () {
return settingsPage.getCreateButton().click();
})
.then(function () {
return settingsPage.getTableHeader()
.then(function (header) {
common.log('header.length = ' + header.length); // 6 name type format analyzed indexed controls
expect(header.length).to.be(6);
return header[0].getVisibleText()
.then(function (text) {
common.log('header[0] = ' + text); // name
expect(text).to.be('name');
return header;
});
})
// check the page header to make sure we see logstash-*
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
return getIndexPageHeading.getVisibleText()
.then(function (pageText) {
expect(pageText).to.be('logstash-*');
// return
});
});
.then(function (header) {
return header[1].getVisibleText()
.then(function (text) {
common.log('header[1] = ' + text);
expect(text).to.be('type');
return header;
});
})
// Sort by Name
.then(function sortByName() {
return settingsPage.sortBy('name');
.then(function (header) {
return header[2].getVisibleText()
.then(function (text) {
common.log('header[2] = ' + text);
expect(text).to.be('format');
return header;
});
})
// check name sort
.then(function sortAgain() {
return settingsPage.getTableRow(0, 0)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
//common.log('After name-sort first row first column = ' + rowText);
expect(rowText).to.be('@message');
});
});
.then(function (header) {
return header[3].getVisibleText()
.then(function (text) {
common.log('header[3] = ' + text);
expect(text).to.be('analyzed');
return header;
});
})
// Sort by Name again
.then(function sortByName2() {
return settingsPage.sortBy('name');
.then(function (header) {
return header[4].getVisibleText()
.then(function (text) {
common.log('header[4] = ' + text);
expect(text).to.be('indexed');
return header;
});
})
// check name sort
.then(function sortAgain2() {
return settingsPage.getTableRow(0, 0)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
//common.log('After name-sort first row first column = ' + rowText);
expect(rowText).to.be('xss.raw');
});
});
})
// Sort by type
.then(function sortByType() {
return settingsPage.sortBy('type');
})
// check type sort
.then(function checksort() {
return settingsPage.getTableRow(0, 1)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
//common.log('After type-sort first row first column = ' + rowText);
expect(rowText).to.be('_source');
});
});
})
// Sort by type again
.then(function sortByType2() {
return settingsPage.sortBy('type');
})
// check type sort
.then(function checksort2() {
return settingsPage.getTableRow(0, 1)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
common.log('After type-sort first row first column = ' + rowText);
expect(rowText).to.be('string');
});
});
})
// Sort by type again (this time it "unsorts it")
.then(function sortByType2() {
return settingsPage.sortBy('type');
})
// check pagination
.then(function getFieldsTabCount() {
return settingsPage.getFieldsTabCount()
.then(function (tabCount) {
common.log('fields item count = ' + tabCount);
expect(tabCount).to.be('85');
});
})
// verify the page size is 25
.then(function checkPageSize() {
return settingsPage.getPageSize()
.then(function (pageSize) {
expect(pageSize).to.be('25');
});
})
// we know with 25 fields per page and 85 fields there should be 4 pages.
// the first page should have 25 items on it.
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 1 count = ' + pageCount.length);
expect(pageCount.length).to.be(25);
});
})
//page 2 should also have 25 items
.then(function goPage2() {
return settingsPage.goToPage(2);
})
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 2 count = ' + pageCount.length);
expect(pageCount.length).to.be(25);
});
})
//page 3 should also have 25 items
.then(function goPage3() {
return settingsPage.goToPage(3);
})
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 3 count = ' + pageCount.length);
expect(pageCount.length).to.be(25);
});
})
//page 4 should also have 10 items
.then(function goPage4() {
return settingsPage.goToPage(4);
})
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 4 count = ' + pageCount.length);
expect(pageCount.length).to.be(10);
});
.then(function (header) {
return header[5].getVisibleText()
.then(function (text) {
common.log('header[5] = ' + text);
expect(text).to.be('controls');
return header;
});
})
.then(function () {
return common.tryForTime(3000, function () {
@ -457,17 +289,184 @@ define(function (require) {
})
.then(function () {
return remote.getAlertText()
.then(function (alertText) {
common.log('alertText = ' + alertText);
expect(alertText).to.be(expectedAlertText);
});
.then(function (alertText) {
common.log('alertText = ' + alertText);
expect(alertText).to.be(expectedAlertText);
});
})
.then(function () {
return remote.acceptAlert();
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
},
testIndexPatternResultsSort: function () {
var testSubName = 'testIndexPatternResultsSort';
return settingsPage.selectTimeFieldOption('@timestamp')
.then(function () {
return settingsPage.getCreateButton().click();
})
// check the page header to make sure we see logstash-*
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
return getIndexPageHeading.getVisibleText()
.then(function (pageText) {
expect(pageText).to.be('logstash-*');
// return
});
});
})
// Sort by Name
.then(function sortByName() {
return settingsPage.sortBy('name');
})
// check name sort
.then(function sortAgain() {
return settingsPage.getTableRow(0, 0)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
//common.log('After name-sort first row first column = ' + rowText);
expect(rowText).to.be('@message');
});
});
})
// Sort by Name again
.then(function sortByName2() {
return settingsPage.sortBy('name');
})
// check name sort
.then(function sortAgain2() {
return settingsPage.getTableRow(0, 0)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
//common.log('After name-sort first row first column = ' + rowText);
expect(rowText).to.be('xss.raw');
});
});
})
// Sort by type
.then(function sortByType() {
return settingsPage.sortBy('type');
})
// check type sort
.then(function checksort() {
return settingsPage.getTableRow(0, 1)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
//common.log('After type-sort first row first column = ' + rowText);
expect(rowText).to.be('_source');
});
});
})
// Sort by type again
.then(function sortByType2() {
return settingsPage.sortBy('type');
})
// check type sort
.then(function checksort2() {
return settingsPage.getTableRow(0, 1)
.then(function (row) {
return row.getVisibleText()
.then(function (rowText) {
common.log('After type-sort first row first column = ' + rowText);
expect(rowText).to.be('string');
});
});
})
// Sort by type again (this time it "unsorts it")
.then(function sortByType2() {
return settingsPage.sortBy('type');
})
// check pagination
.then(function getFieldsTabCount() {
return settingsPage.getFieldsTabCount()
.then(function (tabCount) {
common.log('fields item count = ' + tabCount);
expect(tabCount).to.be('85');
});
})
// verify the page size is 25
.then(function checkPageSize() {
return settingsPage.getPageSize()
.then(function (pageSize) {
expect(pageSize).to.be('25');
});
})
// we know with 25 fields per page and 85 fields there should be 4 pages.
// the first page should have 25 items on it.
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 1 count = ' + pageCount.length);
expect(pageCount.length).to.be(25);
});
})
//page 2 should also have 25 items
.then(function goPage2() {
return settingsPage.goToPage(2);
})
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 2 count = ' + pageCount.length);
expect(pageCount.length).to.be(25);
});
})
//page 3 should also have 25 items
.then(function goPage3() {
return settingsPage.goToPage(3);
})
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 3 count = ' + pageCount.length);
expect(pageCount.length).to.be(25);
});
})
//page 4 should also have 10 items
.then(function goPage4() {
return settingsPage.goToPage(4);
})
.then(function getPageFieldCount() {
return settingsPage.getPageFieldCount()
.then(function (pageCount) {
common.log('Page 4 count = ' + pageCount.length);
expect(pageCount.length).to.be(10);
});
})
.then(function () {
return common.tryForTime(3000, function () {
// delete the index pattern -X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X
return settingsPage.clickDeletePattern();
});
})
.then(function () {
return common.tryForTime(3000, function () {
return remote.getAlertText();
});
})
.then(function () {
return remote.getAlertText()
.then(function (alertText) {
common.log('alertText = ' + alertText);
expect(alertText).to.be(expectedAlertText);
});
})
.then(function () {
return remote.acceptAlert();
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
},
@ -475,108 +474,108 @@ define(function (require) {
var testSubName = 'testIndexPatternPopularity';
return settingsPage.selectTimeFieldOption('@timestamp')
.then(function () {
return settingsPage.getCreateButton().click();
})
// check the page header to make sure we see logstash-*
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
return getIndexPageHeading.getVisibleText()
.then(function (pageText) {
expect(pageText).to.be('logstash-*');
// return
});
});
})
.then(function () {
return settingsPage.setPageSize('All');
})
// increase Popularity
.then(function openControlsByName() {
return settingsPage.openControlsByName('geo.coordinates');
})
.then(function increasePopularity() {
return settingsPage.increasePopularity();
})
.then(function getPopularity() {
return settingsPage.getPopularity()
.then(function (popularity) {
common.log('popularity = ' + popularity);
expect(popularity).to.be('1');
});
})
// Cancel saving the popularity change
.then(function controlChangeCancel() {
return settingsPage.controlChangeCancel();
})
// set the page size to All again, https://github.com/elastic/kibana/issues/5030
.then(function () {
return settingsPage.setPageSize('All');
})
.then(function openControlsByName() {
return settingsPage.openControlsByName('geo.coordinates');
})
// check that its 0 (previous increase was cancelled)
.then(function getPopularity() {
return settingsPage.getPopularity()
.then(function (popularity) {
common.log('popularity = ' + popularity);
expect(popularity).to.be('0');
});
})
.then(function increasePopularity() {
return settingsPage.increasePopularity();
})
// Saving the popularity change
.then(function controlChangeSave() {
return settingsPage.controlChangeSave();
})
// set the page size to All again, https://github.com/elastic/kibana/issues/5030
.then(function () {
return settingsPage.setPageSize('All');
})
// open it again to see that it saved
.then(function openControlsByName() {
return settingsPage.openControlsByName('geo.coordinates');
})
// check that its 0 (previous increase was cancelled)
.then(function getPopularity() {
return settingsPage.getPopularity()
.then(function (popularity) {
common.log('popularity = ' + popularity);
expect(popularity).to.be('1');
});
})
// Cancel saving the popularity change (we didn't make a change in this case, just checking the value)
.then(function controlChangeCancel() {
return settingsPage.controlChangeCancel();
})
// should this test go to discover page and verify the Popular field?
.then(function () {
return common.tryForTime(3000, function () {
// delete the index pattern
return settingsPage.clickDeletePattern();
.then(function () {
return settingsPage.getCreateButton().click();
})
// check the page header to make sure we see logstash-*
.then(function () {
return settingsPage.getIndexPageHeading()
.then(function (getIndexPageHeading) {
return getIndexPageHeading.getVisibleText()
.then(function (pageText) {
expect(pageText).to.be('logstash-*');
// return
});
})
.then(function () {
return common.tryForTime(3000, function () {
return remote.getAlertText();
});
})
.then(function () {
return remote.getAlertText()
.then(function (alertText) {
common.log('alertText = ' + alertText);
expect(alertText).to.be(expectedAlertText);
});
})
.then(function () {
return remote.acceptAlert();
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
})
.then(function () {
return settingsPage.setPageSize('All');
})
// increase Popularity
.then(function openControlsByName() {
return settingsPage.openControlsByName('geo.coordinates');
})
.then(function increasePopularity() {
return settingsPage.increasePopularity();
})
.then(function getPopularity() {
return settingsPage.getPopularity()
.then(function (popularity) {
common.log('popularity = ' + popularity);
expect(popularity).to.be('1');
});
})
// Cancel saving the popularity change
.then(function controlChangeCancel() {
return settingsPage.controlChangeCancel();
})
// set the page size to All again, https://github.com/elastic/kibana/issues/5030
.then(function () {
return settingsPage.setPageSize('All');
})
.then(function openControlsByName() {
return settingsPage.openControlsByName('geo.coordinates');
})
// check that its 0 (previous increase was cancelled)
.then(function getPopularity() {
return settingsPage.getPopularity()
.then(function (popularity) {
common.log('popularity = ' + popularity);
expect(popularity).to.be('0');
});
})
.then(function increasePopularity() {
return settingsPage.increasePopularity();
})
// Saving the popularity change
.then(function controlChangeSave() {
return settingsPage.controlChangeSave();
})
// set the page size to All again, https://github.com/elastic/kibana/issues/5030
.then(function () {
return settingsPage.setPageSize('All');
})
// open it again to see that it saved
.then(function openControlsByName() {
return settingsPage.openControlsByName('geo.coordinates');
})
// check that its 0 (previous increase was cancelled)
.then(function getPopularity() {
return settingsPage.getPopularity()
.then(function (popularity) {
common.log('popularity = ' + popularity);
expect(popularity).to.be('1');
});
})
// Cancel saving the popularity change (we didn't make a change in this case, just checking the value)
.then(function controlChangeCancel() {
return settingsPage.controlChangeCancel();
})
// should this test go to discover page and verify the Popular field?
.then(function () {
return common.tryForTime(3000, function () {
// delete the index pattern
return settingsPage.clickDeletePattern();
});
})
.then(function () {
return common.tryForTime(3000, function () {
return remote.getAlertText();
});
})
.then(function () {
return remote.getAlertText()
.then(function (alertText) {
common.log('alertText = ' + alertText);
expect(alertText).to.be(expectedAlertText);
});
})
.then(function () {
return remote.acceptAlert();
})
.catch(function screenshotError(reason) {
return common.screenshotError(testSubName, reason);
});
}

View file

@ -29,16 +29,16 @@ define(function (require) {
}
return Promise
.try(block)
.then(function tryForTimeSuccess() {
self.log('tryForTime success in about ' + (lastTry - start) + ' milliseconds');
return (lastTry - start);
})
.catch(function tryForTimeCatch(err) {
self.log('failed with "' + err.message + '"');
self.log('trying again in 1/2 second');
return Promise.delay(500).then(attempt);
});
.try(block)
.then(function tryForTimeSuccess() {
self.log('tryForTime success in about ' + (lastTry - start) + ' milliseconds');
return (lastTry - start);
})
.catch(function tryForTimeCatch(err) {
self.log('failed with "' + err.message + '"');
self.log('trying again in 1/2 second');
return Promise.delay(500).then(attempt);
});
}
return Promise.try(attempt);
@ -68,10 +68,10 @@ define(function (require) {
var filename = './screenshot-' + testSubName + '-ERROR-' + now + '.png';
self.log('Test Failed, taking screenshot "' + filename + '"');
return self.remote.takeScreenshot()
.then(function writeScreenshot(data) {
fs.writeFileSync(filename, data);
throw new Error(reason);
});
.then(function writeScreenshot(data) {
fs.writeFileSync(filename, data);
throw new Error(reason);
});
}
};

View file

@ -19,214 +19,214 @@ define(function (require) {
getTimeBasedEventsCheckbox: function getTimeBasedEventsCheckbox() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('input[ng-model="index.isTimeBased"]');
.findByCssSelector('input[ng-model="index.isTimeBased"]');
},
getNameIsPatternCheckbox: function getNameIsPatternCheckbox() {
// fail faster since we're sometimes checking that it doesn't exist
return this.remote.setFindTimeout(defaultTimeout / 2)
.findByCssSelector('input[ng-model="index.nameIsPattern"]');
.findByCssSelector('input[ng-model="index.nameIsPattern"]');
},
getIndexPatternField: function getIndexPatternField() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('[ng-model="index.name"]');
.findByCssSelector('[ng-model="index.name"]');
},
getTimeFieldNameField: function getTimeFieldNameField() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('select[ng-model="index.timeField"]');
.findByCssSelector('select[ng-model="index.timeField"]');
},
selectTimeFieldOption: function selectTimeFieldOption(selection) {
var self = this;
return this.getTimeFieldNameField().click()
.then(function () {
return self.getTimeFieldNameField().click();
})
.then(function () {
return self.getTimeFieldOption(selection);
});
.then(function () {
return self.getTimeFieldNameField().click();
})
.then(function () {
return self.getTimeFieldOption(selection);
});
},
getTimeFieldOption: function getTimeFieldOption(selection) {
return this.remote.setFindTimeout(defaultTimeout * 2)
.findByCssSelector('option[label="' + selection + '"]').click();
.findByCssSelector('option[label="' + selection + '"]').click();
},
getCreateButton: function getCreateButton() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('.btn');
.findByCssSelector('.btn');
},
clickCreateButton: function clickCreateButton() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('.btn').click();
.findByCssSelector('.btn').click();
},
clickDefaultIndexButton: function clickDefaultIndexButton() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('button.btn.btn-warning.ng-scope').click();
.findByCssSelector('button.btn.btn-warning.ng-scope').click();
},
clickDeletePattern: function clickDeletePattern() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('button.btn.btn-danger.ng-scope').click();
.findByCssSelector('button.btn.btn-danger.ng-scope').click();
},
getIndexPageHeading: function getIndexPageHeading() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('h1.title.ng-binding.ng-isolate-scope');
.findByCssSelector('h1.title.ng-binding.ng-isolate-scope');
},
getConfigureHeader: function getConfigureHeader() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('h1');
.findByCssSelector('h1');
},
getTableHeader: function getTableHeader() {
return this.remote.setFindTimeout(defaultTimeout)
.findAllByCssSelector('table.table.table-condensed thead tr th');
.findAllByCssSelector('table.table.table-condensed thead tr th');
},
sortBy: function sortBy(columnName) {
return this.remote.setFindTimeout(defaultTimeout)
.findAllByCssSelector('table.table.table-condensed thead tr th span')
.then(function (chartTypes) {
.findAllByCssSelector('table.table.table-condensed thead tr th span')
.then(function (chartTypes) {
function getChartType(chart) {
return chart.getVisibleText()
.then(function (chartString) {
if (chartString === columnName) {
return chart.click();
}
});
}
var getChartTypesPromises = chartTypes.map(getChartType);
return Promise.all(getChartTypesPromises);
});
function getChartType(chart) {
return chart.getVisibleText()
.then(function (chartString) {
if (chartString === columnName) {
return chart.click();
}
});
}
var getChartTypesPromises = chartTypes.map(getChartType);
return Promise.all(getChartTypesPromises);
});
},
getTableRow: function getTableRow(rowNumber, colNumber) {
return this.remote.setFindTimeout(defaultTimeout)
// passing in zero-based index, but adding 1 for css 1-based indexes
.findByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr:nth-child(' +
(rowNumber + 1) + ') td.ng-scope:nth-child(' +
(colNumber + 1) + ') span.ng-binding'
);
// passing in zero-based index, but adding 1 for css 1-based indexes
.findByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr:nth-child(' +
(rowNumber + 1) + ') td.ng-scope:nth-child(' +
(colNumber + 1) + ') span.ng-binding'
);
},
getFieldsTabCount: function getFieldsTabCount() {
return this.remote.setFindTimeout(defaultTimeout)
// passing in zero-based index, but adding 1 for css 1-based indexes
.findByCssSelector('li.kbn-settings-tab.ng-scope.active a.ng-binding small.ng-binding')
.then(function (tabData) {
return tabData.getVisibleText()
.then(function (theText) {
// the value has () around it, remove them
return theText.replace(/\((.*)\)/, '$1');
});
.findByCssSelector('li.kbn-settings-tab.ng-scope.active a.ng-binding small.ng-binding')
.then(function (tabData) {
return tabData.getVisibleText()
.then(function (theText) {
// the value has () around it, remove them
return theText.replace(/\((.*)\)/, '$1');
});
});
},
getPageSize: function getPageSize() {
var selectedItemLabel = '';
return this.remote.setFindTimeout(defaultTimeout)
.findAllByCssSelector('select.ng-pristine.ng-valid.ng-untouched option')
.then(function (chartTypes) {
.findAllByCssSelector('select.ng-pristine.ng-valid.ng-untouched option')
.then(function (chartTypes) {
function getChartType(chart) {
var thisChart = chart;
return chart.isSelected()
.then(function (isSelected) {
if (isSelected === true) {
return thisChart.getProperty('label')
.then(function (theLabel) {
selectedItemLabel = theLabel;
});
}
function getChartType(chart) {
var thisChart = chart;
return chart.isSelected()
.then(function (isSelected) {
if (isSelected === true) {
return thisChart.getProperty('label')
.then(function (theLabel) {
selectedItemLabel = theLabel;
});
}
var getChartTypesPromises = chartTypes.map(getChartType);
return Promise.all(getChartTypesPromises);
})
.then(function () {
return selectedItemLabel;
});
}
});
}
var getChartTypesPromises = chartTypes.map(getChartType);
return Promise.all(getChartTypesPromises);
})
.then(function () {
return selectedItemLabel;
});
},
getPageFieldCount: function getPageFieldCount() {
return this.remote.setFindTimeout(defaultTimeout)
.findAllByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr td.ng-scope:nth-child(1) span.ng-binding');
.findAllByCssSelector('div.agg-table-paginated table.table.table-condensed tbody tr td.ng-scope:nth-child(1) span.ng-binding');
},
goToPage: function goToPage(pageNum) {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('ul.pagination-other-pages-list.pagination-sm.ng-scope li.ng-scope:nth-child(' +
(pageNum + 1) + ') a.ng-binding'
)
.then(function (page) {
return page.click();
});
.findByCssSelector('ul.pagination-other-pages-list.pagination-sm.ng-scope li.ng-scope:nth-child(' +
(pageNum + 1) + ') a.ng-binding'
)
.then(function (page) {
return page.click();
});
},
openControlsRow: function openControlsRow(row) {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('table.table.table-condensed tbody tr:nth-child(' +
(row + 1) + ') td.ng-scope div.actions a.btn.btn-xs.btn-default i.fa.fa-pencil'
)
.then(function (page) {
return page.click();
});
.findByCssSelector('table.table.table-condensed tbody tr:nth-child(' +
(row + 1) + ') td.ng-scope div.actions a.btn.btn-xs.btn-default i.fa.fa-pencil'
)
.then(function (page) {
return page.click();
});
},
openControlsByName: function openControlsByName(name) {
return this.remote.setFindTimeout(defaultTimeout * 2)
.findByCssSelector('div.actions a.btn.btn-xs.btn-default[href$="/' + name + '"]')
.then(function (button) {
return button.click();
});
.findByCssSelector('div.actions a.btn.btn-xs.btn-default[href$="/' + name + '"]')
.then(function (button) {
return button.click();
});
},
increasePopularity: function increasePopularity() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('button.btn.btn-default[aria-label="Plus"]')
.then(function (button) {
return button.click();
});
.findByCssSelector('button.btn.btn-default[aria-label="Plus"]')
.then(function (button) {
return button.click();
});
},
getPopularity: function getPopularity() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('input.form-control.ng-pristine.ng-valid.ng-untouched.ng-valid-number')
.then(function (input) {
return input.getProperty('value');
});
.findByCssSelector('input.form-control.ng-pristine.ng-valid.ng-untouched.ng-valid-number')
.then(function (input) {
return input.getProperty('value');
});
},
controlChangeCancel: function controlChangeCancel() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('button.btn.btn-primary[aria-label="Cancel"]')
.then(function (button) {
return button.click();
});
.findByCssSelector('button.btn.btn-primary[aria-label="Cancel"]')
.then(function (button) {
return button.click();
});
},
controlChangeSave: function controlChangeSave() {
return this.remote.setFindTimeout(defaultTimeout)
.findByCssSelector('button.btn.btn-success.ng-binding[aria-label="Update Field"]')
.then(function (button) {
return button.click();
});
.findByCssSelector('button.btn.btn-success.ng-binding[aria-label="Update Field"]')
.then(function (button) {
return button.click();
});
},
setPageSize: function setPageSize(size) {
return this.remote
.setFindTimeout(defaultTimeout)
.findByCssSelector('form.form-inline.pagination-size.ng-scope.ng-pristine.ng-valid div.form-group option[label="' + size + '"]')
.then(function (button) {
return button.click();
});
.setFindTimeout(defaultTimeout)
.findByCssSelector('form.form-inline.pagination-size.ng-scope.ng-pristine.ng-valid div.form-group option[label="' + size + '"]')
.then(function (button) {
return button.click();
});
}
<<<<<<< HEAD
=======