Skip to content

Commit

Permalink
Rollup Job a11y Tests (#134975) (#135090)
Browse files Browse the repository at this point in the history
(cherry picked from commit a92f79c)

# Conflicts:
#	x-pack/test/accessibility/config.ts
  • Loading branch information
John Dorlus authored Jun 24, 2022
1 parent d4b35e1 commit e6d3810
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
92 changes: 92 additions & 0 deletions x-pack/test/accessibility/apps/rollup_jobs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'settings', 'header', 'rollup']);
const a11y = getService('a11y');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const es = getService('es');

describe('Stack management- rollup a11y tests', () => {
const rollupJobName = `rollup${Date.now().toString()}`;
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.uiSettings.update({
defaultIndex: 'logstash-*',
});
await PageObjects.settings.navigateTo();
await PageObjects.rollup.clickRollupJobsTab();
});

it('empty state', async () => {
await a11y.testAppSnapshot();
});

describe('create a rollup job wizard', async () => {
it('step 1 - logistics', async () => {
await testSubjects.click('createRollupJobButton');
await PageObjects.rollup.verifyStepIsActive(1);
await a11y.testAppSnapshot();
});

it('step 2 - date histogram', async () => {
await PageObjects.rollup.addRollupNameandIndexPattern(rollupJobName, 'logstash*');
await PageObjects.rollup.verifyIndexPatternAccepted();
await PageObjects.rollup.setIndexName('rollupindex');
await PageObjects.rollup.moveToNextStep(2);
await PageObjects.rollup.verifyStepIsActive(2);
await a11y.testAppSnapshot();
});

it('step 3 - terms', async () => {
await PageObjects.rollup.setJobInterval('24h');
await PageObjects.rollup.moveToNextStep(3);
await PageObjects.rollup.verifyStepIsActive(3);
await a11y.testAppSnapshot();
});

it('step 4 - histogram', async () => {
await PageObjects.rollup.moveToNextStep(4);
await PageObjects.rollup.verifyStepIsActive(4);
await a11y.testAppSnapshot();
});

it('step 5 - metrics', async () => {
await PageObjects.rollup.moveToNextStep(5);
await PageObjects.rollup.verifyStepIsActive(5);
await a11y.testAppSnapshot();
});

it('step 6 - review and save', async () => {
await PageObjects.rollup.moveToNextStep(6);
await PageObjects.rollup.verifyStepIsActive(6);
await a11y.testAppSnapshot();
});

it('submit form and snapshot rollup flyout', async () => {
await PageObjects.rollup.saveJob(false);
await a11y.testAppSnapshot();
});

it('rollup table', async () => {
await PageObjects.rollup.closeFlyout();
await a11y.testAppSnapshot();
});
});

after(async () => {
await es.transport.request({
path: `/_rollup/job/${rollupJobName}`,
method: 'DELETE',
});
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});
});
}
18 changes: 18 additions & 0 deletions x-pack/test/functional/page_objects/rollup_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class RollupPageObject extends FtrService {
private readonly log = this.ctx.getService('log');
private readonly find = this.ctx.getService('find');
private readonly header = this.ctx.getPageObject('header');
private readonly retry = this.ctx.getService('retry');

async createNewRollUpJob(
jobName: string,
Expand Down Expand Up @@ -56,6 +57,13 @@ export class RollupPageObject extends FtrService {
await this.saveJob(startImmediately);
}

async clickRollupJobsTab() {
await this.testSubjects.click('rollup_jobs');
await this.retry.waitFor('create policy button to be visible', async () => {
return await this.testSubjects.isDisplayed('createRollupJobButton');
});
}

async verifyStepIsActive(stepNumber = 0) {
await this.testSubjects.exists(`createRollupStep${stepNumber}--active`);
}
Expand Down Expand Up @@ -106,6 +114,16 @@ export class RollupPageObject extends FtrService {
}
await this.testSubjects.click('rollupJobSaveButton');
await this.header.waitUntilLoadingHasFinished();
await this.retry.waitFor('detail flyout', async () => {
return await this.testSubjects.isDisplayed('rollupJobDetailsFlyoutTitle');
});
}

async closeFlyout() {
await this.testSubjects.click('euiFlyoutCloseButton');
await this.retry.waitFor('rollup list table', async () => {
return await this.testSubjects.isDisplayed('rollupJobsListTable');
});
}

async getJobList() {
Expand Down

0 comments on commit e6d3810

Please sign in to comment.