mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Intial functional test automation files
This commit is contained in:
parent
10b7e0bfb1
commit
9980741406
3 changed files with 233 additions and 0 deletions
90
test/functional/settingsDefaults.js
Normal file
90
test/functional/settingsDefaults.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
// Kibana is loading. Give me a moment here. I'm loading a whole bunch of code. Don't worry, all this good stuff will be cached up for next time!
|
||||
//http://localhost:5601/app/kibana#/settings/indices/?_g=%28refreshInterval:%28display:Off,pause:!f,value:0%29,time:%28from:now-15m,mode:quick,to:now%29%29
|
||||
//http://localhost:5601/app/kibana#/settings/indices/?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-15m,mode:quick,to:now))
|
||||
// long timeout if ElasticSearch isn't running...
|
||||
|
||||
|
||||
define([
|
||||
'intern!object',
|
||||
'intern/chai!assert',
|
||||
'intern/dojo/node!fs',
|
||||
'../support/pages/SettingsPage'
|
||||
], function (registerSuite, assert, fs, SettingsPage) {
|
||||
|
||||
registerSuite(function () {
|
||||
var settingsPage;
|
||||
var url = 'http://localhost:5601';
|
||||
return {
|
||||
// on setup, we create an settingsPage instance
|
||||
// that we will use for all the tests
|
||||
setup: function () {
|
||||
// curl -XDELETE http://localhost:9200/.kibana
|
||||
settingsPage = new SettingsPage(this.remote);
|
||||
},
|
||||
|
||||
/*
|
||||
** Test the default state of checboxes and the 2 text input fields
|
||||
*/
|
||||
'testSettingsInitialState': function () {
|
||||
return this.remote
|
||||
.get(url)
|
||||
.then(function () {
|
||||
return settingsPage
|
||||
.getTimeBasedEventsCheckbox()
|
||||
.isSelected()
|
||||
.then(function (selected) {
|
||||
assert.strictEqual(selected, true, 'Expected the Index contains time-based events to be checked');
|
||||
return settingsPage.getNameIsPatternCheckbox()
|
||||
.isSelected()
|
||||
.then(function (nameIsPatternSelected) {
|
||||
assert.strictEqual(nameIsPatternSelected, false, 'Expected the Name Is Pattern checkbox to not be checked');
|
||||
return settingsPage.getIndexPatternField()
|
||||
.getAttribute('value')
|
||||
.then(function (pattern) {
|
||||
// not getting the value
|
||||
// assert.strictEqual(pattern, 'logstash-*', 'Expected
|
||||
// pattern logstash-*');
|
||||
return settingsPage.getTimeFieldNameField()
|
||||
.getVisibleText()
|
||||
.then(function (timeField) {
|
||||
assert.strictEqual(timeField, '@timestamp', 'Expected Time-field name @timestamp');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/*
|
||||
** Test that unchecking the Time-based Events checkbox hides the Name is pattern checkbox
|
||||
*/
|
||||
'testSettingsCheckboxHide': function () {
|
||||
return this.remote
|
||||
.get('http://localhost:5601')
|
||||
.then(function () {
|
||||
return settingsPage
|
||||
.getTimeBasedEventsCheckbox()
|
||||
.then(function (selected) {
|
||||
// uncheck the 'time-based events' checkbox
|
||||
return selected.click();
|
||||
})
|
||||
.then(function () {
|
||||
return settingsPage.getNameIsPatternCheckbox();
|
||||
})
|
||||
.then(function (selected1) {
|
||||
assert.strictEqual(
|
||||
true, false, 'Did not expect to find the Name is Pattern checkbox when the TimeBasedEvents checkbox is unchecked'
|
||||
);
|
||||
})
|
||||
.catch(function (reason) {
|
||||
// We expect to find an element not found exception. Check the reason string for the message.
|
||||
assert.strictEqual(
|
||||
reason.toString().indexOf('Unable to locate element') > 0, true, 'Expected to not find Name Is Pattern checkbox'
|
||||
);
|
||||
return;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
94
test/intern.js
Normal file
94
test/intern.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
// Learn more about configuring this file at <https://theintern.github.io/intern/#configuration>.
|
||||
// These default settings work OK for most people. The options that *must* be changed below are the
|
||||
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites
|
||||
define({
|
||||
|
||||
// The port on which the instrumenting proxy will listen
|
||||
proxyPort: 9000,
|
||||
|
||||
// A fully qualified URL to the Intern proxy
|
||||
proxyUrl: 'http://localhost:9000/',
|
||||
|
||||
|
||||
// Default desired capabilities for all environments. Individual capabilities can be overridden by any of the
|
||||
// specified browser environments in the `environments` array below as well. See
|
||||
// <https://theintern.github.io/intern/#option-capabilities> for links to the different capabilities options for
|
||||
// different services.
|
||||
//
|
||||
// Note that the `build` capability will be filled in with the current commit ID or build tag from the CI
|
||||
// environment automatically
|
||||
capabilities: {
|
||||
'selenium-version': '2.45.0',
|
||||
'idle-timeout': 30
|
||||
|
||||
//'browserstack.selenium_version': '2.45.0'
|
||||
},
|
||||
|
||||
// Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce
|
||||
// OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other
|
||||
// capabilities options specified for an environment will be copied as-is
|
||||
environments: [
|
||||
/*{ browserName: 'internet explorer', version: '11', platform: 'WIN8' },
|
||||
{ browserName: 'internet explorer', version: '10', platform: 'WIN8' },
|
||||
{ browserName: 'internet explorer', version: '9', platform: 'WINDOWS' },
|
||||
{ browserName: 'firefox', version: '37', platform: [ 'WINDOWS', 'MAC' ] },
|
||||
{ browserName: 'chrome', version: '39', platform: [ 'WINDOWS', 'MAC' ] },
|
||||
{ browserName: 'safari', version: '8', platform: 'MAC' } */
|
||||
// {
|
||||
// browserName: 'chrome'
|
||||
// },
|
||||
{
|
||||
browserName: 'firefox'
|
||||
}
|
||||
],
|
||||
|
||||
// Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service
|
||||
maxConcurrency: 1,
|
||||
|
||||
// Whether or not to start Sauce Connect before running tests
|
||||
useSauceConnect: false,
|
||||
|
||||
|
||||
// Name of the tunnel class to use for WebDriver tests.
|
||||
// See <https://theintern.github.io/intern/#option-tunnel> for built-in options
|
||||
//tunnel: 'BrowserStackTunnel',
|
||||
|
||||
// Connection information for the remote WebDriver service. If using Sauce Labs, keep your username and password
|
||||
// in the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables unless you are sure you will NEVER be
|
||||
// publishing this configuration file somewhere
|
||||
webdriver: {
|
||||
host: 'localhost',
|
||||
port: 4444
|
||||
},
|
||||
|
||||
|
||||
// Configuration options for the module loader; any AMD configuration options supported by the AMD loader in use
|
||||
// can be used here.
|
||||
// If you want to use a different loader than the default loader, see
|
||||
// <https://theintern.github.io/intern/#option-useLoader> for instruction
|
||||
loaderOptions: {
|
||||
// Packages that should be registered with the loader in each testing environment
|
||||
// packages: [ { name: 'myPackage', location: '.' } ]
|
||||
|
||||
packages: [{
|
||||
name: 'intern-selftest',
|
||||
location: '.'
|
||||
}],
|
||||
map: {
|
||||
'intern-selftest': {
|
||||
dojo: 'intern-selftest/node_modules/dojo'
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Non-functional test suite(s) to run in each browser
|
||||
suites: [ /* 'tests/unit/hello' 'myPackage/tests/foo', 'myPackage/tests/bar' */ ],
|
||||
|
||||
// Functional test suite(s) to execute against each browser once non-functional tests are completed
|
||||
// functionalSuites: ['test/functional/settingsDefaults' /* 'myPackage/tests/functional' */ ],
|
||||
functionalSuites: ['test/functional/testHeaderNav' /* 'myPackage/tests/functional' */ ],
|
||||
|
||||
// A regular expression matching URLs to files that should not be included in code coverage analysis
|
||||
excludeInstrumentation: /^(?:tests|node_modules)\//
|
||||
});
|
49
test/support/pages/SettingsPage.js
Normal file
49
test/support/pages/SettingsPage.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
// in test/support/pages/SettingsPage.js
|
||||
define(function (require) {
|
||||
// the page object is created as a constructor
|
||||
// so we can provide the remote Command object
|
||||
// at runtime
|
||||
function SettingsPage(remote) {
|
||||
this.remote = remote;
|
||||
}
|
||||
|
||||
SettingsPage.prototype = {
|
||||
constructor: SettingsPage,
|
||||
|
||||
getTimeBasedEventsCheckbox: function () {
|
||||
return this.remote
|
||||
.setFindTimeout(5000)
|
||||
.findByXpath('//input[@ng-model=\'index.isTimeBased\']');
|
||||
},
|
||||
|
||||
getNameIsPatternCheckbox: function () {
|
||||
return this.remote
|
||||
.setFindTimeout(2000)
|
||||
.findByXpath('//input[@ng-model=\'index.nameIsPattern\']');
|
||||
},
|
||||
|
||||
getIndexPatternField: function () {
|
||||
return this.remote
|
||||
.setFindTimeout(5000)
|
||||
//findElement(By.name("name")).getAttribute("value") (from Selenium IDE -> Java)
|
||||
.findByName('name');
|
||||
},
|
||||
|
||||
getTimeFieldNameField: function () {
|
||||
return this.remote
|
||||
.findByXpath(
|
||||
'//body[@id=\'kibana-body\']/div[2]/div/kbn-settings-app/div/div/kbn-settings-indices/div[2]/div/div[2]/form/div[3]/select'
|
||||
);
|
||||
},
|
||||
|
||||
getCreateButton: function () {
|
||||
return this.remote
|
||||
.findByCssSelector('.btn');
|
||||
}
|
||||
|
||||
|
||||
// …additional page interaction tasks…
|
||||
};
|
||||
|
||||
return SettingsPage;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue