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

Rollup Job a11y Tests #134975

Merged
merged 2 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
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');
});
});
}
1 change: 1 addition & 0 deletions x-pack/test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/tags'),
require.resolve('./apps/search_sessions'),
require.resolve('./apps/stack_monitoring'),
require.resolve('./apps/rollup_jobs'),
],

pageObjects,
Expand Down
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