Skip to content

Commit 1ed17e0

Browse files
committed
Fixes and amends to prevent flakiness
1 parent 40a2fc6 commit 1ed17e0

File tree

8 files changed

+134
-69
lines changed

8 files changed

+134
-69
lines changed

x-pack/solutions/search/plugins/search_getting_started/public/components/tutorials/console_tutorials_group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const ConsoleTutorialsGroup = () => {
7777
// title: i18n.translate('xpack.searchGettingStarted.consoleTutorials.tsdsTitle', {
7878
// defaultMessage: 'Time series data streams',
7979
// }),
80-
// dataTestSubj: 'consoleTutorialsTsds',
80+
// dataTestSubj: 'console_tutorials_tsds',
8181
// description: i18n.translate('xpack.searchHomepage.consoleTutorials.tsdsDescription', {
8282
// defaultMessage:
8383
// 'Learn how to use a time series data stream (TSDS) to store timestamped metrics data.',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
4444
searchOverview: {
4545
pathname: '/app/elasticsearch/overview',
4646
},
47+
searchHomepage: {
48+
pathname: '/app/elasticsearch/home',
49+
},
4750
},
4851
};
4952
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ 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'));
1316
// Shared test file to close the global solution tour
1417
loadTestFile(require.resolve('./apps/shared/solution_tour'));
1518
// add tests that require feature flags, defined in config.feature_flags.ts
1619
loadTestFile(require.resolve('./tests/agent_builder'));
17-
loadTestFile(require.resolve('./tests/search_getting_started'));
1820
});
1921
};

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

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
3232
({ cleanUp, spaceCreated } = await searchSpace.createTestSpace(
3333
'search-getting-started-ftr'
3434
));
35-
await browser.execute(() => window.localStorage.clear());
3635
await searchSpace.navigateTo(spaceCreated.id);
3736
});
3837

@@ -124,22 +123,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
124123
});
125124
});
126125

