mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Capture screenshots when any test fails. Formatting and minor refactoring.
This commit is contained in:
parent
40ec0ba38d
commit
06ec901764
3 changed files with 176 additions and 131 deletions
|
@ -20,7 +20,7 @@ define(function (require) {
|
|||
var common;
|
||||
var settingsPage;
|
||||
var headerPage;
|
||||
//var url = 'http://localhost:5601';
|
||||
var scenarioManager;
|
||||
|
||||
var expectedAlertText = 'Are you sure you want to remove this index pattern?';
|
||||
return {
|
||||
|
@ -32,6 +32,39 @@ define(function (require) {
|
|||
common = new Common(this.remote);
|
||||
settingsPage = new SettingsPage(this.remote);
|
||||
headerPage = new HeaderPage(this.remote);
|
||||
scenarioManager = new ScenarioManager(url.format(config.elasticsearch));
|
||||
|
||||
},
|
||||
|
||||
beforeEach: function () {
|
||||
// start each test with an empty kibana index
|
||||
return common
|
||||
.sleep(1000)
|
||||
.then(function () {
|
||||
return scenarioManager
|
||||
.unload('emptyKibana');
|
||||
})
|
||||
.then(function () {
|
||||
return common
|
||||
.sleep(2000);
|
||||
})
|
||||
.then(function () {
|
||||
return scenarioManager
|
||||
.load('emptyKibana');
|
||||
})
|
||||
.then(function () {
|
||||
return scenarioManager
|
||||
.loadIfEmpty('logstash');
|
||||
})
|
||||
.then(function () {
|
||||
return common
|
||||
.sleep(2000);
|
||||
});
|
||||
},
|
||||
|
||||
teardown: function () {
|
||||
return scenarioManager
|
||||
.unload('logstash');
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -45,32 +78,39 @@ define(function (require) {
|
|||
.then(function () {
|
||||
return settingsPage
|
||||
.getTimeBasedEventsCheckbox()
|
||||
.isSelected();
|
||||
.isSelected()
|
||||
.then(function (selected) {
|
||||
expect(selected).to.be.ok();
|
||||
});
|
||||
})
|
||||
.then(function (selected) {
|
||||
expect(selected).to.be.ok();
|
||||
.then(function () {
|
||||
return settingsPage
|
||||
.getNameIsPatternCheckbox()
|
||||
.isSelected()
|
||||
.then(function (nameIsPatternSelected) {
|
||||
expect(nameIsPatternSelected).to.not.be.ok();
|
||||
return settingsPage
|
||||
.getIndexPatternField()
|
||||
.then(function (patternField) {
|
||||
return patternField
|
||||
.getProperty('value')
|
||||
.then(function (pattern) {
|
||||
common.log('patternField value = ' + pattern);
|
||||
expect(pattern).to.be('logstash-*');
|
||||
return settingsPage.getTimeFieldNameField()
|
||||
.isSelected()
|
||||
.then(function (timeFieldIsSelected) {
|
||||
common.log('timeField isSelected = ' + timeFieldIsSelected);
|
||||
expect(timeFieldIsSelected).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();
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -85,10 +125,10 @@ define(function (require) {
|
|||
.then(function () {
|
||||
return settingsPage
|
||||
.getCreateButton()
|
||||
.isEnabled();
|
||||
})
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.not.be.ok();
|
||||
.isEnabled()
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.not.be.ok();
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
// select a time field and check that Create button is enabled
|
||||
|
@ -98,10 +138,10 @@ define(function (require) {
|
|||
.then(function () {
|
||||
return settingsPage
|
||||
.getCreateButton()
|
||||
.isEnabled();
|
||||
})
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.be.ok();
|
||||
.isEnabled()
|
||||
.then(function (enabled) {
|
||||
expect(enabled).to.be.ok();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -120,20 +160,20 @@ define(function (require) {
|
|||
.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;
|
||||
});
|
||||
})
|
||||
// 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
|
||||
|
@ -228,90 +268,89 @@ define(function (require) {
|
|||
expect(pageText).to.be('logstash-*');
|
||||
// return
|
||||
});
|
||||
});
|
||||
})
|
||||
.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 () {
|
||||
// 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
|
||||
.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 () {
|
||||
// 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 self
|
||||
.getAlertText();
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return self
|
||||
.getAlertText()
|
||||
.then(function (alertText) {
|
||||
common.log('alertText = ' + alertText);
|
||||
expect(alertText).to.be(expectedAlertText);
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return self
|
||||
.acceptAlert();
|
||||
.clickDeletePattern();
|
||||
})
|
||||
.then(function () {
|
||||
return common.tryForTime(3000, function () {
|
||||
return self
|
||||
.getAlertText();
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
return self
|
||||
.getAlertText()
|
||||
.then(function (alertText) {
|
||||
common.log('alertText = ' + alertText);
|
||||
expect(alertText).to.be(expectedAlertText);
|
||||
});
|
||||
|
||||
})
|
||||
.then(function () {
|
||||
return self
|
||||
.acceptAlert();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -428,7 +467,7 @@ define(function (require) {
|
|||
return settingsPage
|
||||
.getFieldsTabCount()
|
||||
.then(function (tabCount) {
|
||||
common.log('fields item count = ' + tabCount); // 85
|
||||
common.log('fields item count = ' + tabCount);
|
||||
expect(tabCount).to.be('85');
|
||||
});
|
||||
})
|
||||
|
@ -463,8 +502,8 @@ define(function (require) {
|
|||
expect(pageCount.length).to.be(25);
|
||||
});
|
||||
})
|
||||
//page 2 should also have 25 items
|
||||
.then(function goPage2() {
|
||||
//page 3 should also have 25 items
|
||||
.then(function goPage3() {
|
||||
return settingsPage
|
||||
.goToPage(3);
|
||||
})
|
||||
|
@ -476,8 +515,8 @@ define(function (require) {
|
|||
expect(pageCount.length).to.be(25);
|
||||
});
|
||||
})
|
||||
//page 2 should also have 25 items
|
||||
.then(function goPage2() {
|
||||
//page 4 should also have 10 items
|
||||
.then(function goPage4() {
|
||||
return settingsPage
|
||||
.goToPage(4);
|
||||
})
|
||||
|
|
|
@ -15,6 +15,6 @@ define(function (require) {
|
|||
'test/functional/status.js',
|
||||
'test/functional/testSettings'
|
||||
],
|
||||
excludeInstrumentation: /(fixtures|node_modules)\//
|
||||
excludeInstrumentation: /^(?:tests|fixtures|node_modules)\//
|
||||
}, serverConfig);
|
||||
});
|
||||
|
|
|
@ -31,11 +31,17 @@ define(function (require) {
|
|||
throw new Error('timeout');
|
||||
}
|
||||
|
||||
return Promise.try(block).catch(function (err) {
|
||||
self.log('failed with "' + err.message + '"');
|
||||
self.log('trying again in 1/2 second');
|
||||
return Promise.delay(500).then(attempt);
|
||||
});
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.try(attempt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue