mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Fix flaky combobox tests on role management screen (#155711)
Resolves #155447 Resolves #155448 Resolves #137393 Resolves #155446 Flaky test runner: ✅ 50/50 (https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2169)
This commit is contained in:
parent
13517601d5
commit
24712d4860
2 changed files with 16 additions and 14 deletions
|
@ -19,8 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const PageObjects = getPageObjects(['security', 'common', 'header', 'discover', 'settings']);
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/155447
|
||||
describe.skip('dls', function () {
|
||||
describe('dls', function () {
|
||||
before('initialize tests', async () => {
|
||||
await kibanaServer.savedObjects.cleanStandardList();
|
||||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/security/dlstest');
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import { adminTestUser } from '@kbn/test';
|
||||
import { AuthenticatedUser, Role } from '@kbn/security-plugin/common/model';
|
||||
import type { UserFormValues } from '@kbn/security-plugin/public/management/users/edit_user/user_form';
|
||||
import { Key } from 'selenium-webdriver';
|
||||
import { FtrService } from '../ftr_provider_context';
|
||||
|
||||
interface LoginOptions {
|
||||
|
@ -359,14 +360,12 @@ export class SecurityPageObject extends FtrService {
|
|||
}
|
||||
|
||||
async addPrivilegeToRole(privilege: string) {
|
||||
this.log.debug(`Adding privilege ${privilege} to role`);
|
||||
const privilegeInput = await this.retry.try(() =>
|
||||
this.find.byCssSelector('[data-test-subj="privilegesInput0"] input')
|
||||
);
|
||||
await privilegeInput.type(privilege);
|
||||
|
||||
const btn = await this.find.byButtonText(privilege);
|
||||
await btn.click();
|
||||
this.log.debug(`Adding privilege "${privilege}" to role`);
|
||||
const privilegesField = await this.testSubjects.find('privilegesInput0');
|
||||
const privilegesInput = await privilegesField.findByTagName('input');
|
||||
await privilegesInput.type(privilege);
|
||||
await privilegesInput.pressKeys(Key.ENTER); // Add typed privilege to combo box
|
||||
await privilegesInput.pressKeys(Key.ESCAPE); // Close dropdown menu to avoid hiding elements from test runner
|
||||
}
|
||||
|
||||
async assignRoleToUser(role: string) {
|
||||
|
@ -586,23 +585,27 @@ export class SecurityPageObject extends FtrService {
|
|||
}
|
||||
|
||||
await this.testSubjects.click('addSpacePrivilegeButton');
|
||||
await this.testSubjects.click('spaceSelectorComboBox');
|
||||
const spaceSelectorComboBox = await this.testSubjects.find('spaceSelectorComboBox');
|
||||
await spaceSelectorComboBox.click();
|
||||
|
||||
const globalSpaceOption = await this.find.byCssSelector(`#spaceOption_\\*`);
|
||||
await globalSpaceOption.click();
|
||||
|
||||
// Close dropdown menu to avoid hiding elements from test runner
|
||||
const spaceSelectorInput = await spaceSelectorComboBox.findByTagName('input');
|
||||
await spaceSelectorInput.pressKeys(Key.ESCAPE);
|
||||
|
||||
await this.testSubjects.click('basePrivilege_all');
|
||||
await this.testSubjects.click('createSpacePrivilegeButton');
|
||||
|
||||
const addPrivilege = (privileges: string[]) => {
|
||||
const addPrivileges = (privileges: string[]) => {
|
||||
return privileges.reduce((promise: Promise<any>, privilegeName: string) => {
|
||||
return promise
|
||||
.then(() => self.addPrivilegeToRole(privilegeName))
|
||||
.then(() => this.common.sleep(250));
|
||||
}, Promise.resolve());
|
||||
};
|
||||
|
||||
await addPrivilege(roleObj.elasticsearch.indices[0].privileges);
|
||||
await addPrivileges(roleObj.elasticsearch.indices[0].privileges);
|
||||
|
||||
const addGrantedField = async (fields: string[]) => {
|
||||
for (const entry of fields) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue