Skip to content

Commit 40df400

Browse files
committed
review fixes
1 parent 8f17feb commit 40df400

9 files changed

Lines changed: 47 additions & 40 deletions

File tree

test/functional/page_objects/common_page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
9999
*/
100100
private async loginIfPrompted(appUrl: string) {
101101
let currentUrl = await browser.getCurrentUrl();
102-
log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`); // 60 sec waiting
103-
await testSubjects.find('kibanaChrome', 6 * defaultFindTimeout);
102+
log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`);
103+
await testSubjects.find('kibanaChrome', 6 * defaultFindTimeout); // 60 sec waiting
104104
const loginPage = currentUrl.includes('/login');
105105
const wantedLoginPage = appUrl.includes('/login') || appUrl.includes('/logout');
106106

test/functional/page_objects/newsfeed_page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function NewsfeedPageProvider({ getService, getPageObjects }: FtrProvider
5454

5555
async getNewsfeedList() {
5656
const list = await testSubjects.find('NewsfeedFlyout');
57-
const cells = await list.findAll('newsHeadAlert');
57+
const cells = await list.findAllByTestSubject('newsHeadAlert');
5858

5959
const objects = [];
6060
for (const cell of cells) {

test/functional/page_objects/visual_builder_page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
485485
const labels = await testSubjects.findAll('aggRow');
486486
const label = labels[aggNth];
487487

488-
return (await label.findAll('comboBoxInput'))[1];
488+
return (await label.findAllByTestSubject('comboBoxInput'))[1];
489489
}
490490

491491
public async clickColorPicker(): Promise<void> {
@@ -533,7 +533,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
533533
*/
534534
public async getAggregationCount(nth: number = 0): Promise<number> {
535535
const series = await this.getSeries();
536-
const aggregation = await series[nth].findAll('draggable');
536+
const aggregation = await series[nth].findAllByTestSubject('draggable');
537537
return aggregation.length;
538538
}
539539

test/functional/services/combo_box.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
218218
return;
219219
}
220220

221-
const clearBtn = await comboBox.find('comboBoxClearButton');
221+
const clearBtn = await comboBox.findByTestSubject('comboBoxClearButton');
222222
await clearBtn.click();
223223

224224
const clearButtonStillExists = await this.doesClearButtonExist(comboBox);
@@ -230,7 +230,10 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
230230
}
231231

232232
public async doesClearButtonExist(comboBoxElement: WebElementWrapper): Promise<boolean> {
233-
const found = await comboBoxElement.findAll('comboBoxClearButton', WAIT_FOR_EXISTS_TIME);
233+
const found = await comboBoxElement.findAllByTestSubject(
234+
'comboBoxClearButton',
235+
WAIT_FOR_EXISTS_TIME
236+
);
234237
return found.length > 0;
235238
}
236239

@@ -261,7 +264,7 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
261264
public async openOptionsList(comboBoxElement: WebElementWrapper): Promise<void> {
262265
const isOptionsListOpen = await testSubjects.exists('~comboBoxOptionsList');
263266
if (!isOptionsListOpen) {
264-
const toggleBtn = await comboBoxElement.find('comboBoxToggleListButton');
267+
const toggleBtn = await comboBoxElement.findByTestSubject('comboBoxToggleListButton');
265268
await toggleBtn.click();
266269
}
267270
}

test/functional/services/doc_table.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
4848

4949
public async getBodyRows(): Promise<WebElementWrapper[]> {
5050
const table = await this.getTable();
51-
return await table.findAll('~docTableRow');
51+
return await table.findAllByTestSubject('~docTableRow');
5252
}
5353

5454
public async getAnchorRow(): Promise<WebElementWrapper> {
5555
const table = await this.getTable();
56-
return await table.find('~docTableAnchorRow');
56+
return await table.findByTestSubject('~docTableAnchorRow');
5757
}
5858

5959
public async getRow(options: SelectOptions): Promise<WebElementWrapper> {
@@ -73,7 +73,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
7373
options: SelectOptions = { isAnchorRow: false, rowIndex: 0 }
7474
): Promise<void> {
7575
const row = await this.getRow(options);
76-
const toggle = await row.find('~docTableExpandToggleColumn');
76+
const toggle = await row.findByTestSubject('~docTableExpandToggleColumn');
7777
await toggle.click();
7878
}
7979

@@ -90,7 +90,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
9090
const detailsRow = options.isAnchorRow
9191
? await this.getAnchorDetailsRow()
9292
: (await this.getDetailsRows())[options.rowIndex];
93-
return await detailsRow.findAll('~docTableRowAction');
93+
return await detailsRow.findAllByTestSubject('~docTableRowAction');
9494
}
9595

