Skip to content

Commit

Permalink
[Search][FTR] Fix / Improve tests (#197264)
Browse files Browse the repository at this point in the history
## Summary

Closes #196981

- Updated Search Index Details with data test suite to check for index
documents first, this should help reduce flakey tests in MKI since we
will ensure the documents are available before moving forward
- Updated URL checks to use regex instead `.equal` with the mocked
value. This should ensure the tests can pass in MKI and with integration
testing
- Removed the navigation check for the Maps page, this was causing
intermittent failures due to a modal on the page.
- Updated the getting started test suite to use `developer` role instead
of `admin`

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
  • Loading branch information
TattdCodeMonkey authored Oct 22, 2024
1 parent 6f44bf5 commit 5034558
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export function SvlSearchElasticsearchStartPageProvider({ getService }: FtrProvi
},
async expectO11yTrialLink() {
await testSubjects.existOrFail('startO11yTrialBtn');
expect(await testSubjects.getAttribute('startO11yTrialBtn', 'href')).equal(
'https://fake-cloud.elastic.co/projects/create/observability/start'
expect(await testSubjects.getAttribute('startO11yTrialBtn', 'href')).match(
/^https?\:\/\/.*\/projects\/create\/observability\/start/
);
expect(await testSubjects.getAttribute('startO11yTrialBtn', 'target')).equal('_blank');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export function SvlSearchIndexDetailPageProvider({ getService }: FtrProviderCont
},
async expectConnectionDetails() {
await testSubjects.existOrFail('connectionDetailsEndpoint', { timeout: 2000 });
expect(await (await testSubjects.find('connectionDetailsEndpoint')).getVisibleText()).to.be(
'https://fakeprojectid.es.fake-domain.cld.elstc.co:443'
expect(await (await testSubjects.find('connectionDetailsEndpoint')).getVisibleText()).match(
/^https?\:\/\/.*(\:\d+)?/
);
},
async expectQuickStats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
};

describe('Elasticsearch Start [Onboarding Empty State]', function () {
// fails on MKI, see https://github.com/elastic/kibana/issues/196981
this.tags(['failsOnMKI']);

describe('developer', function () {
before(async () => {
await pageObjects.svlCommonPage.loginWithRole('developer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

describe('getting started', function () {
before(async () => {
await pageObjects.svlCommonPage.loginAsAdmin();
await pageObjects.svlCommonPage.loginWithRole('developer');
});

it('has serverless side nav', async () => {
Expand Down
15 changes: 0 additions & 15 deletions x-pack/test_serverless/functional/test_suites/search/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,6 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
deepLinkId: 'dashboards',
});
// check Other tools
// > Maps
await solutionNavigation.sidenav.clickLink({
deepLinkId: 'maps',
});
await solutionNavigation.sidenav.expectLinkActive({
deepLinkId: 'maps',
});
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Other tools' });
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
text: 'Maps',
});
await solutionNavigation.breadcrumbs.expectBreadcrumbExists({
deepLinkId: 'maps',
});

// check Getting Started
await solutionNavigation.sidenav.clickLink({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const indexName = 'test-my-index';

describe('Search index detail page', function () {
// fails on MKI, see https://github.com/elastic/kibana/issues/196981
this.tags(['failsOnMKI']);

before(async () => {
await pageObjects.svlCommonPage.loginWithRole('developer');
await pageObjects.svlApiKeys.deleteAPIKeys();
Expand Down Expand Up @@ -120,16 +117,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});
await svlSearchNavigation.navigateToIndexDetailPage(indexName);
});
it('should have index documents', async () => {
await pageObjects.svlSearchIndexDetailPage.expectHasIndexDocuments();
});
it('menu action item should be replaced with playground', async () => {
await pageObjects.svlSearchIndexDetailPage.expectActionItemReplacedWhenHasDocs();
});
it('should have link to API reference doc link in options menu', async () => {
await pageObjects.svlSearchIndexDetailPage.clickMoreOptionsActionsButton();
await pageObjects.svlSearchIndexDetailPage.expectAPIReferenceDocLinkExistsInMoreOptions();
});
it('should have index documents', async () => {
await pageObjects.svlSearchIndexDetailPage.expectHasIndexDocuments();
});
it('should have one document in quick stats', async () => {
await pageObjects.svlSearchIndexDetailPage.expectQuickStatsToHaveDocumentCount(1);
});
Expand Down

0 comments on commit 5034558

Please sign in to comment.