Skip to content

Commit

Permalink
Cross cluster replication a11y tests (#135514)
Browse files Browse the repository at this point in the history
* Added CCR a11y tests covering all screens.

* Fixed test that broke after update. Returned a method that was removed.

* Switched order of remote clusters a11y and ccr.

* Switched orders of ccr, snapshot and restore and remote cluster tets. They need to be ran in a certain order.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Bhavya RM <bhavya@elastic.co>
  • Loading branch information
3 people committed Jul 4, 2022
1 parent 78a03e3 commit b52ff2a
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 0 deletions.
100 changes: 100 additions & 0 deletions x-pack/test/accessibility/apps/cross_cluster_replication.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* 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',
'remoteClusters',
'crossClusterReplication',
]);
const a11y = getService('a11y');
const testSubjects = getService('testSubjects');
const find = getService('find');
const es = getService('es');
const retry = getService('retry');

describe('cross cluster replication - a11y tests', async () => {
before(async () => {
await PageObjects.common.navigateToApp('crossClusterReplication');
});

describe('follower index tab', async () => {
const remoteName = `testremote${Date.now().toString()}`;
const testIndex = `testindex${Date.now().toString()}`;
const testFollower = `follower${Date.now().toString()}`;
const testLeader = `leader${Date.now().toString()}`;
const autoFollower = `autofollow${Date.now().toString()}`;
it('empty follower index table', async () => {
await a11y.testAppSnapshot();
});
describe('follower index tab', async () => {
describe('follower index form', async () => {
before(async () => {
await PageObjects.common.navigateToApp('remoteClusters');
await PageObjects.remoteClusters.createNewRemoteCluster(remoteName, 'localhost:9300');
await es.indices.create({ index: testIndex });
await es.indices.create({ index: testLeader });
});
it('create follow index form', async () => {
await PageObjects.common.navigateToApp('crossClusterReplication');
await PageObjects.crossClusterReplication.clickCreateFollowerIndexButton();
await a11y.testAppSnapshot();
await PageObjects.crossClusterReplication.createFollowerIndex(testLeader, testFollower);
});
it('follower index flyout', async () => {
// https://github.com/elastic/kibana/issues/135503
// Skipping this snapshot because there is an existing a11y violation.
// await a11y.testAppSnapshot();
await testSubjects.click('closeFlyoutButton');
await retry.waitFor('follower index table to be visible', async () => {
return await (await find.byCssSelector('table')).isDisplayed();
});
});
it('follower index table', async () => {
await a11y.testAppSnapshot();
});
after(async () => {
await es.indices.delete({ index: testIndex });
});
});
});
describe('auto-follower patterns', async () => {
describe('auto follower index form', async () => {
before(async () => {
await PageObjects.crossClusterReplication.clickAutoFollowerTab();
});
it('empty auto follower home screen', async () => {
await a11y.testAppSnapshot();
});
it('auto follower index page ', async () => {
await PageObjects.crossClusterReplication.clickAutoFollowerPatternButton();
await a11y.testAppSnapshot();
await PageObjects.crossClusterReplication.createAutoFollowerPattern(
autoFollower,
'logstash*'
);
});
it('auto follower index flyout', async () => {
// https://github.com/elastic/kibana/issues/135506
// Skipping this snapshot because there is an existing a11y violation.
// await a11y.testAppSnapshot();
await testSubjects.click('closeFlyoutButton');
await retry.waitFor('auto follower index table to be visible', async () => {
return await (await find.byCssSelector('table')).isDisplayed();
});
});
it('auto follow index table with data', async () => {
await a11y.testAppSnapshot();
});
});
});
});
});
}
3 changes: 3 additions & 0 deletions x-pack/test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/graph'),
require.resolve('./apps/security_solution'),
require.resolve('./apps/ml_embeddables_in_dashboard'),
// Please make sure that the remote clusters, snapshot and restore and
// CCR tests stay in that order. Their execution fails if rearranged.
require.resolve('./apps/remote_clusters'),
require.resolve('./apps/snapshot_and_restore'),
require.resolve('./apps/cross_cluster_replication'),
require.resolve('./apps/reporting'),
require.resolve('./apps/enterprise_search'),
require.resolve('./apps/license_management'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { FtrProviderContext } from '../ftr_provider_context';

export function CrossClusterReplicationPageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const comboBox = getService('comboBox');

return {
async appTitleText() {
Expand All @@ -17,5 +19,41 @@ export function CrossClusterReplicationPageProvider({ getService }: FtrProviderC
async createFollowerIndexButton() {
return await testSubjects.find('createFollowerIndexButton');
},
async clickAutoFollowerTab() {
await testSubjects.click('autoFollowPatternsTab');
await retry.waitFor('create auto follow button', async () => {
return await testSubjects.isDisplayed('createAutoFollowPatternButton');
});
},
async clickCreateFollowerIndexButton() {
await (await this.createFollowerIndexButton()).click();
await retry.waitFor('app title to say Add follower index', async () => {
return (
(await (await testSubjects.find('pageTitle')).getVisibleText()) === 'Add follower index'
);
});
},
async clickAutoFollowerPatternButton() {
await testSubjects.click('createAutoFollowPatternButton');
await retry.waitFor('name input to show up', async () => {
return await testSubjects.isDisplayed('nameInput');
});
},
async createFollowerIndex(leader: string, follower: string) {
await testSubjects.setValue('leaderIndexInput', leader);
await testSubjects.setValue('followerIndexInput', follower);
await testSubjects.click('submitButton');
await retry.waitForWithTimeout('follower index to be in table', 45000, async () => {
return await testSubjects.isDisplayed('maxReadReqSize');
});
},
async createAutoFollowerPattern(name: string, indexPattern: string) {
await testSubjects.setValue('nameInput', name);
await comboBox.setCustom('comboBoxInput', indexPattern);
await testSubjects.click('submitButton');
await retry.waitForWithTimeout('flyout title to show up', 20000, async () => {
return await testSubjects.isDisplayed('settingsValues');
});
},
};
}
17 changes: 17 additions & 0 deletions x-pack/test/functional/page_objects/remote_clusters_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,27 @@ import { FtrProviderContext } from '../ftr_provider_context';

export function RemoteClustersPageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const comboBox = getService('comboBox');
const retry = getService('retry');

return {
async remoteClusterCreateButton() {
return await testSubjects.find('remoteClusterEmptyPromptCreateButton');
},
async createNewRemoteCluster(
name: string,
seedNode: string,
proxyMode?: boolean,
nodeConnections?: number,
skipIfUnavailable?: boolean
) {
await (await this.remoteClusterCreateButton()).click();
await retry.waitFor('remote cluster form to be visible', async () => {
return await testSubjects.isDisplayed('remoteClusterFormNameInput');
});
await testSubjects.setValue('remoteClusterFormNameInput', name);
await comboBox.setCustom('comboBoxInput', seedNode);
await testSubjects.click('remoteClusterFormSaveButton');
},
};
}

0 comments on commit b52ff2a

Please sign in to comment.