Skip to content

Commit b8b5f4c

Browse files
committed
More fixes for flakey tests
1 parent 6826d6a commit b8b5f4c

File tree

6 files changed

+36
-80
lines changed

6 files changed

+36
-80
lines changed

x-pack/solutions/search/test/functional_search/config/config.feature_flags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
2525
'--xpack.spaces.defaultSolution=es', // Default to Search Solution
2626
`--uiSettings.overrides.searchPlayground:searchModeEnabled=true`,
2727
`--uiSettings.overrides.agentBuilder:enabled=true`,
28+
'--uiSettings.overrides.hideAnnouncements=true',
2829
'--feature_flags.overrides.searchSolution.gettingStartedEnabled=true',
2930
],
3031
},

x-pack/solutions/search/test/functional_search/index.feature_flags.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import type { FtrProviderContext } from './ftr_provider_context';
1010

1111
export default ({ loadTestFile }: FtrProviderContext): void => {
1212
describe('Search solution FF tests', function () {
13-
// This test needs to run first to avoid other tests setting the local
14-
// storage key which this test file relies on
15-
loadTestFile(require.resolve('./tests/search_getting_started'));
1613
// Shared test file to close the global solution tour
1714
loadTestFile(require.resolve('./apps/shared/solution_tour'));
1815
// add tests that require feature flags, defined in config.feature_flags.ts
1916
loadTestFile(require.resolve('./tests/agent_builder'));
17+
loadTestFile(require.resolve('./tests/search_getting_started'));
2018
});
2119
};

x-pack/solutions/search/test/functional_search/tests/search_getting_started.ts

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
4040
await cleanUp();
4141
});
4242

