[ftr] wrap remote in browser service (#26394)

* [pageObjects/common] remove unused runScript method

* [pageObjects/common] remove almost unused doesCssSelectorExist method

* [pageObjects/graph] convert to use find/testSubjects services

* [pageObjects/discover] refactor out remote service

* [pageObjects/pointSeries] refactor out remote service

* [pageObjects/monitoring] refactor out remote service

* [ftr] refactor uses of remote to use browser or find

* [ftr/services/remote] wrap remote with browser service

* [pageObjects/security] refactor out uses of remote

* [ftr/services/browser] isolate element calls to find

* [ftr] rename remote service to __leadfoot__

* [ftr/leadfoot] cleanup some renames in find, keep names in other tests
This commit is contained in:
Spencer 2018-11-29 14:30:47 -08:00 committed by GitHub
parent d46eaf9903
commit 50be0d888e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 727 additions and 705 deletions

View file

@ -18,13 +18,13 @@
*/
export default function ({ getService, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
describe('console app', function () {
this.tags('ciGroup1');
before(async function () {
await remote.setWindowSize(1300, 1100);
await browser.setWindowSize(1300, 1100);
});
loadTestFile(require.resolve('./_console'));

View file

@ -18,7 +18,7 @@
*/
export default function ({ getService, getPageObjects, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common']);
const kibanaServer = getService('kibanaServer');
@ -27,7 +27,7 @@ export default function ({ getService, getPageObjects, loadTestFile }) {
this.tags('ciGroup1');
before(async function () {
await remote.setWindowSize(1200, 800);
await browser.setWindowSize(1200, 800);
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('visualize');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC', 'defaultIndex': 'logstash-*',

View file

@ -22,7 +22,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['dashboard', 'header']);
const dashboardExpect = getService('dashboardExpect');
const remote = getService('remote');
const browser = getService('browser');
const log = getService('log');
const queryBar = getService('queryBar');
@ -52,7 +52,7 @@ export default function ({ getService, getPageObjects }) {
before(async function () {
await PageObjects.dashboard.initTests();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
kibanaBaseUrl = currentUrl.substring(0, currentUrl.indexOf('#'));
});
@ -61,7 +61,7 @@ export default function ({ getService, getPageObjects }) {
it('loads an unsaved dashboard', async function () {
const url = `${kibanaBaseUrl}#/dashboard?${urlQuery}`;
log.debug(`Navigating to ${url}`);
await remote.get(url, true);
await browser.get(url, true);
await PageObjects.header.waitUntilLoadingHasFinished();
const query = await queryBar.getQueryString();
@ -77,7 +77,7 @@ export default function ({ getService, getPageObjects }) {
const id = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
const url = `${kibanaBaseUrl}#/dashboard/${id}`;
await remote.get(url, true);
await browser.get(url, true);
await PageObjects.header.waitUntilLoadingHasFinished();
const query = await queryBar.getQueryString();
@ -93,7 +93,7 @@ export default function ({ getService, getPageObjects }) {
const updatedQuery = urlQuery.replace(/F9D9F9/g, '000000');
const url = `${kibanaBaseUrl}#/dashboard/${id}?${updatedQuery}`;
await remote.get(url, true);
await browser.get(url, true);
await PageObjects.header.waitUntilLoadingHasFinished();
await dashboardExpect.selectedLegendColorCount('#000000', 5);

View file

@ -26,7 +26,7 @@ import {
export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']);
const remote = getService('remote');
const browser = getService('browser');
const dashboardAddPanel = getService('dashboardAddPanel');
describe('create and add embeddables', async () => {
@ -52,7 +52,7 @@ export default function ({ getService, getPageObjects }) {
it('saves the saved visualization url to the app link', async () => {
await PageObjects.header.clickVisualize();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(VisualizeConstants.EDIT_PATH);
});

View file

@ -20,7 +20,7 @@
import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['dashboard']);
@ -38,11 +38,10 @@ export default function ({ getService, getPageObjects }) {
const panelTitleBeforeMove = await dashboardPanelActions.getPanelHeading(lastVisTitle);
const position1 = await panelTitleBeforeMove.getPosition();
remote
.moveMouseTo(panelTitleBeforeMove)
.pressMouseButton()
.moveMouseTo(null, -20, -450)
.releaseMouseButton();
await browser.moveMouseTo(panelTitleBeforeMove);
await browser.pressMouseButton();
await browser.moveMouseTo(null, -20, -450);
await browser.releaseMouseButton();
const panelTitleAfterMove = await dashboardPanelActions.getPanelHeading(lastVisTitle);
const position2 = await panelTitleAfterMove.getPosition();

View file

@ -21,7 +21,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['dashboard', 'header', 'common']);
const remote = getService('remote');
const browser = getService('browser');
describe('dashboard listing page', function describeIndexTests() {
const dashboardName = 'Dashboard Listing Test';
@ -126,11 +126,11 @@ export default function ({ getService, getPageObjects }) {
describe('search by title', function () {
it('loads a dashboard if title matches', async function () {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl + '&title=Two%20Words';
// Only works on a hard refresh.
const useTimeStamp = true;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
expect(onDashboardLandingPage).to.equal(false);
@ -138,11 +138,11 @@ export default function ({ getService, getPageObjects }) {
it('title match is case insensitive', async function () {
await PageObjects.dashboard.gotoDashboardLandingPage();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl + '&title=two%20words';
// Only works on a hard refresh.
const useTimeStamp = true;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
expect(onDashboardLandingPage).to.equal(false);
@ -150,11 +150,11 @@ export default function ({ getService, getPageObjects }) {
it('stays on listing page if title matches no dashboards', async function () {
await PageObjects.dashboard.gotoDashboardLandingPage();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl + '&title=nodashboardsnamedme';
// Only works on a hard refresh.
const useTimeStamp = true;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
@ -170,11 +170,11 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.saveDashboard('two words', { needsConfirm: true });
await PageObjects.dashboard.gotoDashboardLandingPage();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl + '&title=two%20words';
// Only works on a hard refresh.
const useTimeStamp = true;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();
@ -190,12 +190,12 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.saveDashboard('i am !@#$%^&*()_+~`,.<>{}[]; so special');
await PageObjects.dashboard.gotoDashboardLandingPage();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
// Need to encode that one.
const newUrl = currentUrl + '&title=i%20am%20%21%40%23%24%25%5E%26%2A%28%29_%2B~%60%2C.%3C%3E%7B%7D%5B%5D%3B%20so%20special';
// Only works on a hard refresh.
const useTimeStamp = true;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
await PageObjects.header.waitUntilLoadingHasFinished();
const onDashboardLandingPage = await PageObjects.dashboard.onDashboardLandingPage();

View file

@ -22,18 +22,18 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects, updateBaselines }) {
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'common']);
const screenshot = getService('screenshots');
const remote = getService('remote');
const browser = getService('browser');
const dashboardPanelActions = getService('dashboardPanelActions');
const dashboardAddPanel = getService('dashboardAddPanel');
describe('dashboard snapshots', function describeIndexTests() {
before(async function () {
// We use a really small window to minimize differences across os's and browsers.
await remote.setWindowSize(1000, 500);
await browser.setWindowSize(1000, 500);
});
after(async function () {
await remote.setWindowSize(1300, 900);
await browser.setWindowSize(1300, 900);
const id = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
await PageObjects.dashboard.deleteDashboard('area', id);
});

View file

@ -27,7 +27,7 @@ import {
export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['dashboard', 'visualize', 'header', 'discover']);
const testSubjects = getService('testSubjects');
const remote = getService('remote');
const browser = getService('browser');
const queryBar = getService('queryBar');
const retry = getService('retry');
const dashboardPanelActions = getService('dashboardPanelActions');
@ -166,21 +166,21 @@ export default function ({ getService, getPageObjects }) {
const currentQuery = await queryBar.getQueryString();
expect(currentQuery).to.equal('');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl.replace('query:%27%27', 'query:%27hi%27');
// Don't add the timestamp to the url or it will cause a hard refresh and we want to test a
// soft refresh.
await remote.get(newUrl.toString(), false);
await browser.get(newUrl.toString(), false);
const newQuery = await queryBar.getQueryString();
expect(newQuery).to.equal('hi');
});
it('for panel size parameters', async function () {
await dashboardAddPanel.addVisualization(PIE_CHART_VIS_NAME);
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const currentPanelDimensions = await PageObjects.dashboard.getPanelDimensions();
const newUrl = currentUrl.replace(`w:${DEFAULT_PANEL_WIDTH}`, `w:${DEFAULT_PANEL_WIDTH * 2}`);
await remote.get(newUrl.toString(), false);
await browser.get(newUrl.toString(), false);
await retry.try(async () => {
const newPanelDimensions = await PageObjects.dashboard.getPanelDimensions();
if (newPanelDimensions.length < 0) {
@ -196,9 +196,9 @@ export default function ({ getService, getPageObjects }) {
});
it('when removing a panel', async function () {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl.replace(/panels:\!\(.*\),query/, 'panels:!(),query');
await remote.get(newUrl.toString(), false);
await browser.get(newUrl.toString(), false);
await retry.try(async () => {
const newPanelCount = await PageObjects.dashboard.getPanelCount();
@ -211,9 +211,9 @@ export default function ({ getService, getPageObjects }) {
await dashboardAddPanel.addVisualization(PIE_CHART_VIS_NAME);
await PageObjects.visualize.openLegendOptionColors('80,000');
await PageObjects.visualize.selectNewLegendColorChoice('#F9D9F9');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl.replace('F9D9F9', 'FFFFFF');
await remote.get(newUrl.toString(), false);
await browser.get(newUrl.toString(), false);
await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async () => {
@ -238,9 +238,9 @@ export default function ({ getService, getPageObjects }) {
});
it('resets a pie slice color to the original when removed', async function () {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl.replace('vis:(colors:(%2780,000%27:%23FFFFFF))', '');
await remote.get(newUrl.toString(), false);
await browser.get(newUrl.toString(), false);
await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async () => {

View file

@ -26,7 +26,7 @@ const toTime = '2015-09-23 18:31:44.000';
export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['dashboard', 'header']);
const remote = getService('remote');
const browser = getService('browser');
describe('dashboard time', () => {
before(async function () {
@ -94,14 +94,14 @@ export default function ({ getPageObjects, getService }) {
// However, if the URL also contains time in the global state, then the global state
// time should take precedence.
it('should be overwritten by global state', async function () {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const kibanaBaseUrl = currentUrl.substring(0, currentUrl.indexOf('#'));
const id = await PageObjects.dashboard.getDashboardIdFromCurrentUrl();
await PageObjects.dashboard.gotoDashboardLandingPage();
const urlWithGlobalTime = `${kibanaBaseUrl}#/dashboard/${id}?_g=(time:(from:now-1h,mode:quick,to:now))`;
await remote.get(urlWithGlobalTime, false);
await browser.get(urlWithGlobalTime, false);
const prettyPrint = await PageObjects.header.getPrettyDuration();
expect(prettyPrint).to.equal('Last 1 hour');
});

View file

@ -22,7 +22,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const PageObjects = getPageObjects(['dashboard', 'common']);
const remote = getService('remote');
const browser = getService('browser');
describe('embed mode', async () => {
before(async () => {
@ -33,11 +33,11 @@ export default function ({ getService, getPageObjects }) {
let isChromeVisible = await PageObjects.common.isChromeVisible();
expect(isChromeVisible).to.be(true);
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl + '&embed=true';
// Embed parameter only works on a hard refresh.
const useTimeStamp = true;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
await retry.try(async () => {
isChromeVisible = await PageObjects.common.isChromeVisible();
@ -46,14 +46,14 @@ export default function ({ getService, getPageObjects }) {
});
after(async function () {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl.replace('&embed=true', '');
// First use the timestamp to cause a hard refresh so the new embed parameter works correctly.
let useTimeStamp = true;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
// Then get rid of the timestamp so the rest of the tests work with state and app switching.
useTimeStamp = false;
await remote.get(newUrl.toString(), useTimeStamp);
await browser.get(newUrl.toString(), useTimeStamp);
});
});
}

View file

@ -29,7 +29,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const find = getService('find');
const remote = getService('remote');
const browser = getService('browser');
const dashboardExpect = getService('dashboardExpect');
const dashboardAddPanel = getService('dashboardAddPanel');
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'discover']);
@ -91,9 +91,9 @@ export default function ({ getService, getPageObjects }) {
after(async () => {
// Get rid of the timestamp added in this test, as well any global or app state.
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl.replace(/\?.*$/, '');
await remote.get(newUrl, false);
await browser.get(newUrl, false);
});
it('adding visualizations', async () => {
@ -132,8 +132,8 @@ export default function ({ getService, getPageObjects }) {
});
it('data rendered correctly when dashboard is hard refreshed', async () => {
const currentUrl = await remote.getCurrentUrl();
await remote.get(currentUrl, true);
const currentUrl = await browser.getCurrentUrl();
await browser.get(currentUrl, true);
await expectAllDataRenders();
});

View file

@ -21,7 +21,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const remote = getService('remote');
const browser = getService('browser');
const dashboardPanelActions = getService('dashboardPanelActions');
const PageObjects = getPageObjects(['dashboard', 'common']);
@ -69,7 +69,7 @@ export default function ({ getService, getPageObjects }) {
it('exits when the text button is clicked on', async () => {
const logoButton = await PageObjects.dashboard.getExitFullScreenLogoButton();
await remote.moveMouseTo(logoButton);
await browser.moveMouseTo(logoButton);
await PageObjects.dashboard.clickExitFullScreenTextButton();
await retry.try(async () => {

View file

@ -26,7 +26,7 @@ import {
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const remote = getService('remote');
const browser = getService('browser');
const dashboardPanelActions = getService('dashboardPanelActions');
const dashboardAddPanel = getService('dashboardAddPanel');
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'discover']);
@ -36,7 +36,7 @@ export default function ({ getService, getPageObjects }) {
before(async function () {
await PageObjects.dashboard.initTests();
await kibanaServer.uiSettings.disableToastAutohide();
await remote.refresh();
await browser.refresh();
// This flip between apps fixes the url so state is preserved when switching apps in test mode.
// Without this flip the url in test mode looks something like
@ -79,9 +79,9 @@ export default function ({ getService, getPageObjects }) {
// Based off an actual bug encountered in a PR where a hard refresh in edit mode did not show the edit mode
// controls.
it('are shown in edit mode after a hard refresh', async () => {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
// the second parameter of true will include the timestamp in the url and trigger a hard refresh.
await remote.get(currentUrl.toString(), true);
await browser.get(currentUrl.toString(), true);
await PageObjects.header.waitUntilLoadingHasFinished();
await dashboardPanelActions.openContextMenu();
@ -89,7 +89,7 @@ export default function ({ getService, getPageObjects }) {
await dashboardPanelActions.expectExistsRemovePanelAction();
// Get rid of the timestamp in the url.
await remote.get(currentUrl.toString(), false);
await browser.get(currentUrl.toString(), false);
});
describe('on an expanded panel', function () {
@ -116,7 +116,7 @@ export default function ({ getService, getPageObjects }) {
await dashboardPanelActions.openContextMenu();
await dashboardPanelActions.clickEdit();
await PageObjects.header.waitUntilLoadingHasFinished();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(VisualizeConstants.EDIT_PATH);
});

View file

@ -18,12 +18,12 @@
*/
export default function ({ getService, loadTestFile, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['dashboard']);
async function loadCurrentData() {
await remote.setWindowSize(1300, 900);
await browser.setWindowSize(1300, 900);
await PageObjects.dashboard.initTests({
kibanaIndex: 'dashboard/current/kibana',
dataIndex: 'dashboard/current/data',
@ -75,7 +75,7 @@ export default function ({ getService, loadTestFile, getPageObjects }) {
// legacy data only for specifically testing BWC situations.
describe('using legacy data', function () {
this.tags('ciGroup4');
before(() => remote.setWindowSize(1200, 900));
before(() => browser.setWindowSize(1200, 900));
loadTestFile(require.resolve('./_dashboard_time_picker'));
loadTestFile(require.resolve('./_bwc_shared_urls'));
@ -85,7 +85,7 @@ export default function ({ getService, loadTestFile, getPageObjects }) {
describe('using legacy data', function () {
this.tags('ciGroup5');
before(() => remote.setWindowSize(1200, 900));
before(() => browser.setWindowSize(1200, 900));
loadTestFile(require.resolve('./_dashboard_save'));
loadTestFile(require.resolve('./_dashboard_time'));

View file

@ -23,7 +23,7 @@ export default function ({ getService, getPageObjects }) {
const log = getService('log');
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
const filterBar = getService('filterBar');
const PageObjects = getPageObjects(['common', 'discover', 'header']);
@ -240,7 +240,7 @@ export default function ({ getService, getPageObjects }) {
const expectedChartInterval = 'Daily';
const expectedBarChartData = [4757, 4614, 4633];
await remote.goBack();
await browser.goBack();
await retry.try(async function tryingForTime() {
const actualInterval = await PageObjects.discover.getChartInterval();
expect(actualInterval).to.be(expectedChartInterval);
@ -413,7 +413,7 @@ export default function ({ getService, getPageObjects }) {
describe('time zone switch', () => {
it('should show bars in the correct time zone after switching', async function () {
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'America/Phoenix' });
await remote.refresh();
await browser.refresh();
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
const ticks = await PageObjects.discover.getBarChartXTicks();
expect(ticks).to.eql(['2015-09-19 17:00', '2015-09-20 17:00', '2015-09-21 17:00', '2015-09-22 17:00']);

View file

@ -19,13 +19,13 @@
export default function ({ getService, loadTestFile }) {
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
describe('discover app', function () {
this.tags('ciGroup6');
before(function () {
return remote.setWindowSize(1200, 800);
return browser.setWindowSize(1200, 800);
});
after(function unloadMakelogs() {

View file

@ -18,13 +18,13 @@
*/
export default function ({ getService, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
describe('Getting Started ', function () {
this.tags('ciGroup6');
before(async function () {
await remote.setWindowSize(1200, 800);
await browser.setWindowSize(1200, 800);
});
// https://www.elastic.co/guide/en/kibana/current/tutorial-load-dataset.html
loadTestFile(require.resolve('./_shakespeare'));

View file

@ -21,7 +21,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'home']);
describe('Kibana takes you home', function describeIndexTests() {
@ -29,13 +29,13 @@ export default function ({ getService, getPageObjects }) {
it('clicking on kibana logo should take you to home page', async ()=> {
await PageObjects.common.navigateToApp('settings');
await PageObjects.home.clickKibanaIcon();
const url = await remote.getCurrentUrl();
const url = await browser.getCurrentUrl();
expect(url.includes('/app/kibana#/home')).to.be(true);
});
it('clicking on console on homepage should take you to console app', async ()=> {
await PageObjects.home.clickSynopsis('console');
const url = await remote.getCurrentUrl();
const url = await browser.getCurrentUrl();
expect(url.includes('/app/kibana#/dev_tools/console')).to.be(true);
});

View file

@ -18,13 +18,13 @@
*/
export default function ({ getService, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
describe('homepage app', function () {
this.tags('ciGroup6');
before(function () {
return remote.setWindowSize(1200, 800);
return browser.setWindowSize(1200, 800);
});
loadTestFile(require.resolve('./_home'));

View file

@ -31,7 +31,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const es = getService('es');
const retry = getService('retry');
const scriptedFiledName = 'versionConflictScript';
@ -41,7 +41,7 @@ export default function ({ getService, getPageObjects }) {
describe('index version conflict', function describeIndexTests() {
before(async function () {
await remote.setWindowSize(1200, 800);
await browser.setWindowSize(1200, 800);
await esArchiver.load('discover');
});

View file

@ -21,7 +21,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const remote = getService('remote');
const browser = getService('browser');
const log = getService('log');
const retry = getService('retry');
const PageObjects = getPageObjects(['settings', 'common']);
@ -54,7 +54,7 @@ export default function ({ getService, getPageObjects }) {
it('should have index pattern in url', function url() {
return retry.try(function tryingForTime() {
return remote.getCurrentUrl()
return browser.getCurrentUrl()
.then(function (currentUrl) {
expect(currentUrl).to.contain(indexPatternId);
});
@ -107,7 +107,7 @@ export default function ({ getService, getPageObjects }) {
it('should remove index pattern from url', function indexNotInUrl() {
// give the url time to settle
return retry.try(function tryingForTime() {
return remote.getCurrentUrl()
return browser.getCurrentUrl()
.then(function (currentUrl) {
log.debug('currentUrl = ' + currentUrl);
expect(currentUrl).to.not.contain('logstash-*');

View file

@ -35,14 +35,16 @@ export default function ({ getService, getPageObjects }) {
first: '@message',
last: 'xss.raw',
selector: async function () {
return await PageObjects.settings.getTableRow(0, 0).getVisibleText();
const tableRow = await PageObjects.settings.getTableRow(0, 0);
return await tableRow.getVisibleText();
}
}, {
heading: 'Type',
first: '_source',
last: 'string',
selector: async function () {
return await PageObjects.settings.getTableRow(0, 1).getVisibleText();
const tableRow = await PageObjects.settings.getTableRow(0, 1);
return await tableRow.getVisibleText();
}
}];

View file

@ -21,7 +21,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const remote = getService('remote');
const browser = getService('browser');
const PageObjects = getPageObjects(['settings', 'common', 'dashboard', 'header']);
describe('kibana settings', function describeIndexTests() {
@ -58,7 +58,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.header.setAbsoluteRange('2015-09-19 06:31:44.000', '2015-09-23 18:31:44.000');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const urlPieces = currentUrl.match(/(.*)?_g=(.*)&_a=(.*)/);
const globalState = urlPieces[2];
const appState = urlPieces[3];
@ -81,7 +81,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.header.setAbsoluteRange('2015-09-19 06:31:44.000', '2015-09-23 18:31:44.000');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const urlPieces = currentUrl.match(/(.*)?_g=(.*)&_a=(.*)/);
const globalState = urlPieces[2];
const appState = urlPieces[3];

View file

@ -34,7 +34,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const log = getService('log');
const remote = getService('remote');
const browser = getService('browser');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common', 'header', 'settings', 'visualize', 'discover']);
@ -42,7 +42,7 @@ export default function ({ getService, getPageObjects }) {
describe('scripted fields', () => {
before(async function () {
await remote.setWindowSize(1200, 800);
await browser.setWindowSize(1200, 800);
// delete .kibana index and then wait for Kibana to re-create it
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await PageObjects.settings.navigateTo();

View file

@ -24,14 +24,14 @@ export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
const log = getService('log');
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['settings']);
describe('filter scripted fields', function describeIndexTests() {
before(async function () {
// delete .kibana index and then wait for Kibana to re-create it
await remote.setWindowSize(1200, 800);
await browser.setWindowSize(1200, 800);
await esArchiver.load('management');
await kibanaServer.uiSettings.replace({
'dateFormat:tz': 'UTC',

View file

@ -21,13 +21,13 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const remote = getService('remote');
const browser = getService('browser');
const PageObjects = getPageObjects(['settings']);
const SCRIPTED_FIELD_NAME = 'myScriptedField';
describe('scripted fields preview', () => {
before(async function () {
await remote.setWindowSize(1200, 800);
await browser.setWindowSize(1200, 800);
// delete .kibana index and then wait for Kibana to re-create it
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
await PageObjects.settings.navigateTo();

View file

@ -18,7 +18,7 @@
*/
export default function ({ getService, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
const log = getService('log');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
@ -28,7 +28,7 @@ export default function ({ getService, loadTestFile }) {
before(async function () {
log.debug('Starting timelion before method');
remote.setWindowSize(1280, 800);
browser.setWindowSize(1280, 800);
await esArchiver.loadIfNeeded('logstash_functional');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC', 'defaultIndex': 'logstash-*' });
});

View file

@ -21,7 +21,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const log = getService('log');
const remote = getService('remote');
const browser = getService('browser');
const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'visualize', 'header', 'settings']);
@ -148,7 +148,7 @@ export default function ({ getService, getPageObjects }) {
});
it('should hide side editor if embed is set to true in url', async () => {
const url = await remote.getCurrentUrl();
const url = await browser.getCurrentUrl();
const embedUrl = url.split('/visualize/').pop().replace('?_g=', '?embed=true&_g=');
await PageObjects.common.navigateToUrl('visualize', embedUrl);
await PageObjects.header.waitUntilLoadingHasFinished();

View file

@ -22,7 +22,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const filterBar = getService('filterBar');
const log = getService('log');
const remote = getService('remote');
const browser = getService('browser');
const retry = getService('retry');
const find = getService('find');
const PageObjects = getPageObjects(['common', 'visualize', 'header', 'settings']);
@ -90,9 +90,9 @@ export default function ({ getService, getPageObjects }) {
});
it('should still show all tags after browser was resized very small', async function () {
await remote.setWindowSize(200, 200);
await browser.setWindowSize(200, 200);
await PageObjects.common.sleep(1000);
await remote.setWindowSize(1200, 800);
await browser.setWindowSize(1200, 800);
await PageObjects.common.sleep(1000);
const data = await PageObjects.visualize.getTextTag();
expect(data).to.eql([ '32,212,254,720', '21,474,836,480', '20,401,094,656', '19,327,352,832', '18,253,611,008' ]);

View file

@ -22,7 +22,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const log = getService('log');
const retry = getService('retry');
const remote = getService('remote');
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'visualize', 'header', 'settings']);
@ -33,7 +33,7 @@ export default function ({ getService, getPageObjects }) {
before(async function () {
remote.setWindowSize(1280, 1000);
browser.setWindowSize(1280, 1000);
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';
@ -63,7 +63,7 @@ export default function ({ getService, getPageObjects }) {
describe('complete config', function describeIndexTests() {
before(async function () {
remote.setWindowSize(1280, 1000);
browser.setWindowSize(1280, 1000);
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

View file

@ -18,7 +18,7 @@
*/
export default function ({ getService, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
const log = getService('log');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
@ -27,7 +27,7 @@ export default function ({ getService, loadTestFile }) {
describe('visualize app', function () {
before(async ()=> {
log.debug('Starting visualize before method');
remote.setWindowSize(1280, 800);
browser.setWindowSize(1280, 800);
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('visualize');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC', 'defaultIndex': 'logstash-*' });

View file

@ -54,6 +54,7 @@ import {
EmbeddingProvider,
RenderableProvider,
TableProvider,
BrowserProvider,
} from './services';
export default async function ({ readConfigFile }) {
@ -95,7 +96,7 @@ export default async function ({ readConfigFile }) {
esArchiver: commonConfig.get('services.esArchiver'),
kibanaServer: commonConfig.get('services.kibanaServer'),
retry: commonConfig.get('services.retry'),
remote: RemoteProvider,
__leadfoot__: RemoteProvider,
filterBar: FilterBarProvider,
queryBar: QueryBarProvider,
find: FindProvider,
@ -113,6 +114,7 @@ export default async function ({ readConfigFile }) {
embedding: EmbeddingProvider,
renderable: RenderableProvider,
table: TableProvider,
browser: BrowserProvider,
},
servers: commonConfig.get('servers'),

View file

@ -25,7 +25,7 @@ import getUrl from '../../../src/test_utils/get_url';
export function CommonPageProvider({ getService, getPageObjects }) {
const log = getService('log');
const config = getService('config');
const remote = getService('remote');
const browser = getService('browser');
const retry = getService('retry');
const find = getService('find');
const testSubjects = getService('testSubjects');
@ -58,7 +58,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
const appUrl = getUrl.noAuth(config.get('servers.kibana'), appConfig);
await retry.try(async () => {
log.debug(`navigateToUrl ${appUrl}`);
await remote.get(appUrl);
await browser.get(appUrl);
const currentUrl = await this.loginIfPrompted(appUrl);
if (!currentUrl.includes(appUrl)) {
throw new Error(`expected ${currentUrl}.includes(${appUrl})`);
@ -68,9 +68,9 @@ export function CommonPageProvider({ getService, getPageObjects }) {
async loginIfPrompted(appUrl) {
let currentUrl = await remote.getCurrentUrl();
let currentUrl = await browser.getCurrentUrl();
log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`);
await remote.setFindTimeout(defaultTryTimeout * 2).findByCssSelector('[data-test-subj="kibanaChrome"]');
await find.byCssSelector('[data-test-subj="kibanaChrome"]', defaultTryTimeout * 2);
const loginPage = currentUrl.includes('/login');
const wantedLoginPage = appUrl.includes('/login') || appUrl.includes('/logout');
@ -80,9 +80,9 @@ export function CommonPageProvider({ getService, getPageObjects }) {
config.get('servers.kibana.username'),
config.get('servers.kibana.password')
);
await remote.setFindTimeout(20000).findByCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide)');
await remote.get(appUrl);
currentUrl = await remote.getCurrentUrl();
await find.byCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide)', 20000);
await browser.get(appUrl);
currentUrl = await browser.getCurrentUrl();
log.debug(`Finished login process currentUrl = ${currentUrl}`);
}
return currentUrl;
@ -116,14 +116,14 @@ export function CommonPageProvider({ getService, getPageObjects }) {
})
.then(function () {
log.debug('navigate to: ' + url);
return remote.get(url);
return browser.get(url);
})
.then(function () {
return self.sleep(700);
})
.then(function () {
log.debug('returned from get, calling refresh');
return remote.refresh();
return browser.refresh();
})
.then(async function () {
const currentUrl = await self.loginIfPrompted(appUrl);
@ -133,7 +133,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
}
})
.then(async function () {
const currentUrl = (await remote.getCurrentUrl()).replace(/\/\/\w+:\w+@/, '//');
const currentUrl = (await browser.getCurrentUrl()).replace(/\/\/\w+:\w+@/, '//');
const maxAdditionalLengthOnNavUrl = 230;
// On several test failures at the end of the TileMap test we try to navigate back to
// Visualize so we can create the next Vertical Bar Chart, but we can see from the
@ -174,7 +174,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
// give the app time to update the URL
return self.sleep(501)
.then(function () {
return remote.getCurrentUrl();
return browser.getCurrentUrl();
})
.then(function (currentUrl) {
log.debug('in navigateTo url = ' + currentUrl);
@ -194,26 +194,6 @@ export function CommonPageProvider({ getService, getPageObjects }) {
});
}
runScript(fn, timeout = 10000) {
// wait for deps on window before running script
return remote
.setExecuteAsyncTimeout(timeout)
.executeAsync(function (done) {
const interval = setInterval(function () {
const ready = (document.readyState === 'complete');
const hasJQuery = !!window.$;
if (ready && hasJQuery) {
console.log('doc ready, jquery loaded');
clearInterval(interval);
done();
}
}, 10);
}).then(function () {
return remote.execute(fn);
});
}
async sleep(sleepMilliseconds) {
log.debug('... sleep(' + sleepMilliseconds + ') start');
await delay(sleepMilliseconds);
@ -235,7 +215,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
async waitUntilUrlIncludes(path) {
await retry.try(async () => {
const url = await remote.getCurrentUrl();
const url = await browser.getCurrentUrl();
if (!url.includes(path)) {
throw new Error('Url not found');
}
@ -269,7 +249,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
}
async pressEnterKey() {
await remote.pressKeys('\uE007');
await browser.pressKeys('\uE007');
}
// pass in true if your test will show multiple modals
@ -306,21 +286,6 @@ export function CommonPageProvider({ getService, getPageObjects }) {
return await testSubjects.getVisibleText('top-nav');
}
async doesCssSelectorExist(selector) {
log.debug(`doesCssSelectorExist ${selector}`);
const exists = await remote
.setFindTimeout(1000)
.findByCssSelector(selector)
.then(() => true)
.catch(() => false);
remote.setFindTimeout(defaultFindTimeout);
log.debug(`exists? ${exists}`);
return exists;
}
async isChromeVisible() {
const globalNavShown = await testSubjects.exists('globalNav');
const topNavShown = await testSubjects.exists('top-nav');
@ -338,7 +303,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
async closeToast() {
const toast = await find.byCssSelector('.euiToast');
await remote.moveMouseTo(toast);
await browser.moveMouseTo(toast);
const title = await (await find.byCssSelector('.euiToastHeader__title')).getVisibleText();
log.debug(title);
await find.clickByCssSelector('.euiToast__closeButton');
@ -349,7 +314,7 @@ export function CommonPageProvider({ getService, getPageObjects }) {
const toasts = await find.allByCssSelector('.euiToast');
for (const toastElement of toasts) {
try {
await remote.moveMouseTo(toastElement);
await browser.moveMouseTo(toastElement);
const closeBtn = await toastElement.findByCssSelector('.euiToast__closeButton');
await closeBtn.click();
} catch (err) {

View file

@ -26,7 +26,7 @@ const DEFAULT_INITIAL_STATE = {
};
export function ContextPageProvider({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const config = getService('config');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
@ -44,7 +44,7 @@ export function ContextPageProvider({ getService, getPageObjects }) {
hash: `${config.get('apps.context.hash')}/${indexPattern}/${anchorType}/${anchorId}?_a=${initialState}`,
});
await remote.get(appUrl);
await browser.get(appUrl);
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
await this.waitUntilContextLoadingHasFinished();
// For lack of a better way, using a sleep to ensure page is loaded before proceeding

View file

@ -29,7 +29,7 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
const find = getService('find');
const retry = getService('retry');
const config = getService('config');
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
@ -62,8 +62,8 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
}
async preserveCrossAppState() {
const url = await remote.getCurrentUrl();
await remote.get(url, false);
const url = await browser.getCurrentUrl();
await browser.get(url, false);
await PageObjects.header.waitUntilLoadingHasFinished();
}
@ -108,7 +108,7 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
}
async getDashboardIdFromCurrentUrl() {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const urlSubstring = 'kibana#/dashboard/';
const startOfIdIndex = currentUrl.indexOf(urlSubstring) + urlSubstring.length;
const endIndex = currentUrl.indexOf('?');

View file

@ -20,7 +20,6 @@
import expect from 'expect.js';
export function DiscoverPageProvider({ getService, getPageObjects }) {
const config = getService('config');
const log = getService('log');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
@ -28,26 +27,18 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
const flyout = getService('flyout');
const PageObjects = getPageObjects(['header', 'common']);
const getRemote = () => (
getService('remote')
.setFindTimeout(config.get('timeouts.find'))
);
class DiscoverPage {
getQueryField() {
return getRemote()
.findByCssSelector('input[ng-model=\'state.query\']');
async getQueryField() {
return await find.byCssSelector('input[ng-model=\'state.query\']');
}
getQuerySearchButton() {
return getRemote()
.findByCssSelector('button[aria-label=\'Search\']');
async getQuerySearchButton() {
return await find.byCssSelector('button[aria-label=\'Search\']');
}
getChartTimespan() {
return getRemote()
.findByCssSelector('.small > span:nth-child(1)')
.getVisibleText();
async getChartTimespan() {
const el = await find.byCssSelector('.small > span:nth-child(1)');
return await el.getVisibleText();
}
async saveSearch(searchName) {
@ -126,9 +117,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
}
async getBarChartXTicks() {
return getRemote()
.findAllByCssSelector('.x.axis.CategoryAxis-1 > .tick > text')
.getVisibleText();
const elements = await find.allByCssSelector('.x.axis.CategoryAxis-1 > .tick > text');
return await Promise.all(elements.map(async el => el.getVisibleText()));
}
getBarChartData() {
@ -137,8 +127,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
return PageObjects.header.waitUntilLoadingHasFinished()
.then(() => {
return getRemote()
.findByCssSelector('div.visAxis__splitAxes--y > div > svg > g > g:last-of-type');
return find.byCssSelector('div.visAxis__splitAxes--y > div > svg > g > g:last-of-type');
})
.then(function setYAxisLabel(y) {
return y
@ -151,8 +140,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
})
// 2). find and save the y-axis pixel size (the chart height)
.then(function getRect() {
return getRemote()
.findByCssSelector('rect.background')
return find.byCssSelector('rect.background')
.then(function getRectHeight(chartAreaObj) {
return chartAreaObj
.getAttribute('height')
@ -165,9 +153,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
})
// 3). get the visWrapper__chart elements
.then(function () {
return getRemote()
// #kibana-body > div.content > div > div > div > div.visEditor__canvas > visualize > div.visChart > div > div.visWrapper__column > div.visWrapper__chart > div > svg > g > g.series.\30 > rect:nth-child(1)
.findAllByCssSelector('svg > g > g.series > rect') // rect
return find.allByCssSelector('svg > g > g.series > rect') // rect
.then(function (chartTypes) {
function getChartType(chart) {
return chart
@ -203,13 +190,11 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
}
query(queryString) {
return getRemote()
.findByCssSelector('input[aria-label="Search input"]')
return find.byCssSelector('input[aria-label="Search input"]')
.clearValue()
.type(queryString)
.then(() => {
return getRemote()
.findByCssSelector('button[aria-label="Search"]')
return find.byCssSelector('button[aria-label="Search"]')
.click();
})
.then(() => {
@ -217,52 +202,41 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
});
}
getDocHeader() {
return getRemote()
.findByCssSelector('thead > tr:nth-child(1)')
.getVisibleText();
async getDocHeader() {
const header = await find.byCssSelector('thead > tr:nth-child(1)');
return await header.getVisibleText();
}
getDocTableIndex(index) {
return getRemote()
.findByCssSelector('tr.kbnDocTable__row:nth-child(' + (index) + ')')
.getVisibleText();
async getDocTableIndex(index) {
const row = await find.byCssSelector('tr.kbnDocTable__row:nth-child(' + (index) + ')');
return await row.getVisibleText();
}
clickDocSortDown() {
return getRemote()
.findByCssSelector('.fa-sort-down')
.click();
async clickDocSortDown() {
await find.clickByCssSelector('.fa-sort-down');
}
clickDocSortUp() {
return getRemote()
.findByCssSelector('.fa-sort-up')
.click();
async clickDocSortUp() {
await find.clickByCssSelector('.fa-sort-up');
}
getMarks() {
return getRemote()
.findAllByCssSelector('mark')
.getVisibleText();
async getMarks() {
const marks = await find.allByCssSelector('mark');
return await Promise.all(marks.map((mark) => mark.getVisibleText()));
}
async toggleSidebarCollapse() {
return await testSubjects.click('collapseSideBarButton');
}
getAllFieldNames() {
return getRemote()
.findAllByClassName('sidebar-item')
.then((items) => {
return Promise.all(items.map((item) => item.getVisibleText()));
});
async getAllFieldNames() {
const items = await find.allByCssSelector('.sidebar-item');
return await Promise.all(items.map((item) => item.getVisibleText()));
}
getSidebarWidth() {
return getRemote()
.findByClassName('sidebar-list')
.getProperty('clientWidth');
async getSidebarWidth() {
const sidebar = await find.byCssSelector('.sidebar-list');
return await sidebar.getProperty('clientWidth');
}
async hasNoResults() {
@ -298,24 +272,20 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
async clickFieldListPlusFilter(field, value) {
// this method requires the field details to be open from clickFieldListItem()
// testSubjects.find doesn't handle spaces in the data-test-subj value
await getRemote()
.findByCssSelector(`[data-test-subj="plus-${field}-${value}"]`)
.click();
await find.clickByCssSelector(`[data-test-subj="plus-${field}-${value}"]`);
await PageObjects.header.waitUntilLoadingHasFinished();
}
async clickFieldListMinusFilter(field, value) {
// this method requires the field details to be open from clickFieldListItem()
// testSubjects.find doesn't handle spaces in the data-test-subj value
await getRemote()
.findByCssSelector('[data-test-subj="minus-' + field + '-' + value + '"]')
.click();
await find.clickByCssSelector('[data-test-subj="minus-' + field + '-' + value + '"]');
await PageObjects.header.waitUntilLoadingHasFinished();
}
async selectIndexPattern(indexPattern) {
await getRemote().findByClassName('index-pattern-selection').click();
await getRemote().findByClassName('ui-select-search').type(indexPattern + '\n');
await find.clickByCssSelector('.index-pattern-selection');
await find.setValue('.ui-select-search', indexPattern + '\n');
await PageObjects.header.waitUntilLoadingHasFinished();
}

View file

@ -19,7 +19,6 @@
export function HeaderPageProvider({ getService, getPageObjects }) {
const config = getService('config');
const remote = getService('remote');
const log = getService('log');
const retry = getService('retry');
const find = getService('find');
@ -89,7 +88,6 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
async clickQuickButton() {
await retry.try(async () => {
remote.setFindTimeout(defaultFindTimeout);
await testSubjects.click('timepicker-quick-button');
});
}
@ -100,7 +98,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
async isAbsoluteSectionShowing() {
log.debug('isAbsoluteSectionShowing');
return await PageObjects.common.doesCssSelectorExist('input[ng-model=\'absolute.from\']');
return await find.existsByCssSelector('input[ng-model=\'absolute.from\']');
}
async showAbsoluteSection() {
@ -108,7 +106,6 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
const isAbsoluteSectionShowing = await this.isAbsoluteSectionShowing();
if (!isAbsoluteSectionShowing) {
await retry.try(async () => {
await remote.setFindTimeout(defaultFindTimeout);
await testSubjects.click('timepicker-absolute-button');
// Check to make sure one of the elements on the absolute section is showing.
await this.getFromTime();
@ -121,9 +118,8 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
return await retry.try(async () => {
await this.ensureTimePickerIsOpen();
await this.showAbsoluteSection();
remote.setFindTimeout(defaultFindTimeout);
return await remote.findByCssSelector('input[ng-model=\'absolute.from\']')
.getProperty('value');
const element = await find.byCssSelector('input[ng-model=\'absolute.from\']');
return await element.getProperty('value');
});
}
@ -132,9 +128,8 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
return await retry.try(async () => {
await this.ensureTimePickerIsOpen();
await this.showAbsoluteSection();
remote.setFindTimeout(defaultFindTimeout);
return await remote.findByCssSelector('input[ng-model=\'absolute.to\']')
.getProperty('value');
const element = await find.byCssSelector('input[ng-model=\'absolute.to\']');
return await element.getProperty('value');
});
}
@ -143,10 +138,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
await retry.try(async () => {
await this.ensureTimePickerIsOpen();
await this.showAbsoluteSection();
remote.setFindTimeout(defaultFindTimeout);
await remote.findByCssSelector('input[ng-model=\'absolute.from\']')
.clearValue()
.type(timeString);
await find.setValue('input[ng-model=\'absolute.from\']', timeString);
});
}
@ -155,17 +147,13 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
await retry.try(async () => {
await this.ensureTimePickerIsOpen();
await this.showAbsoluteSection();
remote.setFindTimeout(defaultFindTimeout);
await remote.findByCssSelector('input[ng-model=\'absolute.to\']')
.clearValue()
.type(timeString);
await find.setValue('input[ng-model=\'absolute.to\']', timeString);
});
}
async clickGoButton() {
log.debug('clickGoButton');
await retry.try(async () => {
remote.setFindTimeout(defaultFindTimeout);
await testSubjects.click('timepickerGoButton');
await this.waitUntilLoadingHasFinished();
});
@ -200,8 +188,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
await this.ensureTimePickerIsOpen();
log.debug('--Clicking Quick button');
await this.clickQuickButton();
await remote.setFindTimeout(defaultFindTimeout)
.findByLinkText(quickTime).click();
await find.clickByLinkText(quickTime);
}
async getAutoRefreshState() {
@ -238,11 +225,7 @@ export function HeaderPageProvider({ getService, getPageObjects }) {
async clickToastOK() {
log.debug('clickToastOK');
await retry.try(async () => {
remote.setFindTimeout(defaultFindTimeout);
await remote.findByCssSelector('button[ng-if="notif.accept"]')
.click();
});
await find.clickByCssSelector('button[ng-if="notif.accept"]');
}
async waitUntilLoadingHasFinished() {

View file

@ -19,32 +19,25 @@
export function MonitoringPageProvider({ getService }) {
const testSubjects = getService('testSubjects');
const getRemote = (timeout) =>
getService('remote')
.setFindTimeout(
timeout || getService('config').get('timeouts.find')
);
const find = getService('find');
class MonitoringPage {
getWelcome() {
return getRemote()
.findDisplayedByCssSelector('render-directive')
.getVisibleText();
async getWelcome() {
const el = await find.displayedByCssSelector('render-directive');
return await el.getVisibleText();
}
dismissWelcome() {
return testSubjects.click('notifierDismissButton');
}
getToasterContents() {
return getRemote()
.findByCssSelector('div.toaster-container')
.getVisibleText();
async getToasterContents() {
const el = await find.byCssSelector('div.toaster-container');
return await el.getVisibleText();
}
clickOptOut() {
return getRemote().findByLinkText('Opt out here').click();
async clickOptOut() {
return find.clickByLinkText('Opt out here');
}
}

View file

@ -18,170 +18,103 @@
*/
export function PointSeriesPageProvider({ getService }) {
const remote = getService('remote');
const config = getService('config');
const testSubjects = getService('testSubjects');
const log = getService('log');
const defaultFindTimeout = config.get('timeouts.find');
const find = getService('find');
class PointSeriesVis {
clickOptions() {
return remote
.setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Panel Settings')
.click();
async clickOptions() {
return await find.clickByPartialLinkText('Panel Settings');
}
clickAxisOptions() {
return remote
.setFindTimeout(defaultFindTimeout)
.findByPartialLinkText('Metrics & Axes')
.click();
async clickAxisOptions() {
return await find.clickByPartialLinkText('Metrics & Axes');
}
async clickAddAxis() {
return await testSubjects.click('visualizeAddYAxisButton');
}
setAxisTitle(title, { index = 0 } = {}) {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector(`#valueAxisTitle${index}`)
.clearValue()
.type(title);
async setAxisTitle(title, { index = 0 } = {}) {
return await find.setValue(`#valueAxisTitle${index}`, title);
}
getValueAxesCount() {
return remote
.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('.kuiSideBarSection:contains("Value Axes") > .kuiSideBarSection')
.then(all => all.length);
async getValueAxesCount() {
const axes = await find.allByCssSelector('.kuiSideBarSection:contains("Value Axes") > .kuiSideBarSection');
return axes.length;
}
getSeriesCount() {
return remote
.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('.kuiSideBarSection:contains("Series") > .kuiSideBarSection')
.then(all => all.length);
async getSeriesCount() {
const series = await find.allByCssSelector('.kuiSideBarSection:contains("Series") > .kuiSideBarSection');
return series.length;
}
getRightValueAxes() {
return remote
.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('.visAxis__column--right g.axis')
.then(all => all.length);
async getRightValueAxes() {
const axes = await find.allByCssSelector('.visAxis__column--right g.axis');
return axes.length;
}
getHistogramSeries() {
return remote
.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('.series.histogram')
.then(all => all.length);
async getHistogramSeries() {
const series = await find.allByCssSelector('.series.histogram');
return series.length;
}
getGridLines() {
return remote
.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('g.grid > path')
.then(function (data) {
function getGridLine(gridLine) {
return gridLine
.getAttribute('d')
.then(dAttribute => {
const firstPoint = dAttribute.split('L')[0].replace('M', '').split(',');
return { x: parseFloat(firstPoint[0]), y: parseFloat(firstPoint[1]) };
});
}
const promises = data.map(getGridLine);
return Promise.all(promises);
})
.then(function (gridLines) {
return gridLines;
});
async getGridLines() {
const gridLines = await find.allByCssSelector('g.grid > path');
return await Promise.all(gridLines.map(async (gridLine) => {
const dAttribute = await gridLine.getAttribute('d');
const firstPoint = dAttribute.split('L')[0].replace('M', '').split(',');
return {
x: parseFloat(firstPoint[0]),
y: parseFloat(firstPoint[1]),
};
}));
}
toggleGridCategoryLines() {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector('#showCategoryLines')
.click();
async toggleGridCategoryLines() {
return await find.clickByCssSelector('#showCategoryLines');
}
setGridValueAxis(axis) {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector(`select#gridAxis option[value="${axis}"]`)
.click();
async setGridValueAxis(axis) {
return await find.clickByCssSelector(`select#gridAxis option[value="${axis}"]`);
}
toggleCollapsibleTitle(title) {
return remote
.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('.kuiSideBarCollapsibleTitle .kuiSideBarCollapsibleTitle__text')
.then(sidebarTitles => {
log.debug('found sidebar titles ' + sidebarTitles.length);
function getTitle(titleDiv) {
return titleDiv
.getVisibleText()
.then(titleString => {
log.debug('sidebar title ' + titleString);
if (titleString === title) {
log.debug('clicking sidebar title ' + titleString);
return titleDiv.click();
}
});
}
const sidebarTitlePromises = sidebarTitles.map(getTitle);
return Promise.all(sidebarTitlePromises);
});
async toggleCollapsibleTitle(title) {
const sidebarTitles = await find.allByCssSelector('.kuiSideBarCollapsibleTitle .kuiSideBarCollapsibleTitle__text');
log.debug('found sidebar titles ' + sidebarTitles.length);
return Promise.all(sidebarTitles.map(async (titleDiv) => {
const titleString = await titleDiv.getVisibleText();
log.debug('sidebar title ' + titleString);
if (titleString === title) {
log.debug('clicking sidebar title ' + titleString);
return titleDiv.click();
}
}));
}
setValue(newValue) {
return remote
.setFindTimeout(defaultFindTimeout * 2)
.findByCssSelector('button[ng-click="numberListCntr.add()"]')
.click()
.then(() => {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector('input[ng-model="numberListCntr.getList()[$index]"]')
.clearValue();
})
.then(() => {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector('input[ng-model="numberListCntr.getList()[$index]"]')
.type(newValue);
});
async setValue(newValue) {
await find.click('button[ng-click="numberListCntr.add()"]');
await find.setValue('input[ng-model="numberListCntr.getList()[$index]"]', newValue);
}
setValueAxisPosition(axis, position) {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector(`select#valueAxisPosition${axis} option[label="${position}"]`)
.click();
async setValueAxisPosition(axis, position) {
await find.clickByCssSelector(`select#valueAxisPosition${axis} option[label="${position}"]`);
}
setCategoryAxisPosition(newValue) {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector(`select#categoryAxisPosition option[label="${newValue}"]`)
.click();
async setCategoryAxisPosition(newValue) {
await find.clickByCssSelector(`select#categoryAxisPosition option[label="${newValue}"]`);
}
setSeriesAxis(series, axis) {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector(`select#seriesValueAxis${series} option[value="${axis}"]`)
.click();
async setSeriesAxis(series, axis) {
await find.clickByCssSelector(`select#seriesValueAxis${series} option[value="${axis}"]`);
}
setSeriesType(series, type) {
return remote
.setFindTimeout(defaultFindTimeout)
.findByCssSelector(`select#seriesType${series} option[label="${type}"]`)
.click();
async setSeriesType(series, type) {
await find.clickByCssSelector(`select#seriesType${series} option[label="${type}"]`);
}
}

View file

@ -23,11 +23,9 @@ import expect from 'expect.js';
export function SettingsPageProvider({ getService, getPageObjects }) {
const log = getService('log');
const retry = getService('retry');
const remote = getService('remote');
const browser = getService('browser');
const find = getService('find');
const flyout = getService('flyout');
const config = getService('config');
const defaultFindTimeout = config.get('timeouts.find');
const testSubjects = getService('testSubjects');
const comboBox = getService('comboBox');
const PageObjects = getPageObjects(['header', 'common']);
@ -172,13 +170,13 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
return Promise.all(getChartTypesPromises);
}
getTableRow(rowNumber, colNumber) {
return remote.setFindTimeout(defaultFindTimeout)
// passing in zero-based index, but adding 1 for css 1-based indexes
.findByCssSelector('table.euiTable tbody tr:nth-child(' +
(rowNumber + 1) + ') td.euiTableRowCell:nth-child(' +
(colNumber + 1) + ')'
);
async getTableRow(rowNumber, colNumber) {
// passing in zero-based index, but adding 1 for css 1-based indexes
return await find.byCssSelector(
'table.euiTable tbody tr:nth-child(' +
(rowNumber + 1) + ') td.euiTableRowCell:nth-child(' +
(colNumber + 1) + ')'
);
}
async getFieldsTabCount() {
@ -291,7 +289,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async () => {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
log.info('currentUrl', currentUrl);
if (!currentUrl.match(/indices\/.+\?/)) {
throw new Error('Index pattern not created');
@ -311,7 +309,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
}
async getIndexPatternIdFromUrl() {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
const indexPatternId = currentUrl.match(/.*\/(.*)/)[1];
log.debug('index pattern ID: ', indexPatternId);
@ -356,7 +354,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
await testSubjects.click('confirmModalConfirmButton');
});
await retry.try(async () => {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
if (currentUrl.match(/indices\/.+\?/)) {
throw new Error('Index pattern not removed');
}

View file

@ -23,7 +23,7 @@ import expect from 'expect.js';
import Keys from 'leadfoot/keys';
export function VisualizePageProvider({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const config = getService('config');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
@ -54,7 +54,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
async waitForVisualizationSelectPage() {
await retry.try(async () => {
const visualizeSelectTypePage = await testSubjects.find('visNewDialogTypes');
if (!visualizeSelectTypePage.isDisplayed()) {
if (!await visualizeSelectTypePage.isDisplayed()) {
throw new Error('wait for visualization select page');
}
});
@ -177,7 +177,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
}
async getExperimentalTypeLinks() {
return await remote.findAllByCssSelector('[data-vis-stage="experimental"]');
return await find.allByCssSelector('[data-vis-stage="experimental"]');
}
async isExperimentalInfoShown() {
@ -385,7 +385,8 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
const testSubject = type === 'bucket' ? 'bucketsAggGroup' : 'metricsAggGroup';
await retry.try(async () => {
const chartTypes = await retry.try(
async () => await find.allByCssSelector(`[data-test-subj="${testSubject}"] .list-group-menu-item`));
async () => await find.allByCssSelector(`[data-test-subj="${testSubject}"] .list-group-menu-item`)
);
log.debug('found bucket types ' + chartTypes.length);
async function getChartType(chart) {
@ -415,7 +416,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
await find.clickByCssSelector(selector);
const input = await find.byCssSelector(`${selector} input.ui-select-search`);
await input.type(myString);
await remote.pressKeys('\uE006');
await browser.pressKeys('\uE006');
});
await PageObjects.common.sleep(500);
}
@ -526,7 +527,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
await find.clickByCssSelector(selector);
const input = await find.byCssSelector(`${selector} input.ui-select-search`);
await input.type(fieldValue);
await remote.pressKeys('\uE006');
await browser.pressKeys('\uE006');
});
await PageObjects.common.sleep(500);
}
@ -561,7 +562,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
async setInterval(newValue) {
const input = await find.byCssSelector('select[ng-model="agg.params.interval"]');
await input.type(newValue);
await remote.pressKeys(Keys.RETURN);
await browser.pressKeys(Keys.RETURN);
}
async setCustomInterval(newValue) {
@ -627,7 +628,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
async sizeUpEditor() {
await testSubjects.click('visualizeEditorResizer');
await remote.pressKeys(Keys.ARROW_RIGHT);
await browser.pressKeys(Keys.ARROW_RIGHT);
}
async clickOptions() {
@ -762,13 +763,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
async clickVisualizationByName(vizName) {
log.debug('clickVisualizationByLinkText(' + vizName + ')');
return retry.try(function tryingForTime() {
return remote
.setFindTimeout(defaultFindTimeout)
.findByPartialLinkText(vizName)
.click();
});
return find.clickByPartialLinkText(vizName);
}
async loadSavedVisualization(vizName, { navigateToVisualize = true } = {}) {
@ -1137,14 +1132,14 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
await retry.try(async () => {
const table = await testSubjects.find('tableVis');
const cell = await table.findByCssSelector(`tbody tr:nth-child(${row}) td:nth-child(${column})`);
await remote.moveMouseTo(cell);
await browser.moveMouseTo(cell);
const filterBtn = await testSubjects.findDescendant('filterForCellValue', cell);
await filterBtn.click();
});
}
async toggleLegend(show = true) {
const isVisible = remote.findByCssSelector('vislib-legend .legend-ul');
const isVisible = find.byCssSelector('vislib-legend .legend-ul');
if ((show && !isVisible) || (!show && isVisible)) {
await testSubjects.click('vislibToggleLegend');
}
@ -1181,8 +1176,8 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
async filterPieSlice(name) {
const slice = await this.getPieSlice(name);
// Since slice is an SVG element we can't simply use .click() for it
await remote.moveMouseTo(slice);
await remote.clickMouseButton();
await browser.moveMouseTo(slice);
await browser.clickMouseButton();
}
async getPieSlice(name) {

View file

@ -0,0 +1,252 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { modifyUrl } from '../../../src/core/utils';
export function BrowserProvider({ getService }) {
const leadfoot = getService('__leadfoot__');
return new class BrowserService {
/**
* Gets the dimensions of a window.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#getWindowSize
*
* @param {string} windowHandle Optional - Omit this argument to query the currently focused window.
* @return {Promise<{width: number, height: number}>}
*/
async getWindowSize(...args) {
return await leadfoot.getWindowSize(...args);
}
/**
* Sets the dimensions of a window.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#setWindowSize
*
* @param {string} windowHandle Optional
* @param {number} width
* @param {number} height
* @return {Promise<void>}
*/
async setWindowSize(...args) {
await leadfoot.setWindowSize(...args);
}
/**
* Gets the URL that is loaded in the focused window/frame.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#getCurrentUrl
*
* @return {Promise<string>}
*/
async getCurrentUrl() {
// strip _t=Date query param when url is read
const current = await leadfoot.getCurrentUrl();
const currentWithoutTime = modifyUrl(current, parsed => {
delete parsed.query._t;
});
return currentWithoutTime;
}
/**
* Navigates the focused window/frame to a new URL.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#get
*
* @param {string} url
* @param {boolean} insertTimestamp Optional
* @return {Promise<void>}
*/
async get(url, insertTimestamp = true) {
if (insertTimestamp) {
const urlWithTime = modifyUrl(url, parsed => {
parsed.query._t = Date.now();
});
return await leadfoot.get(urlWithTime);
}
return await leadfoot.get(url);
}
/**
* Moves the remote environments mouse cursor to the specified element or relative
* position. If the element is outside of the viewport, the remote driver will attempt
* to scroll it into view automatically.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#moveMouseTo
*
* @param {Element} element Optional
* @param {number} xOffset Optional
* @param {number} yOffset Optional
* @return {Promise<void>}
*/
async moveMouseTo(...args) {
await leadfoot.moveMouseTo(...args);
}
/**
* Reloads the current browser window/frame.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#refresh
*
* @return {Promise<void>}
*/
async refresh() {
await leadfoot.refresh();
}
/**
* Navigates the focused window/frame back one page using the browsers navigation history.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#goBack
*
* @return {Promise<void>}
*/
async goBack() {
await leadfoot.goBack();
}
/**
* Types into the focused window/frame/element.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#pressKeys
*
* @param {string|string[]} keys
* @return {Promise<void>}
*/
async pressKeys(...args) {
await leadfoot.pressKeys(...args);
}
/**
* Clicks a mouse button at the point where the mouse cursor is currently positioned. This
* method may fail to execute with an error if the mouse has not been moved anywhere since
* the page was loaded.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#clickMouseButton
*
* @param {number} button Optional
* @return {Promise<void>}
*/
async clickMouseButton(...args) {
await leadfoot.clickMouseButton(...args);
}
/**
* Depresses a mouse button without releasing it.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#pressMouseButton
*
* @param {number} button Optional
* @return {Promise<void>}
*/
async pressMouseButton(...args) {
await leadfoot.pressMouseButton(...args);
}
/**
* Releases a previously depressed mouse button.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#releaseMouseButton
*
* @param {number} button Optional
* @return {Promise<void>}
*/
async releaseMouseButton(...args) {
await leadfoot.releaseMouseButton(...args);
}
/**
* Gets the HTML loaded in the focused window/frame. This markup is serialised by the remote
* environment so may not exactly match the HTML provided by the Web server.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#getPageSource
*
* @return {Promise<string>}
*/
async getPageSource(...args) {
return await leadfoot.getPageSource(...args);
}
/**
* Gets all logs from the remote environment of the given type. The logs in the remote
* environment are cleared once they have been retrieved.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#getLogsFor
*
* @param {string} type
* @return {Promise<LogEntry[]>}
*/
async getLogsFor(...args) {
return await leadfoot.getLogsFor(...args);
}
/**
* Gets a screenshot of the focused window and returns it in PNG format.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#takeScreenshot
*
* @return {Promise<Buffer>}
*/
async takeScreenshot(...args) {
return await leadfoot.takeScreenshot(...args);
}
/**
* Double-clicks the primary mouse button.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#doubleClick
*
* @return {Promise<void>}
*/
async doubleClick(...args) {
await leadfoot.doubleClick(...args);
}
/**
* Switches the currently focused window to a new window.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#switchToWindow
*
* @param {string} handle
* @return {Promise<void>}
*/
async switchToWindow(...args) {
await leadfoot.switchToWindow(...args);
}
/**
* Gets a list of identifiers for all currently open windows.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#getAllWindowHandles
*
* @return {Promise<string[]>}
*/
async getAllWindowHandles(...args) {
return await leadfoot.getAllWindowHandles(...args);
}
/**
* Closes the currently focused window. In most environments, after the window has been
* closed, it is necessary to explicitly switch to whatever window is now focused.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#closeCurrentWindow
*
* @return {Promise<void>}
*/
async closeCurrentWindow(...args) {
await leadfoot.closeCurrentWindow(...args);
}
/**
* Executes JavaScript code within the focused window/frame. The code should return a value synchronously.
* https://theintern.io/leadfoot/module-leadfoot_Session.html#execute
*
* @param {string|function} function
* @param {...any[]} args
*/
async execute(...args) {
return await leadfoot.execute(...args);
}
};
}

View file

@ -26,7 +26,7 @@ const OPEN_INSPECTOR_TEST_SUBJ = 'dashboardPanelAction-openInspector';
export function DashboardPanelActionsProvider({ getService, getPageObjects }) {
const log = getService('log');
const remote = getService('remote');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['header', 'common']);
@ -45,7 +45,7 @@ export function DashboardPanelActionsProvider({ getService, getPageObjects }) {
async toggleContextMenu(parent) {
log.debug('toggleContextMenu');
await (parent ? remote.moveMouseTo(parent) : testSubjects.moveMouseTo('dashboardPanelTitle'));
await (parent ? browser.moveMouseTo(parent) : testSubjects.moveMouseTo('dashboardPanelTitle'));
const toggleMenuItem = await this.findContextMenu(parent);
await toggleMenuItem.click();
}

View file

@ -18,16 +18,16 @@
*/
export function EmbeddingProvider({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const log = getService('log');
const PageObjects = getPageObjects(['header']);
class Embedding {
async openInEmbeddedMode() {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
log.debug(`Opening in embedded mode: ${currentUrl}`);
await remote.get(`${currentUrl}&embed=true`);
await browser.get(`${currentUrl}&embed=true`);
await PageObjects.header.waitUntilLoadingHasFinished();
}

View file

@ -31,25 +31,25 @@ export async function FailureDebuggingProvider({ getService }) {
const config = getService('config');
const lifecycle = getService('lifecycle');
const log = getService('log');
const remote = getService('remote');
const browser = getService('browser');
await del(config.get('failureDebugging.htmlDirectory'));
async function logCurrentUrl() {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
log.info(`Current URL is: ${currentUrl}`);
}
async function savePageHtml(name) {
await mkdirAsync(config.get('failureDebugging.htmlDirectory'));
const htmlOutputFileName = resolve(config.get('failureDebugging.htmlDirectory'), `${name}.html`);
const pageSource = await remote.getPageSource();
const pageSource = await browser.getPageSource();
log.info(`Saving page source to: ${htmlOutputFileName}`);
await writeFileAsync(htmlOutputFileName, pageSource);
}
async function logBrowserConsole() {
const browserLogs = await remote.getLogsFor('browser');
const browserLogs = await browser.getLogsFor('browser');
const browserOutput = browserLogs.reduce((acc, log) => acc += `${log.message.replace(/\\n/g, '\n')}\n`, '');
log.info(`Browser output is: ${browserOutput}`);
}

View file

@ -20,7 +20,7 @@
import Keys from 'leadfoot/keys';
export function FilterBarProvider({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const find = getService('find');
const PageObjects = getPageObjects(['common', 'header']);
@ -43,21 +43,21 @@ export function FilterBarProvider({ getService, getPageObjects }) {
async removeFilter(key) {
const filterElement = await testSubjects.find(`filter & filter-key-${key}`);
await remote.moveMouseTo(filterElement);
await browser.moveMouseTo(filterElement);
await testSubjects.click(`filter & filter-key-${key} removeFilter-${key}`);
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
}
async toggleFilterEnabled(key) {
const filterElement = await testSubjects.find(`filter & filter-key-${key}`);
await remote.moveMouseTo(filterElement);
await browser.moveMouseTo(filterElement);
await testSubjects.click(`filter & filter-key-${key} disableFilter-${key}`);
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
}
async toggleFilterPinned(key) {
const filterElement = await testSubjects.find(`filter & filter-key-${key}`);
await remote.moveMouseTo(filterElement);
await browser.moveMouseTo(filterElement);
await testSubjects.click(`filter & filter-key-${key} pinFilter-${key}`);
}
@ -92,7 +92,7 @@ export function FilterBarProvider({ getService, getPageObjects }) {
}
for (let j = 0; j < fieldValues.length; j++) {
await paramFields[i].type(fieldValues[j]);
await remote.pressKeys(Keys.RETURN);
await browser.pressKeys(Keys.RETURN);
}
}
await testSubjects.click('saveFilter');
@ -101,7 +101,7 @@ export function FilterBarProvider({ getService, getPageObjects }) {
async clickEditFilter(key, value) {
const pill = await testSubjects.find(`filter & filter-key-${key} & filter-value-${value}`);
await remote.moveMouseTo(pill);
await browser.moveMouseTo(pill);
await testSubjects.click('editFilter');
}

View file

@ -35,7 +35,7 @@ export const WAIT_FOR_EXISTS_TIME = 2500;
export function FindProvider({ getService }) {
const log = getService('log');
const config = getService('config');
const remote = getService('remote');
const leadfoot = getService('__leadfoot__');
const retry = getService('retry');
const defaultFindTimeout = config.get('timeouts.find');
@ -43,10 +43,10 @@ export function FindProvider({ getService }) {
class Find {
async _withTimeout(timeout, block) {
try {
const remoteWithTimeout = remote.setFindTimeout(timeout);
return await block(remoteWithTimeout);
const leadfootWithTimeout = leadfoot.setFindTimeout(timeout);
return await block(leadfootWithTimeout);
} finally {
remote.setFindTimeout(defaultFindTimeout);
leadfoot.setFindTimeout(defaultFindTimeout);
}
}
@ -61,39 +61,43 @@ export function FindProvider({ getService }) {
async _ensureElementWithTimeout(timeout, getElementFunction) {
try {
const remoteWithTimeout = remote.setFindTimeout(timeout);
const leadfootWithTimeout = leadfoot.setFindTimeout(timeout);
return await retry.try(async () => {
const element = await getElementFunction(remoteWithTimeout);
const element = await getElementFunction(leadfootWithTimeout);
// Calling any method forces a staleness check
element.isEnabled();
return element;
});
} finally {
remote.setFindTimeout(defaultFindTimeout);
leadfoot.setFindTimeout(defaultFindTimeout);
}
}
async byName(selector, timeout = defaultFindTimeout) {
log.debug(`find.byName(${selector})`);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findByName(selector);
return await this._ensureElementWithTimeout(timeout, async leadfoot => {
return await leadfoot.findByName(selector);
});
}
async byCssSelector(selector, timeout = defaultFindTimeout) {
log.debug(`findByCssSelector ${selector}`);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findByCssSelector(selector);
return await this._ensureElementWithTimeout(timeout, async leadfoot => {
return await leadfoot.findByCssSelector(selector);
});
}
async byClassName(selector, timeout = defaultFindTimeout) {
log.debug(`findByCssSelector ${selector}`);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findByClassName(selector);
return await this._ensureElementWithTimeout(timeout, async leadfoot => {
return await leadfoot.findByClassName(selector);
});
}
async activeElement() {
return await leadfoot.getActiveElement();
}
async setValue(selector, text) {
return await retry.try(async () => {
const element = await this.byCssSelector(selector);
@ -102,16 +106,16 @@ export function FindProvider({ getService }) {
// in case the input element is actually a child of the testSubject, we
// call clearValue() and type() on the element that is focused after
// clicking on the testSubject
const input = await remote.getActiveElement();
const input = await this.activeElement();
await input.clearValue();
await input.type(text);
});
}
async allByCustom(findAllFunction, timeout = defaultFindTimeout) {
return await this._withTimeout(timeout, async remote => {
return await this._withTimeout(timeout, async leadfoot => {
return await retry.try(async () => {
let elements = await findAllFunction(remote);
let elements = await findAllFunction(leadfoot);
if (!elements) elements = [];
// Force isStale checks for all the retrieved elements.
await Promise.all(elements.map(async element => await element.isEnabled()));
@ -122,12 +126,12 @@ export function FindProvider({ getService }) {
async allByLinkText(selector, timeout = defaultFindTimeout) {
log.debug('find.allByLinkText: ' + selector);
return await this.allByCustom(remote => remote.findAllByLinkText(selector), timeout);
return await this.allByCustom(leadfoot => leadfoot.findAllByLinkText(selector), timeout);
}
async allByCssSelector(selector, timeout = defaultFindTimeout) {
log.debug('in findAllByCssSelector: ' + selector);
return await this.allByCustom(remote => remote.findAllByCssSelector(selector), timeout);
return await this.allByCustom(leadfoot => leadfoot.findAllByCssSelector(selector), timeout);
}
async descendantExistsByCssSelector(selector, parentElement, timeout = WAIT_FOR_EXISTS_TIME) {
@ -150,36 +154,36 @@ export function FindProvider({ getService }) {
async displayedByCssSelector(selector, timeout = defaultFindTimeout, parentElement) {
log.debug('in displayedByCssSelector: ' + selector);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findDisplayedByCssSelector(selector);
return await this._ensureElementWithTimeout(timeout, async leadfoot => {
return await leadfoot.findDisplayedByCssSelector(selector);
}, parentElement);
}
async byLinkText(selector, timeout = defaultFindTimeout) {
log.debug('Find.byLinkText: ' + selector);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findByLinkText(selector);
return await this._ensureElementWithTimeout(timeout, async leadfoot => {
return await leadfoot.findByLinkText(selector);
});
}
async findDisplayedByLinkText(selector, timeout = defaultFindTimeout) {
log.debug('Find.byLinkText: ' + selector);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findDisplayedByLinkText(selector);
return await this._ensureElementWithTimeout(timeout, async leadfoot => {
return await leadfoot.findDisplayedByLinkText(selector);
});
}
async byPartialLinkText(partialLinkText, timeout = defaultFindTimeout) {
log.debug(`find.byPartialLinkText(${partialLinkText})`);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findByPartialLinkText(partialLinkText);
return await this._ensureElementWithTimeout(timeout, async leadfoot => {
return await leadfoot.findByPartialLinkText(partialLinkText);
});
}
async exists(findFunction, timeout = WAIT_FOR_EXISTS_TIME) {
return await this._withTimeout(timeout, async remote => {
return await this._withTimeout(timeout, async leadfoot => {
try {
await findFunction(remote);
await findFunction(leadfoot);
return true;
} catch (error) {
return false;
@ -189,17 +193,17 @@ export function FindProvider({ getService }) {
async existsByLinkText(linkText, timeout = WAIT_FOR_EXISTS_TIME) {
log.debug(`existsByLinkText ${linkText}`);
return await this.exists(async remote => await remote.findDisplayedByLinkText(linkText), timeout);
return await this.exists(async leadfoot => await leadfoot.findDisplayedByLinkText(linkText), timeout);
}
async existsByDisplayedByCssSelector(selector, timeout = WAIT_FOR_EXISTS_TIME) {
log.debug(`existsByDisplayedByCssSelector ${selector}`);
return await this.exists(async remote => await remote.findDisplayedByCssSelector(selector), timeout);
return await this.exists(async leadfoot => await leadfoot.findDisplayedByCssSelector(selector), timeout);
}
async existsByCssSelector(selector, timeout = WAIT_FOR_EXISTS_TIME) {
log.debug(`existsByCssSelector ${selector}`);
return await this.exists(async remote => await remote.findByCssSelector(selector), timeout);
return await this.exists(async leadfoot => await leadfoot.findByCssSelector(selector), timeout);
}
async clickByCssSelectorWhenNotDisabled(selector, { timeout } = { timeout: defaultFindTimeout }) {
@ -208,7 +212,7 @@ export function FindProvider({ getService }) {
// will never be re-grabbed. Let errors bubble, but continue checking for disabled property until
// it's gone.
const element = await this.byCssSelector(selector, timeout);
await remote.moveMouseTo(element);
await leadfoot.moveMouseTo(element);
const clickIfNotDisabled = async (element, resolve) => {
const disabled = await element.getProperty('disabled');
@ -228,7 +232,7 @@ export function FindProvider({ getService }) {
log.debug(`clickByPartialLinkText(${linkText})`);
await retry.try(async () => {
const element = await this.byPartialLinkText(linkText, timeout);
await remote.moveMouseTo(element);
await leadfoot.moveMouseTo(element);
await element.click();
});
}
@ -237,12 +241,12 @@ export function FindProvider({ getService }) {
log.debug(`clickByLinkText(${linkText})`);
await retry.try(async () => {
const element = await this.byLinkText(linkText, timeout);
await remote.moveMouseTo(element);
await leadfoot.moveMouseTo(element);
await element.click();
});
}
async byButtonText(buttonText, element = remote, timeout = defaultFindTimeout) {
async byButtonText(buttonText, element = leadfoot, timeout = defaultFindTimeout) {
log.debug(`byButtonText(${buttonText})`);
return await retry.tryForTime(timeout, async () => {
const allButtons = await element.findAllByTagName('button');
@ -257,7 +261,7 @@ export function FindProvider({ getService }) {
});
}
async clickByButtonText(buttonText, element = remote, timeout = defaultFindTimeout) {
async clickByButtonText(buttonText, element = leadfoot, timeout = defaultFindTimeout) {
log.debug(`clickByButtonText(${buttonText})`);
await retry.try(async () => {
const button = await this.byButtonText(buttonText, element, timeout);
@ -269,7 +273,7 @@ export function FindProvider({ getService }) {
log.debug(`clickByCssSelector(${selector})`);
await retry.try(async () => {
const element = await this.byCssSelector(selector, timeout);
await remote.moveMouseTo(element);
await leadfoot.moveMouseTo(element);
await element.click();
});
}
@ -277,17 +281,20 @@ export function FindProvider({ getService }) {
log.debug(`clickByDisplayedLinkText(${linkText})`);
await retry.try(async () => {
const element = await this.findDisplayedByLinkText(linkText, timeout);
await remote.moveMouseTo(element);
await leadfoot.moveMouseTo(element);
await element.click();
});
}
async clickDisplayedByCssSelector(selector, timeout = defaultFindTimeout) {
await retry.try(async () => {
const element = await this.findDisplayedByCssSelector(selector, timeout);
await remote.moveMouseTo(element);
await leadfoot.moveMouseTo(element);
await element.click();
});
}
async waitForDeletedByCssSelector(selector) {
await leadfoot.waitForDeletedByCssSelector(selector);
}
}
return new Find();

View file

@ -31,5 +31,6 @@ export { EmbeddingProvider } from './embedding';
export { ComboBoxProvider } from './combo_box';
export { RenderableProvider } from './renderable';
export { TableProvider } from './table';
export { BrowserProvider } from './browser';
export * from './dashboard';

View file

@ -1,43 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { modifyUrl } from '../../../../src/core/utils';
export const createRemoteInterceptors = remote => ({
// inject _t=Date query param on navigation
async get(url, insertTimestamp = true) {
if (insertTimestamp) {
const urlWithTime = modifyUrl(url, parsed => {
parsed.query._t = Date.now();
});
return await remote.get(urlWithTime);
}
return await remote.get(url);
},
// strip _t=Date query param when url is read
async getCurrentUrl() {
const current = await remote.getCurrentUrl();
const currentWithoutTime = modifyUrl(current, parsed => {
delete parsed.query._t;
});
return currentWithoutTime;
}
});

View file

@ -18,7 +18,6 @@
*/
import { initLeadfootCommand } from './leadfoot_command';
import { createRemoteInterceptors } from './interceptors';
import { BrowserDriverApi } from './browser_driver_api';
export async function RemoteProvider({ getService }) {
@ -38,12 +37,11 @@ export async function RemoteProvider({ getService }) {
await browserDriverApi.start();
const { command } = await initLeadfootCommand({ log, browserDriverApi: browserDriverApi });
const interceptors = createRemoteInterceptors(command);
log.info('Remote initialized');
lifecycle.on('beforeTests', async () => {
// hard coded default, can be overridden per suite using `remote.setWindowSize()`
// hard coded default, can be overridden per suite using `browser.setWindowSize()`
// and will be automatically reverted after each suite
await command.setWindowSize(1600, 1000);
});
@ -66,10 +64,6 @@ export async function RemoteProvider({ getService }) {
return undefined;
}
if (interceptors.hasOwnProperty(prop)) {
return interceptors[prop];
}
return command[prop];
}
});

View file

@ -30,7 +30,7 @@ const writeFileAsync = promisify(writeFile);
export async function ScreenshotsProvider({ getService }) {
const log = getService('log');
const config = getService('config');
const remote = getService('remote');
const browser = getService('browser');
const SESSION_DIRECTORY = resolve(config.get('screenshots.directory'), 'session');
const FAILURE_DIRECTORY = resolve(config.get('screenshots.directory'), 'failure');
@ -75,7 +75,7 @@ export async function ScreenshotsProvider({ getService }) {
try {
log.info(`Taking screenshot "${path}"`);
const [screenshot] = await Promise.all([
remote.takeScreenshot(),
browser.takeScreenshot(),
fcb(cb => mkdirp(dirname(path), cb)),
]);
await fcb(cb => writeFile(path, screenshot, cb));

View file

@ -29,7 +29,7 @@ import { WAIT_FOR_EXISTS_TIME } from './find';
export function TestSubjectsProvider({ getService }) {
const log = getService('log');
const retry = getService('retry');
const remote = getService('remote');
const browser = getService('browser');
const find = getService('find');
const config = getService('config');
const defaultFindTimeout = config.get('timeouts.find');
@ -79,8 +79,8 @@ export function TestSubjectsProvider({ getService }) {
log.debug(`TestSubjects.doubleClick(${selector})`);
return await retry.try(async () => {
const element = await this.find(selector, timeout);
await remote.moveMouseTo(element);
await remote.doubleClick();
await browser.moveMouseTo(element);
await browser.doubleClick();
});
}
@ -139,7 +139,7 @@ export function TestSubjectsProvider({ getService }) {
// in case the input element is actually a child of the testSubject, we
// call clearValue() and type() on the element that is focused after
// clicking on the testSubject
const input = await remote.getActiveElement();
const input = await find.activeElement();
await input.clearValue();
await input.type(text);
});
@ -191,7 +191,7 @@ export function TestSubjectsProvider({ getService }) {
// moveMouseTo function.
await retry.try(async () => {
const element = await this.find(selector);
await remote.moveMouseTo(element);
await browser.moveMouseTo(element);
});
}
@ -203,7 +203,7 @@ export function TestSubjectsProvider({ getService }) {
}
async waitForDeleted(selector) {
await remote.waitForDeletedByCssSelector(testSubjSelector(selector));
await find.waitForDeletedByCssSelector(testSubjSelector(selector));
}
}

View file

@ -18,7 +18,7 @@
*/
export default function ({ getService, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
@ -27,7 +27,7 @@ export default function ({ getService, loadTestFile }) {
await esArchiver.loadIfNeeded('../functional/fixtures/es_archiver/logstash_functional');
await esArchiver.loadIfNeeded('../functional/fixtures/es_archiver/visualize');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'Australia/North', 'defaultIndex': 'logstash-*' });
await remote.setWindowSize(1300, 900);
await browser.setWindowSize(1300, 900);
});
loadTestFile(require.resolve('./self_changing_vis'));

View file

@ -18,7 +18,7 @@
*/
export default function ({ getService, getPageObjects, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'header']);
@ -28,7 +28,7 @@ export default function ({ getService, getPageObjects, loadTestFile }) {
await esArchiver.loadIfNeeded('../functional/fixtures/es_archiver/logstash_functional');
await esArchiver.load('../functional/fixtures/es_archiver/visualize_embedding');
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'Australia/North', 'defaultIndex': 'logstash-*' });
await remote.setWindowSize(1300, 900);
await browser.setWindowSize(1300, 900);
await PageObjects.common.navigateToApp('settings');
await PageObjects.header.clickGlobalNavigationLink('Embedding Vis');
});

View file

@ -24,13 +24,13 @@ export const DATA_ARCHIVE_PATH = path.resolve(__dirname, '../../../functional/fi
export default function ({ getService, getPageObjects, loadTestFile }) {
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['dashboard']);
describe('pluggable panel actions', function () {
before(async () => {
await remote.setWindowSize(1300, 900);
await browser.setWindowSize(1300, 900);
await PageObjects.dashboard.initTests({
kibanaIndex: KIBANA_ARCHIVE_PATH,
dataIndex: DATA_ARCHIVE_PATH,

View file

@ -10,7 +10,7 @@ import { parse } from 'url';
export default function canvasSmokeTest({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const remote = getService('remote');
const browser = getService('browser');
const retry = getService('retry');
const PageObjects = getPageObjects(['common']);
@ -46,7 +46,7 @@ export default function canvasSmokeTest({ getService, getPageObjects }) {
await retry.waitFor('workpad page', () => testSubjects.exists('canvasWorkpadPage'));
// check that workpad loaded in url
const url = await remote.getCurrentUrl();
const url = await browser.getCurrentUrl();
expect(parse(url).hash).to.equal(`#/workpad/${testWorkpadId}/page/1`);
});

View file

@ -9,7 +9,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const log = getService('log');
const find = getService('find');
const testSubjects = getService('testSubjects');
@ -37,7 +37,7 @@ export default function ({ getService, getPageObjects }) {
'defaultIndex': 'logstash-*'
});
await kibanaServer.uiSettings.disableToastAutohide();
remote.setWindowSize(1600, 1000);
browser.setWindowSize(1600, 1000);
await PageObjects.common.navigateToApp('discover');
await PageObjects.dashboard.setTimepickerInHistoricalDataRange();
@ -128,7 +128,7 @@ export default function ({ getService, getPageObjects }) {
});
it('shows the dashboard landing page by default', async () => {
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
console.log('url: ', currentUrl);
expect(currentUrl).to.contain('dashboards');
});

View file

@ -11,14 +11,14 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['settings', 'common', 'graph', 'header']);
const log = getService('log');
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
describe.skip('graph', function () { // eslint-disable-line jest/no-disabled-tests
before(async () => {
await remote.setWindowSize(1600, 1000);
await browser.setWindowSize(1600, 1000);
log.debug('load graph/secrepo data');
await esArchiver.loadIfNeeded('graph/secrepo');
await esArchiver.load('empty_kibana');

View file

@ -5,7 +5,7 @@
*/
export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const grokDebugger = getService('grokDebugger');
const esArchiver = getService('esArchiver');
@ -16,7 +16,7 @@ export default function ({ getService, getPageObjects }) {
await esArchiver.load('empty_kibana');
// Increase window height to ensure "Simulate" button is shown above the
// fold. Otherwise it can't be clicked by the browser driver.
remote.setWindowSize(1600, 1000);
browser.setWindowSize(1600, 1000);
await PageObjects.grokDebugger.gotoGrokDebugger();
});

View file

@ -7,7 +7,7 @@
import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const random = getService('random');
const pipelineList = getService('pipelineList');
@ -18,14 +18,14 @@ export default function ({ getService, getPageObjects }) {
let originalWindowSize;
before(async () => {
originalWindowSize = await remote.getWindowSize();
await remote.setWindowSize(1600, 1000);
originalWindowSize = await browser.getWindowSize();
await browser.setWindowSize(1600, 1000);
await esArchiver.load('logstash/empty');
});
after(async () => {
await esArchiver.unload('logstash/empty');
await remote.setWindowSize(originalWindowSize.width, originalWindowSize.height);
await browser.setWindowSize(originalWindowSize.width, originalWindowSize.height);
});
it('starts with the default values', async () => {

View file

@ -8,7 +8,7 @@ import expect from 'expect.js';
import { omit } from 'lodash';
export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const random = getService('random');
const pipelineList = getService('pipelineList');
@ -19,15 +19,15 @@ export default function ({ getService, getPageObjects }) {
let originalWindowSize;
before(async () => {
originalWindowSize = await remote.getWindowSize();
await remote.setWindowSize(1600, 1000);
originalWindowSize = await browser.getWindowSize();
await browser.setWindowSize(1600, 1000);
await esArchiver.load('logstash/example_pipelines');
await PageObjects.logstash.gotoPipelineList();
});
after(async () => {
await esArchiver.unload('logstash/example_pipelines');
await remote.setWindowSize(originalWindowSize.width, originalWindowSize.height);
await browser.setWindowSize(originalWindowSize.width, originalWindowSize.height);
});
it('shows example pipelines', async () => {

View file

@ -15,9 +15,9 @@ export const getLifecycleMethods = (getService, getPageObjects) => {
_archive = archive;
const kibanaServer = getService('kibanaServer');
const remote = getService('remote');
const browser = getService('browser');
await remote.setWindowSize(1600, 1000);
await browser.setWindowSize(1600, 1000);
await esArchiver.load(archive);
await kibanaServer.uiSettings.replace({

View file

@ -15,8 +15,8 @@ export default function ({ getService, getPageObjects }) {
describe('Monitoring is turned off', () => {
before(async () => {
const remote = getService('remote');
await remote.setWindowSize(1600, 1000);
const browser = getService('browser');
await browser.setWindowSize(1600, 1000);
await PageObjects.monitoring.navigateTo();
await noData.isOnNoDataPage();
});

View file

@ -9,7 +9,7 @@ import { indexBy } from 'lodash';
export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const retry = getService('retry');
const log = getService('log');
const screenshot = getService('screenshots');
@ -24,7 +24,7 @@ export default function ({ getService, getPageObjects }) {
before('initialize tests', async () => {
await esArchiver.load('empty_kibana');
await esArchiver.loadIfNeeded('security/dlstest');
remote.setWindowSize(1600, 1000);
browser.setWindowSize(1600, 1000);
await PageObjects.settings.createIndexPattern('dlstest', null);

View file

@ -9,7 +9,7 @@ import { indexBy } from 'lodash';
export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const retry = getService('retry');
const log = getService('log');
const PageObjects = getPageObjects(['security', 'settings', 'common', 'discover', 'header']);
@ -18,7 +18,7 @@ export default function ({ getService, getPageObjects }) {
before('initialize tests', async () => {
await esArchiver.loadIfNeeded('security/flstest');
await esArchiver.load('empty_kibana');
remote.setWindowSize(1600, 1000);
browser.setWindowSize(1600, 1000);
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndices();
await PageObjects.settings.createIndexPattern('flstest', null);

View file

@ -15,7 +15,7 @@ import {
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const remote = getService('remote');
const browser = getService('browser');
const PageObjects = getPageObjects(['security', 'settings', 'common', 'header']);
describe('Management', () => {
@ -44,13 +44,13 @@ export default function ({ getService, getPageObjects }) {
it('Can navigate to create user section', async () => {
await PageObjects.security.clickElasticsearchUsers();
await PageObjects.security.clickCreateNewUser();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(EDIT_USERS_PATH);
});
it('Clicking cancel in create user section brings user back to listing', async () => {
await PageObjects.security.clickCancelEditUser();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(USERS_PATH);
expect(currentUrl).to.not.contain(EDIT_USERS_PATH);
});
@ -66,14 +66,14 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.security.clickSaveEditUser();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(USERS_PATH);
expect(currentUrl).to.not.contain(EDIT_USERS_PATH);
});
it('Can navigate to edit user section', async () => {
await PageObjects.settings.clickLinkText('new-user');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(EDIT_USERS_PATH);
const userNameInput = await testSubjects.find('userFormUserNameInput');
// allow time for user to load
@ -84,19 +84,19 @@ export default function ({ getService, getPageObjects }) {
it('Can navigate to roles section', async () => {
await PageObjects.settings.clickLinkText('Roles');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(ROLES_PATH);
});
it('Can navigate to create role section', async () => {
await PageObjects.security.clickCreateNewRole();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(EDIT_ROLES_PATH);
});
it('Clicking cancel in create role section brings user back to listing', async () => {
await PageObjects.security.clickCancelEditRole();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(ROLES_PATH);
expect(currentUrl).to.not.contain(EDIT_ROLES_PATH);
});
@ -108,14 +108,14 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.security.clickSaveEditRole();
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(ROLES_PATH);
expect(currentUrl).to.not.contain(EDIT_ROLES_PATH);
});
it('Can navigate to edit role section', async () => {
await PageObjects.settings.clickLinkText('my-new-role');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(EDIT_ROLES_PATH);
const userNameInput = await testSubjects.find('roleFormNameInput');
@ -141,7 +141,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickLinkText('Users');
await PageObjects.settings.clickLinkText('kibana_dashboard_only_user');
const currentUrl = await remote.getCurrentUrl();
const currentUrl = await browser.getCurrentUrl();
expect(currentUrl).to.contain(EDIT_ROLES_PATH);
});
});

View file

@ -11,12 +11,12 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['security', 'settings', 'common', 'visualize', 'header']);
const log = getService('log');
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
describe('rbac ', async function () {
before(async () => {
await remote.setWindowSize(1600, 1000);
await browser.setWindowSize(1600, 1000);
log.debug('users');
await esArchiver.loadIfNeeded('logstash_functional');
log.debug('load kibana index with default index pattern');

View file

@ -11,7 +11,7 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['security', 'settings', 'monitoring', 'discover', 'common', 'reporting', 'header']);
const log = getService('log');
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
@ -20,7 +20,7 @@ export default function ({ getService, getPageObjects }) {
describe('secure roles and permissions', function () {
before(async () => {
await remote.setWindowSize(1600, 1000);
await browser.setWindowSize(1600, 1000);
log.debug('users');
await esArchiver.loadIfNeeded('logstash_functional');
log.debug('load kibana index with default index pattern');

View file

@ -11,14 +11,14 @@ const watchID = "watchID";
const watchName = "watch Name";
const updatedName = "updatedName";
export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const log = getService('log');
const PageObjects = getPageObjects(['security', 'common', 'header', 'settings', 'watcher']);
describe('watcher_test', function () {
before('initialize tests', async () => {
await remote.setWindowSize(1600, 1000);
await browser.setWindowSize(1600, 1000);
await PageObjects.common.navigateToApp('settings');
await PageObjects.settings.clickLinkText('Watcher');
await PageObjects.watcher.clearAllWatches();

View file

@ -5,11 +5,9 @@
*/
export function GraphPageProvider({ getService, getPageObjects }) {
const remote = getService('remote');
const config = getService('config');
const find = getService('find');
const log = getService('log');
const testSubjects = getService('testSubjects');
const defaultFindTimeout = config.get('timeouts.find');
const PageObjects = getPageObjects(['common', 'header', 'settings']);
const retry = getService('retry');
@ -17,23 +15,21 @@ export function GraphPageProvider({ getService, getPageObjects }) {
class GraphPage {
async selectIndexPattern(pattern) {
await remote.setFindTimeout(defaultFindTimeout).findDisplayedByCssSelector('.gphIndexSelect').click();
await remote.setFindTimeout(defaultFindTimeout).findByCssSelector('.gphIndexSelect > option[label="' + pattern + '"]').click();
await find.clickDisplayedByCssSelector('.gphIndexSelect');
await find.clickByCssSelector('.gphIndexSelect > option[label="' + pattern + '"]');
}
async clickAddField() {
await retry.try(async () => {
await remote.setFindTimeout(defaultFindTimeout).findById('addVertexFieldButton')
.click();
await find.clickByCssSelector('#addVertexFieldButton');
// make sure the fieldSelectionList is not hidden
await remote.setFindTimeout(defaultFindTimeout).findDisplayedByCssSelector('[data-test-subj="fieldSelectionList"]');
await testSubjects.exists('fieldSelectionList');
});
}
async selectField(field) {
await remote.setFindTimeout(defaultFindTimeout).findDisplayedByCssSelector('select[id="fieldList"] > option[label="' + field + '"]')
.click();
await remote.setFindTimeout(defaultFindTimeout).findDisplayedByCssSelector('button[ng-click="addFieldToSelection()"]').click();
await find.clickDisplayedByCssSelector('select[id="fieldList"] > option[label="' + field + '"]');
await find.clickDisplayedByCssSelector('button[ng-click="addFieldToSelection()"]');
}
async addField(field) {
@ -44,14 +40,13 @@ export function GraphPageProvider({ getService, getPageObjects }) {
}
async query(str) {
await remote.setFindTimeout(defaultFindTimeout).findByCssSelector('input.kuiLocalSearchInput').type(str);
await remote.setFindTimeout(defaultFindTimeout).findByCssSelector('button.kuiLocalSearchButton').click();
await find.setValue('input.kuiLocalSearchInput', str);
await find.clickDisplayedByCssSelector('button.kuiLocalSearchButton');
}
async getGraphCircleText() {
const chartTypes = await remote.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('text.gphNode__label');
const chartTypes = await find.allByCssSelector('text.gphNode__label');
async function getCircleText(circle) {
return circle.getVisibleText();
@ -62,8 +57,7 @@ export function GraphPageProvider({ getService, getPageObjects }) {
}
async getGraphConnectingLines() {
const chartTypes = await remote.setFindTimeout(defaultFindTimeout)
.findAllByCssSelector('line.edge');
const chartTypes = await find.allByCssSelector('line.edge');
async function getLineStyle(line) {
return line.getAttribute('style');
@ -75,16 +69,14 @@ export function GraphPageProvider({ getService, getPageObjects }) {
// click the line which matches the style
async clickGraphConnectingLine(style) {
await remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('line.edge[style="' + style + '"]').click();
await find.clickByCssSelector('line.edge[style="' + style + '"]');
}
async newGraph() {
log.debug('Click New Workspace');
await remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('[aria-label="New Workspace"]').click();
await find.clickByCssSelector('[aria-label="New Workspace"]');
await PageObjects.common.sleep(1000);
const modal = await remote.setFindTimeout(defaultFindTimeout).findByCssSelector('#kibana-body');
const modal = await find.byCssSelector('#kibana-body');
const page = await modal.getVisibleText();
if (page.includes('This will clear the workspace - are you sure?')) {
return testSubjects.click('confirmModalConfirmButton');
@ -92,62 +84,55 @@ export function GraphPageProvider({ getService, getPageObjects }) {
}
async saveGraph(name) {
await remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('[aria-label="Save Workspace"]').click();
await remote.setFindTimeout(defaultFindTimeout)
.findById('workspaceTitle').type(name);
await remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('button[aria-label="Save workspace"]').click();
await find.clickByCssSelector('[aria-label="Save Workspace"]');
await find.setValue('#workspaceTitle', name);
await find.clickByCssSelector('button[aria-label="Save workspace"]');
// Confirm that the Graph has been saved.
return await testSubjects.exists('saveGraphSuccess');
}
async openGraph(name) {
await remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('[aria-label="Load Saved Workspace"]').click();
await remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('input[name="filter"]').type(name);
await find.clickByCssSelector('[aria-label="Load Saved Workspace"]');
await find.setValue('input[name="filter"]', name);
await PageObjects.common.sleep(1000);
await remote.setFindTimeout(defaultFindTimeout)
.findByLinkText(name).click();
await find.clickByLinkText(name);
await PageObjects.common.sleep(5000);
}
async deleteGraph() {
await remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('[aria-label="Delete Saved Workspace"]').click();
await find.clickByCssSelector('[aria-label="Delete Saved Workspace"]');
await testSubjects.click('confirmModalConfirmButton');
}
getVennTerm1() {
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('span.vennTerm1').getVisibleText();
async getVennTerm1() {
const el = await find.byCssSelector('span.vennTerm1');
return await el.getVisibleText();
}
getVennTerm2() {
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('span.vennTerm2').getVisibleText();
async getVennTerm2() {
const el = await find.byCssSelector('span.vennTerm2');
return await el.getVisibleText();
}
getSmallVennTerm1() {
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('small.vennTerm1').getVisibleText();
async getSmallVennTerm1() {
const el = await find.byCssSelector('small.vennTerm1');
return await el.getVisibleText();
}
getSmallVennTerm12() {
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('small.vennTerm12').getVisibleText();
async getSmallVennTerm12() {
const el = await find.byCssSelector('small.vennTerm12');
return await el.getVisibleText();
}
getSmallVennTerm2() {
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('small.vennTerm2').getVisibleText();
async getSmallVennTerm2() {
const el = await find.byCssSelector('small.vennTerm2');
return await el.getVisibleText();
}
async getVennEllipse1() {
const el = await remote.setFindTimeout(defaultFindTimeout).findByCssSelector('ellipse.venn1');
const el = await find.byCssSelector('ellipse.venn1');
const cx = await el.getAttribute('cx');
const cy = await el.getAttribute('cy');
const rx = await el.getAttribute('rx');
@ -155,7 +140,7 @@ export function GraphPageProvider({ getService, getPageObjects }) {
}
async getVennEllipse2() {
const el = await remote.setFindTimeout(defaultFindTimeout).findByCssSelector('ellipse.venn2');
const el = await find.byCssSelector('ellipse.venn2');
const cx = await el.getAttribute('cx');
const cy = await el.getAttribute('cy');
const rx = await el.getAttribute('rx');

View file

@ -13,7 +13,7 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
const config = getService('config');
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const browser = getService('browser');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['common', 'security', 'header', 'settings', 'share']);
@ -28,22 +28,22 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
'defaultIndex': 'logstash-*'
});
await remote.setWindowSize(1600, 850);
await browser.setWindowSize(1600, 850);
}
async getUrlOfTab(tabIndex) {
return await retry.try(async () => {
log.debug(`reportingPage.getUrlOfTab(${tabIndex}`);
const handles = await remote.getAllWindowHandles();
const handles = await browser.getAllWindowHandles();
log.debug(`Switching to window ${handles[tabIndex]}`);
await remote.switchToWindow(handles[tabIndex]);
await browser.switchToWindow(handles[tabIndex]);
const url = await remote.getCurrentUrl();
const url = await browser.getCurrentUrl();
if (!url || url === 'about:blank') {
throw new Error('url is blank');
}
await remote.switchToWindow(handles[0]);
await browser.switchToWindow(handles[0]);
return url;
});
}
@ -51,16 +51,16 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
async closeTab(tabIndex) {
return await retry.try(async () => {
log.debug(`reportingPage.closeTab(${tabIndex}`);
const handles = await remote.getAllWindowHandles();
const handles = await browser.getAllWindowHandles();
log.debug(`Switching to window ${handles[tabIndex]}`);
await remote.switchToWindow(handles[tabIndex]);
await remote.closeCurrentWindow();
await remote.switchToWindow(handles[0]);
await browser.switchToWindow(handles[tabIndex]);
await browser.closeCurrentWindow();
await browser.switchToWindow(handles[0]);
});
}
async forceSharedItemsContainerSize({ width }) {
await remote.execute(`
await browser.execute(`
var el = document.querySelector('[data-shared-items-container]');
el.style.flex="none";
el.style.width="${width}px";
@ -68,7 +68,7 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
}
async removeForceSharedItemsContainerSize() {
await remote.execute(`
await browser.execute(`
var el = document.querySelector('[data-shared-items-container]');
el.style.flex = null;
el.style.width = null;

View file

@ -7,7 +7,7 @@
import { map as mapAsync } from 'bluebird';
export function SecurityPageProvider({ getService, getPageObjects }) {
const remote = getService('remote');
const browser = getService('browser');
const config = getService('config');
const retry = getService('retry');
const find = getService('find');
@ -15,7 +15,6 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const defaultFindTimeout = config.get('timeouts.find');
const PageObjects = getPageObjects(['common', 'header', 'settings', 'home']);
class LoginPage {
@ -36,10 +35,10 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
// wait for either space selector, kibanaChrome or loginErrorMessage
if (expectSpaceSelector) {
await retry.try(() => testSubjects.find('kibanaSpaceSelector'));
log.debug(`Finished login process, landed on space selector. currentUrl = ${await remote.getCurrentUrl()}`);
log.debug(`Finished login process, landed on space selector. currentUrl = ${await browser.getCurrentUrl()}`);
} else if (expectSuccess) {
await remote.setFindTimeout(20000).findByCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide) ');
log.debug(`Finished login process currentUrl = ${await remote.getCurrentUrl()}`);
await find.byCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide) ', 20000);
log.debug(`Finished login process currentUrl = ${await browser.getCurrentUrl()}`);
}
}
@ -67,7 +66,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
await esArchiver.load('empty_kibana');
await kibanaServer.uiSettings.disableToastAutohide();
await esArchiver.loadIfNeeded('logstash_functional');
remote.setWindowSize(1600, 1000);
browser.setWindowSize(1600, 1000);
}
async login(username, password, options = {}) {
@ -158,7 +157,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
async clickSaveEditRole() {
const saveButton = await retry.try(() => testSubjects.find('roleFormSaveButton'));
await remote.moveMouseTo(saveButton);
await browser.moveMouseTo(saveButton);
await saveButton.click();
await PageObjects.header.waitUntilLoadingHasFinished();
}
@ -195,22 +194,14 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
await PageObjects.common.navigateToApp('settings');
}
clickElasticsearchUsers() {
return this.navigateTo()
.then(() => {
return remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByLinkText('Users')
.click();
});
async clickElasticsearchUsers() {
await this.navigateTo();
await find.clickByDisplayedLinkText('Users');
}
clickElasticsearchRoles() {
return this.navigateTo()
.then(() => {
return remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByLinkText('Roles')
.click();
});
async clickElasticsearchRoles() {
await this.navigateTo();
await find.clickByDisplayedLinkText('Roles');
}
@ -291,9 +282,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
return testSubjects.append('roleFormNameInput', roleName);
})
.then(function () {
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('[data-test-subj="indicesInput0"] input')
.type(userObj.elasticsearch.indices[0].names + '\n');
return find.setValue('[data-test-subj="indicesInput0"] input', userObj.elasticsearch.indices[0].names + '\n');
})
.then(function () {
return testSubjects.click('restrictDocumentsQuery0');
@ -344,9 +333,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
return field.reduce(function (promise, fieldName) {
return promise
.then(function () {
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('[data-test-subj="fieldInput0"] input')
.type(fieldName + '\n');
return find.setValue('[data-test-subj="fieldInput0"] input', fieldName + '\n');
})
.then(function () {
return PageObjects.common.sleep(1000);
@ -357,9 +344,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
if (userObj.elasticsearch.indices[0].field_security) {
// have to remove the '*'
return remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('div[data-test-subj="fieldInput0"] .euiBadge[title="*"]')
.click()
return find.clickByCssSelector('div[data-test-subj="fieldInput0"] .euiBadge[title="*"]')
.then(function () {
return addGrantedField(userObj.elasticsearch.indices[0].field_security.grant);
});
@ -386,7 +371,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
deleteUser(username) {
let alertText;
log.debug('Delete user ' + username);
return remote.findDisplayedByLinkText(username).click()
return find.clickByDisplayedLinkText(username)
.then(() => {
return PageObjects.header.awaitGlobalLoadingIndicatorHidden();
})
@ -410,10 +395,9 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
});
}
getPermissionDeniedMessage() {
return remote.setFindTimeout(defaultFindTimeout)
.findDisplayedByCssSelector('span.kuiInfoPanelHeader__title')
.getVisibleText();
async getPermissionDeniedMessage() {
const el = await find.displayedByCssSelector('span.kuiInfoPanelHeader__title');
return await el.getVisibleText();
}
}
return new SecurityPage();

View file

@ -10,7 +10,8 @@ export function SpaceSelectorPageProvider({ getService, getPageObjects }) {
const retry = getService('retry');
const log = getService('log');
const testSubjects = getService('testSubjects');
const remote = getService('remote');
const browser = getService('browser');
const find = getService('find');
const PageObjects = getPageObjects(['common', 'home', 'security']);
class SpaceSelectorPage {
@ -30,8 +31,8 @@ export function SpaceSelectorPageProvider({ getService, getPageObjects }) {
return await retry.try(async () => {
log.debug(`expectHomePage(${spaceId})`);
await this.dismissWelcomeScreen();
await remote.setFindTimeout(20000).findByCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide) ');
const url = await remote.getCurrentUrl();
await find.byCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide) ', 20000);
const url = await browser.getCurrentUrl();
if (spaceId === 'default') {
expect(url).to.contain(`/app/kibana#/home`);
} else {

View file

@ -9,7 +9,8 @@ import expect from 'expect.js';
export function StatusPagePageProvider({ getService, getPageObjects }) {
const retry = getService('retry');
const log = getService('log');
const remote = getService('remote');
const browser = getService('browser');
const find = getService('find');
const PageObjects = getPageObjects(['common', 'home', 'security']);
class StatusPage {
@ -21,15 +22,15 @@ export function StatusPagePageProvider({ getService, getPageObjects }) {
return await retry.try(async () => {
const url = PageObjects.common.getHostPort() + '/status';
log.info(`StatusPage:navigateToPage(): ${url}`);
await remote.get(url);
await browser.get(url);
});
}
async expectStatusPage() {
return await retry.try(async () => {
log.debug(`expectStatusPage()`);
await remote.setFindTimeout(20000).findByCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide) ');
const url = await remote.getCurrentUrl();
await find.byCssSelector('[data-test-subj="kibanaChrome"] nav:not(.ng-hide) ', 20000);
const url = await browser.getCurrentUrl();
expect(url).to.contain(`/status`);
});
}

View file

@ -8,7 +8,7 @@ import { map as mapAsync } from 'bluebird';
export function WatcherPageProvider({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['common', 'header', 'settings']);
const remote = getService('remote');
const find = getService('find');
const testSubjects = getService('testSubjects');
class WatcherPage {
@ -24,8 +24,8 @@ export function WatcherPageProvider({ getPageObjects, getService }) {
async createWatch(watchName, name) {
await testSubjects.click('createAdvancedWatchButton');
await remote.findById('id').type(watchName);
await remote.findById('name').type(name);
await find.setValue('#id', watchName);
await find.setValue('#name', name);
await testSubjects.click('btnSaveWatch');
await PageObjects.header.waitUntilLoadingHasFinished();
}
@ -47,7 +47,7 @@ export function WatcherPageProvider({ getPageObjects, getService }) {
//get all the watches in the list
async getWatches() {
const watches = await remote.findAllByCssSelector('.kuiTableRow');
const watches = await find.allByCssSelector('.kuiTableRow');
return mapAsync(watches, async watch => {
const checkBox = await watch.findByCssSelector('td:nth-child(1)');
const id = await watch.findByCssSelector('td:nth-child(2)');

View file

@ -8,7 +8,7 @@ import { map as mapAsync } from 'bluebird';
export function AceEditorProvider({ getService }) {
const testSubjects = getService('testSubjects');
const remote = getService('remote');
const find = getService('find');
const retry = getService('retry');
// see https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions
@ -21,7 +21,7 @@ export function AceEditorProvider({ getService }) {
await retry.try(async () => {
const container = await testSubjects.find(testSubjectSelector);
await container.click();
const input = await remote.getActiveElement();
const input = await find.activeElement();
const modifier = process.platform === 'darwin' ? CMD_KEY : CTRL_KEY;
await input.type([modifier, 'a']); // select all