127-
describe('Elasticsearch endpoint and API Keys', function () {
126+
describe('Elasticsearch endpoint', function () {
128127
it('renders endpoint field and copy button', async () => {
129128
await testSubjects.existOrFail('endpointValueField');
130129
await testSubjects.existOrFail('copyEndpointButton');
131130
const endpointValue = await testSubjects.getVisibleText('endpointValueField');
132131
expect(endpointValue).to.contain('https://');
133132
});
134-
it('renders the Create API key button', async () => {
135-
await testSubjects.existOrFail('createAPIKeyButton');
136-
});
137-
it('opens create_api_key flyout on clicking CreateApiKey button', async () => {
138-
await testSubjects.click('createAPIKeyButton');
139-
await retry.try(async () => {
140-
expect(await pageObjects.apiKeys.getFlyoutTitleText()).to.be('Create API key');
141-
});
142-
});
143133
});
144134

145135
describe('View connection details', function () {
@@ -153,18 +143,35 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
153143
});
154144

155145
describe('Explore the API', function () {
156-
it('clicking on search basics tutorial opens console', async () => {
157-
await pageObjects.searchGettingStarted.expectConsoleTutorial(
158-
'consoleTutorialsSearchBasics'
159-
);
160-
});
161-
it('clicking on semantic search tutorial open console', async () => {
162-
await pageObjects.searchGettingStarted.expectConsoleTutorial(
163-
'consoleTutorialsSemanticSearch'
164-
);
165-
});
166-
it('clicking on esql tutorial open console', async () => {
167-
await pageObjects.searchGettingStarted.expectConsoleTutorial('consoleTutorialsEsql');
146+
it('opens the console when you click the search basics tutorial card', async () => {
147+
await testSubjects.existOrFail('console_tutorials_search_basics');
148+
await testSubjects.click('console_tutorials_search_basics');
149+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
150+
});
151+
it('opens the console when you click the search basics tutorial button', async () => {
152+
await testSubjects.existOrFail('console_tutorials_search_basics-btn');
153+
await testSubjects.click('console_tutorials_search_basics');
154+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
155+
});
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');
159+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
160+
});
161+
it('opens the console when you click the semantic search tutorial button', async () => {
162+
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');
174+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
168175
});
169176
});
170177

x-pack/solutions/search/test/page_objects/search_getting_started_page.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,6 @@ export function SearchGettingStartedProvider({ getService }: FtrProviderContext)
2727
await testSubjects.click('gettingStartedAddDataButton');
2828
await testSubjects.click(optionDataTestSubj);
2929
},
30-
async expectConsoleTutorial(tutorialDataTestSubj: string) {
31-
await testSubjects.existOrFail(tutorialDataTestSubj);
32-
// Check that the card opens the console
33-
await testSubjects.click(tutorialDataTestSubj);
34-
await testSubjects.existOrFail('consoleEditorContainer');
35-
// Close the console
36-
await testSubjects.click('consoleEmbeddedControlBar');
37-
await testSubjects.existOrFail(`${tutorialDataTestSubj}-btn`);
38-
// Check that the card button opens the console
39-
await testSubjects.click(`${tutorialDataTestSubj}-btn`);
40-
await testSubjects.existOrFail('consoleEditorContainer');
41-
// Close the console
42-
await testSubjects.click('consoleEmbeddedControlBar');
43-
},
4430
async selectCodingLanguage(language: string) {
4531
await testSubjects.existOrFail('codeExampleLanguageSelect');
4632
await testSubjects.click('codeExampleLanguageSelect');

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,5 @@ export default createTestConfig({
5959
searchQueryRules: {
6060
pathname: '/app/elasticsearch/query_rules',
6161
},
62-
searchBase: {
63-
pathname: '/app/elasticsearch',
64-
},
6562
},
6663
});

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

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

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

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

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

32-
beforeEach(async () => {
33-
await browser.execute(() => window.localStorage.clear());
34-
});
35-
3632
describe('Getting Started redirect flow', function () {
3733
it('redirects to Getting Started on first load', async () => {
3834
await pageObjects.common.navigateToApp('searchHomepage', {
@@ -62,6 +58,71 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
6258
});
6359
});
6460

61+
describe('Getting Started page interactions', function () {
62+
beforeEach(async () => {
63+
await pageObjects.common.navigateToApp('searchGettingStarted');
64+
});
65+
66+
describe('Add data button', function () {
67+
it('navigates to the sample data page when option is selected', async () => {
68+
await pageObjects.searchGettingStarted.selectAddDataOption(
69+
'gettingStartedSampleDataMenuItem'
70+
);
71+
await retry.tryWithRetries(
72+
'wait for URL to change',
73+
async () => {
74+
expect(await browser.getCurrentUrl()).to.contain('/tutorial_directory/sampleData');
75+
},
76+
{ initialDelay: 200, retryCount: 5, retryDelay: 500 }
77+
);
78+
});
79+
});
80+
81+
describe('Elasticsearch endpoint and API Keys', function () {
82+
it('renders endpoint field and copy button', async () => {
83+
await testSubjects.existOrFail('endpointValueField');
84+
await testSubjects.existOrFail('copyEndpointButton');
85+
const endpointValue = await testSubjects.getVisibleText('endpointValueField');
86+
expect(endpointValue).to.contain('https://');
87+
await testSubjects.existOrFail('apiKeyFormNoUserPrivileges');
88+
});
89+
});
90+
91+
describe('View connection details', function () {
92+
it('renders the view connection details button', async () => {
93+
await testSubjects.existOrFail('viewConnectionDetailsLink');
94+
});
95+
it('opens the connection flyout when the button is clicked', async () => {
96+
await testSubjects.click('viewConnectionDetailsLink');
97+
await testSubjects.existOrFail('connectionDetailsModalTitle');
98+
});
99+
});
100+
101+
describe('Connect to your application', function () {
102+
it('renders the JavaScript code example when selected in Language Selector', async () => {
103+
await pageObjects.searchGettingStarted.selectCodingLanguage('javascript');
104+
await pageObjects.searchGettingStarted.expectCodeSampleContainsValue(
105+
'import { Client } from'
106+
);
107+
});
108+
});
109+
110+
describe('Footer content', function () {
111+
it('renders Search Labs callout and navigates correctly', async () => {
112+
await pageObjects.searchGettingStarted.expectFooterCallout(
113+
'gettingStartedSearchLabs',
114+
'search-labs'
115+
);
116+
});
117+
});
118+
});
119+
});
120+
121+
describe('as developer', function () {
122+
before(async () => {
123+
await pageObjects.svlCommonPage.loginAsDeveloper();
124+
});
125+
65126
describe('Getting Started page interactions', function () {
66127
beforeEach(async () => {
67128
await pageObjects.common.navigateToApp('searchGettingStarted');
@@ -114,16 +175,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
114175
});
115176
});
116177

117-
describe('Elasticsearch endpoint and API Keys', function () {
118-
it('renders endpoint field and copy button', async () => {
119-
await testSubjects.existOrFail('endpointValueField');
120-
await testSubjects.existOrFail('copyEndpointButton');
121-
const endpointValue = await testSubjects.getVisibleText('endpointValueField');
122-
expect(endpointValue).to.contain('https://');
123-
await testSubjects.existOrFail('apiKeyFormNoUserPrivileges');
124-
});
125-
});
126-
127178
describe('View connection details', function () {
128179
it('renders the view connection details button', async () => {
129180
await testSubjects.existOrFail('viewConnectionDetailsLink');
@@ -135,18 +186,35 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
135186
});
136187

137188
describe('Explore the API', function () {
138-
it('clicking on search basics tutorial opens console', async () => {
139-
await pageObjects.searchGettingStarted.expectConsoleTutorial(
140-
'consoleTutorialsSearchBasics'
141-
);
189+
it('opens the console when you click the search basics tutorial card', async () => {
190+
await testSubjects.existOrFail('console_tutorials_search_basics');
191+
await testSubjects.click('console_tutorials_search_basics');
192+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
142193
});
143-
it('clicking on semantic search tutorial open console', async () => {
144-
await pageObjects.searchGettingStarted.expectConsoleTutorial(
145-
'consoleTutorialsSemanticSearch'
146-
);
194+
it('opens the console when you click the search basics tutorial button', async () => {
195+
await testSubjects.existOrFail('console_tutorials_search_basics-btn');
196+
await testSubjects.click('console_tutorials_search_basics');
197+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
198+
});
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');
202+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
203+
});
204+
it('opens the console when you click the semantic search tutorial button', async () => {
205+
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();
147213
});
148-
it('clicking on esql tutorial open console', async () => {
149-
await pageObjects.searchGettingStarted.expectConsoleTutorial('consoleTutorialsEsql');
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');
217+
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
150218
});
151219
});
152220

0 commit comments

Comments
 (0)