9696
public async getFields(options: { isAnchorRow: boolean } = { isAnchorRow: false }) {
@@ -122,13 +122,13 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
122122
detailsRow: WebElementWrapper,
123123
fieldName: WebElementWrapper
124124
): Promise<WebElementWrapper> {
125-
return await detailsRow.find(`~tableDocViewRow-${fieldName}`);
125+
return await detailsRow.findByTestSubject(`~tableDocViewRow-${fieldName}`);
126126
}
127127

128128
public async getAddInclusiveFilterButton(
129129
tableDocViewRow: WebElementWrapper
130130
): Promise<WebElementWrapper> {
131-
return await tableDocViewRow.find(`~addInclusiveFilterButton`);
131+
return await tableDocViewRow.findByTestSubject(`~addInclusiveFilterButton`);
132132
}
133133

134134
public async addInclusiveFilter(
@@ -144,7 +144,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
144144
public async getAddExistsFilterButton(
145145
tableDocViewRow: WebElementWrapper
146146
): Promise<WebElementWrapper> {
147-
return await tableDocViewRow.find(`~addExistsFilterButton`);
147+
return await tableDocViewRow.findByTestSubject(`~addExistsFilterButton`);
148148
}
149149

150150
public async addExistsFilter(
@@ -169,7 +169,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
169169
const detailsRow = await row.findByXpath(
170170
'./following-sibling::*[@data-test-subj="docTableDetailsRow"]'
171171
);
172-
return detailsRow.find('~docViewer');
172+
return detailsRow.findByTestSubject('~docViewer');
173173
});
174174
}
175175
}

