Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ftr] take screenshots on failure #11709

Merged
merged 6 commits into from
May 11, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/functional_test_runner/lib/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function createLifecycle() {
}

listeners[name].push(fn);
return this;
}

async trigger(name, ...args) {
Expand Down
7 changes: 4 additions & 3 deletions test/functional/apps/console/_console.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GET _search
export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const log = getService('log');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['common', 'console']);

describe('console app', function describeIndexTests() {
Expand All @@ -23,11 +24,11 @@ export default function ({ getService, getPageObjects }) {
});

it('should show the default request', function () {
PageObjects.common.saveScreenshot('Console-help-expanded');
screenshots.take('Console-help-expanded');
// collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled
return PageObjects.console.collapseHelp()
.then(function () {
PageObjects.common.saveScreenshot('Console-help-collapsed');
screenshots.take('Console-help-collapsed');
return retry.try(function () {
return PageObjects.console.getRequest()
.then(function (actualRequest) {
Expand All @@ -42,7 +43,7 @@ export default function ({ getService, getPageObjects }) {

return PageObjects.console.clickPlay()
.then(function () {
PageObjects.common.saveScreenshot('Console-default-request');
screenshots.take('Console-default-request');
return retry.try(function () {
return PageObjects.console.getResponse()
.then(function (actualResponse) {
Expand Down
13 changes: 7 additions & 6 deletions test/functional/apps/dashboard/_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const log = getService('log');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize']);

describe('dashboard tab', function describeIndexTests() {
Expand All @@ -16,7 +17,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should be able to add visualizations to dashboard', async function addVisualizations() {
await PageObjects.common.saveScreenshot('Dashboard-no-visualizations');
await screenshots.take('Dashboard-no-visualizations');

// 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
Expand All @@ -29,7 +30,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.addVisualizations(PageObjects.dashboard.getTestVisualizationNames());

log.debug('done adding visualizations');
await PageObjects.common.saveScreenshot('Dashboard-add-visualizations');
await screenshots.take('Dashboard-add-visualizations');
});

it('set the timepicker time to that which contains our test data', async function setTimepicker() {
Expand All @@ -46,7 +47,7 @@ export default function ({ getService, getPageObjects }) {
log.debug('now re-load previously saved dashboard');
return PageObjects.dashboard.loadSavedDashboard(dashboardName);
});
await PageObjects.common.saveScreenshot('Dashboard-load-saved');
await screenshots.take('Dashboard-load-saved');
});

it('should have all the expected visualizations', function checkVisualizations() {
Expand All @@ -58,7 +59,7 @@ export default function ({ getService, getPageObjects }) {
});
})
.then(function () {
PageObjects.common.saveScreenshot('Dashboard-has-visualizations');
screenshots.take('Dashboard-has-visualizations');
});
});

Expand All @@ -79,7 +80,7 @@ export default function ({ getService, getPageObjects }) {
return PageObjects.dashboard.getPanelSizeData()
.then(function (panelTitles) {
log.info('visualization titles = ' + panelTitles);
PageObjects.common.saveScreenshot('Dashboard-visualization-sizes');
screenshots.take('Dashboard-visualization-sizes');
expect(panelTitles).to.eql(visObjects);
});
});
Expand Down Expand Up @@ -139,7 +140,7 @@ export default function ({ getService, getPageObjects }) {
return retry.tryForTime(10000, async function () {
const panelTitles = await PageObjects.dashboard.getPanelSizeData();
log.info('visualization titles = ' + panelTitles.map(item => item.title));
PageObjects.common.saveScreenshot('Dashboard-visualization-sizes');
screenshots.take('Dashboard-visualization-sizes');
expect(panelTitles.length).to.eql(visualizations.length + 1);
});
});
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/discover/_collapse_expand.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default function ({ getService, getPageObjects }) {
const log = getService('log');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['common', 'discover', 'header']);

describe('discover tab', function describeIndexTests() {
Expand Down Expand Up @@ -36,7 +37,7 @@ export default function ({ getService, getPageObjects }) {

describe('field data', function () {
it('should initially be expanded', function () {
PageObjects.common.saveScreenshot('Discover-sidebar-expanded');
screenshots.take('Discover-sidebar-expanded');
return PageObjects.discover.getSidebarWidth()
.then(function (width) {
log.debug('expanded sidebar width = ' + width);
Expand All @@ -47,7 +48,7 @@ export default function ({ getService, getPageObjects }) {
it('should collapse when clicked', function () {
return PageObjects.discover.toggleSidebarCollapse()
.then(function () {
PageObjects.common.saveScreenshot('Discover-sidebar-collapsed');
screenshots.take('Discover-sidebar-collapsed');
log.debug('PageObjects.discover.getSidebarWidth()');
return PageObjects.discover.getSidebarWidth();
})
Expand Down
7 changes: 4 additions & 3 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const remote = getService('remote');
const kibanaServer = getService('kibanaServer');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['common', 'discover', 'header']);

describe('discover app', function describeIndexTests() {
Expand Down Expand Up @@ -48,7 +49,7 @@ export default function ({ getService, getPageObjects }) {

const expectedToastMessage = `Discover: Saved Data Source "${queryName1}"`;
expect(toastMessage).to.be(expectedToastMessage);
await PageObjects.common.saveScreenshot('Discover-save-query-toast');
await screenshots.take('Discover-save-query-toast');

await PageObjects.header.waitForToastMessageGone();
const actualQueryNameString = await PageObjects.discover.getCurrentQueryName();
Expand All @@ -62,7 +63,7 @@ export default function ({ getService, getPageObjects }) {
await retry.try(async function() {
expect(await PageObjects.discover.getCurrentQueryName()).to.be(queryName1);
});
await PageObjects.common.saveScreenshot('Discover-load-query');
await screenshots.take('Discover-load-query');
});

it('should show the correct hit count', async function () {
Expand Down Expand Up @@ -208,7 +209,7 @@ export default function ({ getService, getPageObjects }) {
it('should show "no results"', async () => {
const isVisible = await PageObjects.discover.hasNoResults();
expect(isVisible).to.be(true);
await PageObjects.common.saveScreenshot('Discover-no-results');
await screenshots.take('Discover-no-results');
});

it('should suggest a new time range is picked', async () => {
Expand Down
7 changes: 4 additions & 3 deletions test/functional/apps/discover/_field_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['common', 'header', 'discover']);

describe('discover app', function describeIndexTests() {
Expand Down Expand Up @@ -44,7 +45,7 @@ export default function ({ getService, getPageObjects }) {
return retry.try(function tryingForTime() {
return PageObjects.discover.getHitCount()
.then(function compareData(hitCount) {
PageObjects.common.saveScreenshot('Discover-field-data');
screenshots.take('Discover-field-data');
expect(hitCount).to.be(expectedHitCount);
});
});
Expand Down Expand Up @@ -217,7 +218,7 @@ export default function ({ getService, getPageObjects }) {
return retry.try(function tryingForTime() {
return PageObjects.discover.getDocTableIndex(1)
.then(function (rowData) {
PageObjects.common.saveScreenshot('Discover-sort-down');
screenshots.take('Discover-sort-down');
expect(rowData).to.be(ExpectedDoc);
});
});
Expand All @@ -232,7 +233,7 @@ export default function ({ getService, getPageObjects }) {
return PageObjects.header.getToastMessage();
})
.then(function (toastMessage) {
PageObjects.common.saveScreenshot('Discover-syntax-error-toast');
screenshots.take('Discover-syntax-error-toast');
expect(toastMessage).to.be(expectedError);
})
.then(function () {
Expand Down
7 changes: 4 additions & 3 deletions test/functional/apps/discover/_shared_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default function ({ getService, getPageObjects }) {
const log = getService('log');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['common', 'discover', 'header']);

describe('shared links', function describeIndexTests() {
Expand Down Expand Up @@ -60,7 +61,7 @@ export default function ({ getService, getPageObjects }) {
const expectedCaption = 'Share saved';
return PageObjects.discover.clickShare()
.then(function () {
PageObjects.common.saveScreenshot('Discover-share-link');
screenshots.take('Discover-share-link');
return PageObjects.discover.getShareCaption();
})
.then(function (actualCaption) {
Expand Down Expand Up @@ -90,7 +91,7 @@ export default function ({ getService, getPageObjects }) {
return PageObjects.header.getToastMessage();
})
.then(function (toastMessage) {
PageObjects.common.saveScreenshot('Discover-copy-to-clipboard-toast');
screenshots.take('Discover-copy-to-clipboard-toast');
expect(toastMessage).to.match(expectedToastMessage);
})
.then(function () {
Expand All @@ -104,7 +105,7 @@ export default function ({ getService, getPageObjects }) {
return PageObjects.discover.clickShortenUrl()
.then(function () {
return retry.try(function tryingForTime() {
PageObjects.common.saveScreenshot('Discover-shorten-url-button');
screenshots.take('Discover-shorten-url-button');
return PageObjects.discover.getSharedUrl()
.then(function (actualUrl) {
expect(actualUrl).to.match(re);
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/management/_creation_form_changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import expect from 'expect.js';

export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['settings', 'common']);

describe('user input reactions', function () {
Expand All @@ -22,7 +23,7 @@ export default function ({ getService, getPageObjects }) {
.then(function () {
return PageObjects.settings.getCreateButton().isEnabled()
.then(function (enabled) {
PageObjects.common.saveScreenshot('Settings-indices-enable-creation');
screenshots.take('Settings-indices-enable-creation');
expect(enabled).to.be.ok();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default function ({ getService, getPageObjects }) {
const remote = getService('remote');
const log = getService('log');
const retry = getService('retry');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['settings', 'common']);

describe('creating and deleting default index', function describeIndexTests() {
Expand All @@ -27,7 +28,7 @@ export default function ({ getService, getPageObjects }) {
it('should have index pattern in page header', function () {
return PageObjects.settings.getIndexPageHeading().getVisibleText()
.then(function (patternName) {
PageObjects.common.saveScreenshot('Settings-indices-new-index-pattern');
screenshots.take('Settings-indices-new-index-pattern');
expect(patternName).to.be('logstash-*');
});
});
Expand Down Expand Up @@ -75,7 +76,7 @@ export default function ({ getService, getPageObjects }) {
const expectedAlertText = 'Are you sure you want to remove this index pattern?';
return PageObjects.settings.removeIndexPattern()
.then(function (alertText) {
PageObjects.common.saveScreenshot('Settings-indices-confirm-remove-index-pattern');
screenshots.take('Settings-indices-confirm-remove-index-pattern');
expect(alertText).to.be(expectedAlertText);
});
});
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/management/_index_pattern_popularity.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const log = getService('log');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['settings', 'common']);

describe('index result popularity', function describeIndexTests() {
Expand Down Expand Up @@ -51,7 +52,7 @@ export default function ({ getService, getPageObjects }) {
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
PageObjects.common.saveScreenshot('Settings-indices-result-popularity-updated');
screenshots.take('Settings-indices-result-popularity-updated');
});

it('should be reset on cancel', async function () {
Expand All @@ -73,7 +74,7 @@ export default function ({ getService, getPageObjects }) {
const popularity = await PageObjects.settings.getPopularity();
log.debug('popularity = ' + popularity);
expect(popularity).to.be('1');
PageObjects.common.saveScreenshot('Settings-indices-result-popularity-saved');
screenshots.take('Settings-indices-result-popularity-saved');
});
}); // end 'change popularity'
}); // end index result popularity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['settings', 'common']);

describe('index result field sort', function describeIndexTests() {
Expand Down Expand Up @@ -50,7 +51,7 @@ export default function ({ getService, getPageObjects }) {
return col.selector();
})
.then(function (rowText) {
PageObjects.common.saveScreenshot(`Settings-indices-column-${col.heading}-sort-ascending`);
screenshots.take(`Settings-indices-column-${col.heading}-sort-ascending`);
expect(rowText).to.be(col.first);
});
});
Expand All @@ -64,7 +65,7 @@ export default function ({ getService, getPageObjects }) {
return col.selector();
})
.then(function (rowText) {
PageObjects.common.saveScreenshot(`Settings-indices-column-${col.heading}-sort-descending`);
screenshots.take(`Settings-indices-column-${col.heading}-sort-descending`);
expect(rowText).to.be(col.last);
});
});
Expand Down Expand Up @@ -108,7 +109,7 @@ export default function ({ getService, getPageObjects }) {
for (let pageNum = 1; pageNum <= LAST_PAGE_NUMBER; pageNum += 1) {
await PageObjects.settings.goToPage(pageNum);
const pageFieldNames = await retry.tryMethod(PageObjects.settings, 'getFieldNames');
await PageObjects.common.saveScreenshot(`Settings-indexed-fields-page-${pageNum}`);
await screenshots.take(`Settings-indexed-fields-page-${pageNum}`);

if (pageNum === LAST_PAGE_NUMBER) {
expect(pageFieldNames).to.have.length(EXPECTED_LAST_PAGE_COUNT);
Expand Down
7 changes: 4 additions & 3 deletions test/functional/apps/management/_kibana_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import expect from 'expect.js';
export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
const log = getService('log');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['settings', 'common']);

describe('creating and deleting default index', function describeIndexTests() {
Expand Down Expand Up @@ -32,12 +33,12 @@ export default function ({ getService, getPageObjects }) {
it('should allow setting advanced settings', function () {
return PageObjects.settings.clickKibanaSettings()
.then(function TestCallSetAdvancedSettingsForTimezone() {
PageObjects.common.saveScreenshot('Settings-advanced-tab');
screenshots.take('Settings-advanced-tab');
log.debug('calling setAdvancedSetting');
return PageObjects.settings.setAdvancedSettings('dateFormat:tz', 'America/Phoenix');
})
.then(function GetAdvancedSetting() {
PageObjects.common.saveScreenshot('Settings-set-timezone');
screenshots.take('Settings-set-timezone');
return PageObjects.settings.getAdvancedSettings('dateFormat:tz');
})
.then(function (advancedSetting) {
Expand All @@ -48,7 +49,7 @@ export default function ({ getService, getPageObjects }) {
after(function () {
return PageObjects.settings.clickKibanaSettings()
.then(function TestCallSetAdvancedSettingsForTimezone() {
PageObjects.common.saveScreenshot('Settings-advanced-tab');
screenshots.take('Settings-advanced-tab');
log.debug('calling setAdvancedSetting');
return PageObjects.settings.setAdvancedSettings('dateFormat:tz', 'UTC');
});
Expand Down
5 changes: 3 additions & 2 deletions test/functional/apps/management/_scripted_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function ({ getService, getPageObjects }) {
const log = getService('log');
const remote = getService('remote');
const retry = getService('retry');
const screenshots = getService('screenshots');
const PageObjects = getPageObjects(['common', 'header', 'settings', 'visualize', 'discover']);

describe('scripted fields', () => {
Expand Down Expand Up @@ -102,7 +103,7 @@ export default function ({ getService, getPageObjects }) {
await log.debug('getDataTableData = ' + data.split('\n'));
await log.debug('data=' + data);
await log.debug('data.length=' + data.length);
await PageObjects.common.saveScreenshot('Visualize-vertical-bar-chart');
await screenshots.take('Visualize-vertical-bar-chart');
expect(data.trim().split('\n')).to.eql(expectedChartValues);
});
});
Expand Down Expand Up @@ -169,7 +170,7 @@ export default function ({ getService, getPageObjects }) {
await log.debug('getDataTableData = ' + data.split('\n'));
await log.debug('data=' + data);
await log.debug('data.length=' + data.length);
await PageObjects.common.saveScreenshot('Visualize-vertical-bar-chart');
await screenshots.take('Visualize-vertical-bar-chart');
expect(data.trim().split('\n')).to.eql(expectedChartValues);
});
});
Expand Down
Loading