[Metrics UI] Stabilize home page tests (#120010) (#120083)

Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2021-12-01 07:49:13 -05:00 committed by GitHub
parent 53a1754e2e
commit a58cad9bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 10 deletions

View file

@ -58,6 +58,7 @@ export const WaffleTimeControls = withTheme(({ interval }: Props) => {
delay="long"
display="inlineBlock"
position="top"
data-test-subj="waffleDatePickerIntervalTooltip"
>
<EuiDatePicker
dateFormat="L LTS"

View file

@ -35,8 +35,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});
// FLAKY: https://github.com/elastic/kibana/issues/119763
describe.skip('with metrics present', () => {
describe('with metrics present', () => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await pageObjects.common.navigateToApp('infraOps');
@ -168,8 +167,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});
// FLAKY: https://github.com/elastic/kibana/issues/106650
describe.skip('Saved Views', () => {
describe('Saved Views', () => {
before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'));
it('should have save and load controls', async () => {

View file

@ -23,8 +23,16 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide
const datePickerInput = await find.byCssSelector(
`${testSubjSelector('waffleDatePicker')} .euiDatePicker.euiFieldText`
);
await datePickerInput.clearValueWithKeyboard({ charByChar: true });
await datePickerInput.type([time, browser.keys.RETURN]);
// explicitly focus to trigger tooltip
await datePickerInput.focus();
await datePickerInput.clearValueWithKeyboard();
await datePickerInput.type(time);
// dismiss the tooltip, which won't be hidden because blur doesn't happen reliably
await testSubjects.click('waffleDatePickerIntervalTooltip');
await this.waitForLoading();
},
@ -105,13 +113,22 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide
async enterSearchTerm(query: string) {
const input = await this.clearSearchTerm();
await input.type([query, browser.keys.RETURN]);
await input.type(query);
// wait for input value to echo the input before submitting
// this ensures the React state has caught up with the events
await retry.try(async () => {
const value = await input.getAttribute('value');
expect(value).to.eql(query);
});
await input.type(browser.keys.RETURN);
await this.waitForLoading();
},
async clearSearchTerm() {
const input = await testSubjects.find('infraSearchField');
await input.clearValueWithKeyboard({ charByChar: true });
await input.clearValueWithKeyboard();
return input;
},

View file

@ -10,6 +10,7 @@ import { Key } from 'selenium-webdriver';
import { FtrProviderContext } from '../ftr_provider_context';
export function InfraSavedViewsProvider({ getService }: FtrProviderContext) {
const retry = getService('retry');
const testSubjects = getService('testSubjects');
const browser = getService('browser');
@ -74,8 +75,10 @@ export function InfraSavedViewsProvider({ getService }: FtrProviderContext) {
},
async ensureViewIsLoaded(name: string) {
const subject = await testSubjects.find('savedViews-openPopover');
expect(await subject.getVisibleText()).to.be(name);
await retry.try(async () => {
const subject = await testSubjects.find('savedViews-openPopover');
expect(await subject.getVisibleText()).to.be(name);
});
},
async ensureViewIsLoadable(name: string) {