43-
describe('Getting Started redirect flow', function () {
44-
beforeEach(async () => {
45-
await pageObjects.common.navigateToApp('searchHomepage', {
46-
shouldLoginIfPrompted: false,
47-
});
48-
});
49-
it('redirects to Getting Started on first load', async () => {
50-
await pageObjects.searchGettingStarted.expectToBeOnGettingStartedPage();
51-
});
52-
it('redirects to Home page if localStorage key is set', async () => {
53-
await browser.refresh();
54-
await pageObjects.common.navigateToApp('searchHomepage', {
55-
shouldLoginIfPrompted: false,
56-
});
57-
await pageObjects.searchHomePage.expectToBeOnHomepage();
58-
});
59-
});
60-
6143
describe('Getting Started page', function () {
6244
beforeEach(async () => {
6345
await pageObjects.searchNavigation.navigateToElasticsearchSearchGettingStartedPage();
@@ -143,35 +125,31 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
143125
});
144126

145127
describe('Explore the API', function () {
146-
it('opens the console when you click the search basics tutorial card', async () => {
128+
it('renders all the tutorial cards', async () => {
147129
await testSubjects.existOrFail('console_tutorials_search_basics');
148-
await testSubjects.click('console_tutorials_search_basics');
149-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
130+
await testSubjects.existOrFail('console_tutorials_semantic_search');
131+
await testSubjects.existOrFail('console_tutorials_esql');
150132
});
151-
it('opens the console when you click the search basics tutorial button', async () => {
133+
it('renders all the tutorial card buttons', async () => {
152134
await testSubjects.existOrFail('console_tutorials_search_basics-btn');
153-
await testSubjects.click('console_tutorials_search_basics');
154-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
135+
await testSubjects.existOrFail('console_tutorials_semantic_search-btn');
136+
await testSubjects.existOrFail('console_tutorials_esql-btn');
155137
});
156-
it('opens the console when you click the semantic search tutorial card', async () => {
157-
await testSubjects.existOrFail('console_tutorials_semantic_search');
158-
await testSubjects.click('console_tutorials_semantic_search');
138+
it('opens the console when you click the search basics tutorial card', async () => {
139+
await testSubjects.existOrFail('console_tutorials_search_basics');
140+
await testSubjects.click('console_tutorials_search_basics');
159141
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
142+
await pageObjects.embeddedConsole.clickEmbeddedConsoleControlBar();
143+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeClosed();
160144
});
161145
it('opens the console when you click the semantic search tutorial button', async () => {
162146
await testSubjects.existOrFail('console_tutorials_semantic_search-btn');
163-
await testSubjects.click('console_tutorials_semantic_search-btn');
164-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
165-
});
166-
it('opens the console when you click the esql tutorial card', async () => {
167-
await testSubjects.existOrFail('console_tutorials_esql');
168-
await testSubjects.click('console_tutorials_esql');
169-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
170-
});
171-
it('opens the console when you click the esql tutorial button', async () => {
172-
await testSubjects.existOrFail('console_tutorials_esql-btn');
173-
await testSubjects.click('console_tutorials_esql-btn');
147+
const tutorialButton = await testSubjects.find('console_tutorials_semantic_search-btn');
148+
await tutorialButton.scrollIntoView();
149+
await tutorialButton.click();
174150
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
151+
await pageObjects.embeddedConsole.clickEmbeddedConsoleControlBar();
152+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeClosed();
175153
});
176154
});
177155

x-pack/solutions/search/test/serverless/functional/configs/config.feature_flags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
2525
...baseConfig.get('kbnTestServer.serverArgs'),
2626
`--uiSettings.overrides.agentBuilder:enabled=true`,
2727
`--uiSettings.overrides.searchPlayground:searchModeEnabled=true`,
28+
'--uiSettings.overrides.hideAnnouncements=true',
2829
'--feature_flags.overrides.searchSolution.gettingStartedEnabled=true',
2930
],
3031
},

x-pack/solutions/search/test/serverless/functional/configs/index.feature_flags.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ import type { FtrProviderContext } from '../ftr_provider_context';
99

1010
export default function ({ loadTestFile }: FtrProviderContext) {
1111
describe('serverless search UI - feature flags', function () {
12-
// This test needs to run first to avoid other tests setting the local
13-
// storage key which this test file relies on
14-
loadTestFile(require.resolve('../test_suites/search_getting_started'));
1512
// add tests that require feature flags, defined in config.feature_flags.ts
1613
loadTestFile(require.resolve('../test_suites/agent_builder'));
1714
loadTestFile(require.resolve('../test_suites/search_playground/search_relevance'));
15+
loadTestFile(require.resolve('../test_suites/search_getting_started'));
1816
});
1917
}

x-pack/solutions/search/test/serverless/functional/test_suites/search_getting_started.ts

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
2929
await pageObjects.svlCommonPage.loginAsViewer();
3030
});
3131

32-
describe('Getting Started redirect flow', function () {
33-
it('redirects to Getting Started on first load', async () => {
34-
await pageObjects.common.navigateToApp('searchHomepage', {
35-
shouldLoginIfPrompted: false,
36-
});
37-
await pageObjects.searchGettingStarted.expectToBeOnGettingStartedPage();
38-
});
39-
it('loads home page if localStorage key is set', async () => {
40-
await browser.refresh();
41-
await pageObjects.common.navigateToApp('searchHomepage', {
42-
shouldLoginIfPrompted: false,
43-
});
44-
await pageObjects.searchHomePage.expectToBeOnHomepage();
45-
});
46-
});
47-
4832
describe('Getting Started page', function () {
4933
beforeEach(async () => {
5034
await pageObjects.common.navigateToApp('searchGettingStarted');
@@ -186,35 +170,31 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
186170
});
187171

188172
describe('Explore the API', function () {
189-
it('opens the console when you click the search basics tutorial card', async () => {
173+
it('renders all the tutorial cards', async () => {
190174
await testSubjects.existOrFail('console_tutorials_search_basics');
191-
await testSubjects.click('console_tutorials_search_basics');
192-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
175+
await testSubjects.existOrFail('console_tutorials_semantic_search');
176+
await testSubjects.existOrFail('console_tutorials_esql');
193177
});
194-
it('opens the console when you click the search basics tutorial button', async () => {
178+
it('renders all the tutorial card buttons', async () => {
195179
await testSubjects.existOrFail('console_tutorials_search_basics-btn');
196-
await testSubjects.click('console_tutorials_search_basics');
197-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
180+
await testSubjects.existOrFail('console_tutorials_semantic_search-btn');
181+
await testSubjects.existOrFail('console_tutorials_esql-btn');
198182
});
199-
it('opens the console when you click the semantic search tutorial card', async () => {
200-
await testSubjects.existOrFail('console_tutorials_semantic_search');
201-
await testSubjects.click('console_tutorials_semantic_search');
183+
it('opens the console when you click the search basics tutorial card', async () => {
184+
await testSubjects.existOrFail('console_tutorials_search_basics');
185+
await testSubjects.click('console_tutorials_search_basics');
202186
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
187+
await pageObjects.embeddedConsole.clickEmbeddedConsoleControlBar();
188+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeClosed();
203189
});
204190
it('opens the console when you click the semantic search tutorial button', async () => {
205191
await testSubjects.existOrFail('console_tutorials_semantic_search-btn');
206-
await testSubjects.click('console_tutorials_semantic_search-btn');
207-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
208-
});
209-
it('opens the console when you click the esql tutorial card', async () => {
210-
await testSubjects.existOrFail('console_tutorials_esql');
211-
await testSubjects.click('console_tutorials_esql');
212-
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
213-
});
214-
it('opens the console when you click the esql tutorial button', async () => {
215-
await testSubjects.existOrFail('console_tutorials_esql-btn');
216-
await testSubjects.click('console_tutorials_esql-btn');
192+
const tutorialButton = await testSubjects.find('console_tutorials_semantic_search-btn');
193+
await tutorialButton.scrollIntoView();
194+
await tutorialButton.click();
217195
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
196+
await pageObjects.embeddedConsole.clickEmbeddedConsoleControlBar();
197+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeClosed();
218198
});
219199
});
220200

0 commit comments

Comments
 (0)