Skip to content

Commit

Permalink
Address saved_object_tagging flakiness (elastic#170114)
Browse files Browse the repository at this point in the history
## Summary

Fixes:
* elastic#89958
* elastic#150249
* elastic#167812
* elastic#167560

Uses same strategy as Stratoula's
[PR](elastic#167599). It also adds a
"click" step to make sure the form control has the focus (as we do with
the other form controls on the same `fillForm` method).

The tests above fail cause the logic fails to clean the default tag
colour before entering a new one, resulting in:

![image](https://github.com/elastic/kibana/assets/25349407/e753aa64-4132-4094-af01-c17d91223172)

Also fixes:
* elastic#163817

[This
one](https://buildkite.com/elastic/kibana-on-merge/builds/36347#018b0068-ec42-47de-804d-b63a42b5b3e2)
is looks like a lost click on the Delete modal confirm button (modal
still present after 30s):


![image](https://github.com/elastic/kibana/assets/25349407/b2025b45-5030-4b6a-95f9-58d77fd3d2ea)
  • Loading branch information
gsoldevila authored Oct 30, 2023
1 parent d7ab75f commit 036918d
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 22 deletions.
6 changes: 6 additions & 0 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ export class CommonPageObject extends FtrService {
this.log.debug('Clicking modal confirm');
// make sure this data-test-subj 'confirmModalTitleText' exists because we're going to wait for it to be gone later
await this.testSubjects.exists('confirmModalTitleText');
// make sure button is enabled before clicking it
// (and conveniently give UI enough time to bind a handler to it)
const isEnabled = await this.testSubjects.isEnabled('confirmModalConfirmButton');
if (!isEnabled) {
throw new Error('Modal confirm button is not enabled');
}
await this.testSubjects.click('confirmModalConfirmButton');
if (ensureHidden) {
await this.ensureModalOverlayHidden();
Expand Down
1 change: 1 addition & 0 deletions x-pack/test/functional/page_objects/tag_management_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class TagModal extends FtrService {
});
}
if (fields.color !== undefined) {
await this.testSubjects.click('~createModalField-color');
await this.testSubjects.setValue('~createModalField-color', fields.color, {
clearWithKeyboard,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
);
});

// FLAKY: https://github.com/elastic/kibana/issues/163817
describe.skip('bulk delete', () => {
describe('bulk delete', () => {
it('deletes multiple tags', async () => {
const initialDisplayedTags = await tagManagementPage.getDisplayedTagNames();
await tagManagementPage.selectTagByName('tag-1');
Expand Down
28 changes: 21 additions & 7 deletions x-pack/test/saved_object_tagging/functional/tests/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

const tagManagementPage = PageObjects.tagManagement;

// FLAKY: https://github.com/elastic/kibana/issues/167812
describe.skip('create tag', () => {
describe('create tag', () => {
let tagModal: typeof tagManagementPage['tagModal'];

before(async () => {
Expand Down Expand Up @@ -45,7 +44,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
description: 'I just added this tag',
color: '#FF00CC',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);
await tagModal.waitUntilClosed();
await tagManagementPage.waitUntilTableIsLoaded();
Expand All @@ -65,7 +67,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
description: 'The name will fails validation',
color: '#FF00CC',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);

expect(await tagModal.isOpened()).to.be(true);
Expand All @@ -84,7 +89,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
description: 'The name will fails validation',
color: '#FF00CC',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);

expect(await tagModal.isOpened()).to.be(true);
Expand All @@ -94,7 +102,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
{
name: 'valid name',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);

await tagModal.waitUntilClosed();
Expand All @@ -114,7 +125,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
description: 'I will not add this tag',
color: '#FF00CC',
},
{ submit: false }
{
submit: false,
clearWithKeyboard: true,
}
);
await tagModal.clickCancel();
await tagModal.waitUntilClosed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
},
{
submit: true,
clearWithKeyboard: true,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});
};

// Failing: See https://github.com/elastic/kibana/issues/150249
describe.skip('discover integration', () => {
describe('discover integration', () => {
before(async () => {
await kibanaServer.importExport.load(
'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/discover/data.json'
Expand Down Expand Up @@ -143,6 +142,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
},
{
submit: true,
clearWithKeyboard: true,
}
);
expect(await tagModal.isOpened()).to.be(false);
Expand Down
42 changes: 31 additions & 11 deletions x-pack/test/saved_object_tagging/functional/tests/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

const tagManagementPage = PageObjects.tagManagement;

// Failing: See https://github.com/elastic/kibana/issues/167560
describe.skip('edit tag', () => {
describe('edit tag', () => {
let tagModal: typeof tagManagementPage['tagModal'];

before(async () => {
Expand Down Expand Up @@ -56,7 +55,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
description: 'This was edited',
color: '#FFCC00',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);
await tagModal.waitUntilClosed();
await tagManagementPage.waitUntilTableIsLoaded();
Expand All @@ -79,7 +81,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
{
name: 'a',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);

expect(await tagModal.isOpened()).to.be(true);
Expand All @@ -98,7 +103,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
description: 'edited description',
color: '#FF00CC',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);

expect(await tagModal.isOpened()).to.be(true);
Expand All @@ -108,7 +116,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
{
name: 'edited name',
},
{ submit: true }
{
submit: true,
clearWithKeyboard: true,
}
);

await tagModal.waitUntilClosed();
Expand All @@ -130,7 +141,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
description: 'I will not add this tag',
color: '#FF00CC',
},
{ submit: false }
{
submit: false,
clearWithKeyboard: true,
}
);
await tagModal.clickCancel();
await tagModal.waitUntilClosed();
Expand All @@ -153,28 +167,34 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
it('should disable save button if no property is changed', async () => {
await tagModal.openEdit('tag-3');

await tagModal.fillForm(tag3Unmodified, { submit: false });
await tagModal.fillForm(tag3Unmodified, { submit: false, clearWithKeyboard: true });
expect(await tagModal.isConfirmDisabled()).to.be(true);
});
it('should enable save button if name is changed', async () => {
await tagModal.openEdit('tag-3');

await tagModal.fillForm({ ...tag3Unmodified, name: 'changed name' }, { submit: false });
await tagModal.fillForm(
{ ...tag3Unmodified, name: 'changed name' },
{ submit: false, clearWithKeyboard: true }
);
expect(await tagModal.isConfirmDisabled()).to.be(false);
});
it('should enable save button if description is changed', async () => {
await tagModal.openEdit('tag-3');

await tagModal.fillForm(
{ ...tag3Unmodified, description: 'changed description' },
{ submit: false }
{ submit: false, clearWithKeyboard: true }
);
expect(await tagModal.isConfirmDisabled()).to.be(false);
});
it('should enable save button if color is changed', async () => {
await tagModal.openEdit('tag-3');

await tagModal.fillForm({ ...tag3Unmodified, color: '#FF0000' }, { submit: false });
await tagModal.fillForm(
{ ...tag3Unmodified, color: '#FF0000' },
{ submit: false, clearWithKeyboard: true }
);
expect(await tagModal.isConfirmDisabled()).to.be(false);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
},
{
submit: true,
clearWithKeyboard: true,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
},
{
submit: true,
clearWithKeyboard: true,
}
);

Expand Down

0 comments on commit 036918d

Please sign in to comment.