test/functional/services/lib/web_element_wrapper/web_element_wrapper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ export class WebElementWrapper {
543543
* @param {string} selector
544544
* @return {Promise<WebElementWrapper>}
545545
*/
546-
public async find(selector: string) {
546+
public async findByTestSubject(selector: string) {
547547
return await this.retryCall(async function find(wrapper) {
548548
return wrapper._wrap(
549549
await wrapper._webElement.findElement(wrapper.By.css(testSubjSelector(selector))),
@@ -559,7 +559,7 @@ export class WebElementWrapper {
559559
* @param {number} timeout
560560
* @return {Promise<WebElementWrapper[]>}
561561
*/
562-
public async findAll(selector: string, timeout?: number) {
562+
public async findAllByTestSubject(selector: string, timeout?: number) {
563563
return await this.retryCall(async function findAll(wrapper) {
564564
return wrapper._wrapAll(
565565
await wrapper._findWithCustomTimeout(

x-pack/test/functional/page_objects/rollup_page.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,18 @@ export function RollupPageProvider({ getService, getPageObjects }) {
111111
async getJobList() {
112112
const jobs = await testSubjects.findAll('jobTableRow');
113113
return mapAsync(jobs, async job => {
114-
const jobNameElement = await job.find('jobTableCell-id');
115-
const jobStatusElement = await job.find('jobTableCell-status');
116-
const jobIndexPatternElement = await job.find('jobTableCell-indexPattern');
117-
const jobRollUpIndexPatternElement = await job.find('jobTableCell-rollupIndex');
118-
const jobDelayElement = await job.find('jobTableCell-rollupDelay');
119-
const jobIntervalElement = await job.find('jobTableCell-dateHistogramInterval');
120-
const jobGroupElement = await job.find('jobTableCell-groups');
121-
const jobMetricsElement = await job.find('jobTableCell-metrics');
114+
const jobNameElement = await job.findByTestSubject('jobTableCell-id');
115+
const jobStatusElement = await job.findByTestSubject('jobTableCell-status');
116+
const jobIndexPatternElement = await job.findByTestSubject('jobTableCell-indexPattern');
117+
const jobRollUpIndexPatternElement = await job.findByTestSubject(
118+
'jobTableCell-rollupIndex'
119+
);
120+
const jobDelayElement = await job.findByTestSubject('jobTableCell-rollupDelay');
121+
const jobIntervalElement = await job.findByTestSubject(
122+
'jobTableCell-dateHistogramInterval'
123+
);
124+
const jobGroupElement = await job.findByTestSubject('jobTableCell-groups');
125+
const jobMetricsElement = await job.findByTestSubject('jobTableCell-metrics');
122126

123127
return {
124128
jobName: await jobNameElement.getVisibleText(),

x-pack/test/functional/page_objects/security_page.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
229229
async getElasticsearchUsers() {
230230
const users = await testSubjects.findAll('userRow');
231231
return mapAsync(users, async user => {
232-
const fullnameElement = await user.find('userRowFullName');
233-
const usernameElement = await user.find('userRowUserName');
234-
const emailElement = await user.find('userRowEmail');
235-
const rolesElement = await user.find('userRowRoles');
232+
const fullnameElement = await user.findByTestSubject('userRowFullName');
233+
const usernameElement = await user.findByTestSubject('userRowUserName');
234+
const emailElement = await user.findByTestSubject('userRowEmail');
235+
const rolesElement = await user.findByTestSubject('userRowRoles');
236236
// findAll is substantially faster than `find.descendantExistsByCssSelector for negative cases
237-
const isUserReserved = (await user.findAll('userReserved', 1)).length > 0;
237+
const isUserReserved = (await user.findAllByTestSubject('userReserved', 1)).length > 0;
238238

239239
return {
240240
username: await usernameElement.getVisibleText(),
@@ -250,11 +250,11 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
250250
const users = await testSubjects.findAll('roleRow');
251251
return mapAsync(users, async role => {
252252
const [rolename, reserved, deprecated] = await Promise.all([
253-
role.find('roleRowName').then(el => el.getVisibleText()),
253+
role.findByTestSubject('roleRowName').then(el => el.getVisibleText()),
254254
// findAll is substantially faster than `find.descendantExistsByCssSelector for negative cases
255-
role.findAll('roleReserved', 1).then(el => el.length > 0),
255+
role.findAllByTestSubject('roleReserved', 1).then(el => el.length > 0),
256256
// findAll is substantially faster than `find.descendantExistsByCssSelector for negative cases
257-
role.findAll('roleDeprecated', 1).then(el => el.length > 0),
257+
role.findAllByTestSubject('roleDeprecated', 1).then(el => el.length > 0),
258258
]);
259259

260260
return {

x-pack/test/functional/page_objects/snapshot_restore_page.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
2828
},
2929
async getRepoList() {
3030
const table = await testSubjects.find('repositoryTable');
31-
const rows = await table.findAll('row');
31+
const rows = await table.findAllByTestSubject('row');
3232
return await Promise.all(
3333
rows.map(async row => {
3434
return {
35-
repoName: await (await row.find('Name_cell')).getVisibleText(),
36-
repoLink: await (await row.find('Name_cell')).findByCssSelector('a'),
37-
repoType: await (await row.find('Type_cell')).getVisibleText(),
38-
repoEdit: await row.find('editRepositoryButton'),
39-
repoDelete: await row.find('deleteRepositoryButton'),
35+
repoName: await (await row.findByTestSubject('Name_cell')).getVisibleText(),
36+
repoLink: await (await row.findByTestSubject('Name_cell')).findByCssSelector('a'),
37+
repoType: await (await row.findByTestSubject('Type_cell')).getVisibleText(),
38+
repoEdit: await row.findByTestSubject('editRepositoryButton'),
39+
repoDelete: await row.findByTestSubject('deleteRepositoryButton'),
4040
};
4141
})
4242
);

0 commit comments

Comments
 (0)