[Discover] Fix flaky Discover URL state functional test (#143005)

* [Discover] Temp commit to create test PR

* [Discover] Attempt to fix flaky Discover URL state tests
This commit is contained in:
Davis McPhee 2022-10-26 11:02:22 -03:00 committed by GitHub
parent 362b211e71
commit 9679a86754
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,8 +26,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
defaultIndex: 'logstash-*',
};
// FLAKY: https://github.com/elastic/kibana/issues/142222
describe.skip('discover test', function describeIndexTests() {
describe('discover test', function describeIndexTests() {
before(async function () {
log.debug('load kibana index with default index pattern');
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover');
@ -370,14 +369,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.header.waitUntilLoadingHasFinished();
const dataViewId = await PageObjects.discover.getCurrentDataViewId();
const originalUrl = await browser.getCurrentUrl();
const newUrl = originalUrl.replace(dataViewId, 'invalid-data-view-id');
await browser.get(newUrl);
await PageObjects.header.waitUntilLoadingHasFinished();
expect(await browser.getCurrentUrl()).to.be(originalUrl);
expect(await testSubjects.exists('dscDataViewNotFoundShowDefaultWarning')).to.be(true);
await retry.try(async () => {
expect(await browser.getCurrentUrl()).to.be(originalUrl);
expect(await testSubjects.exists('dscDataViewNotFoundShowDefaultWarning')).to.be(true);
});
});
it('should show a warning and fall back to the current data view if the URL is updated to an invalid data view ID', async () => {
@ -385,14 +384,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.timePicker.setDefaultAbsoluteRange();
const originalHash = await browser.execute<[], string>('return window.location.hash');
const dataViewId = await PageObjects.discover.getCurrentDataViewId();
const newHash = originalHash.replace(dataViewId, 'invalid-data-view-id');
await browser.execute(`window.location.hash = "${newHash}"`);
await PageObjects.header.waitUntilLoadingHasFinished();
const currentHash = await browser.execute<[], string>('return window.location.hash');
expect(currentHash).to.be(originalHash);
expect(await testSubjects.exists('dscDataViewNotFoundShowSavedWarning')).to.be(true);
await retry.try(async () => {
const currentHash = await browser.execute<[], string>('return window.location.hash');
expect(currentHash).to.be(originalHash);
expect(await testSubjects.exists('dscDataViewNotFoundShowSavedWarning')).to.be(true);
});
});
});
});