WebElementWrapper: add findByTestSubject/findAllByTestSubject to search with data-test-subj (#60568)

* [web_element_wrapper] add find/findAll to search with data-test-subj

* fixes

* fix wrong function call

* review fixes

* simplify test

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Dmitry Lemeshko 2020-03-20 17:18:35 +03:00 committed by GitHub
parent 592ded89c0
commit 992c502cf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 90 additions and 88 deletions

View file

@ -23,7 +23,6 @@ export default function({ getService, getPageObjects }) {
const log = getService('log'); const log = getService('log');
const retry = getService('retry'); const retry = getService('retry');
const inspector = getService('inspector'); const inspector = getService('inspector');
const find = getService('find');
const filterBar = getService('filterBar'); const filterBar = getService('filterBar');
const testSubjects = getService('testSubjects'); const testSubjects = getService('testSubjects');
const browser = getService('browser'); const browser = getService('browser');
@ -279,7 +278,7 @@ export default function({ getService, getPageObjects }) {
it('should suppress zoom warning if suppress warnings button clicked', async () => { it('should suppress zoom warning if suppress warnings button clicked', async () => {
last = true; last = true;
await PageObjects.visChart.waitForVisualization(); await PageObjects.visChart.waitForVisualization();
await find.clickByCssSelector('[data-test-subj="suppressZoomWarnings"]'); await testSubjects.click('suppressZoomWarnings');
await PageObjects.tileMap.clickMapZoomOut(waitForLoading); await PageObjects.tileMap.clickMapZoomOut(waitForLoading);
await testSubjects.waitForDeleted('suppressZoomWarnings'); await testSubjects.waitForDeleted('suppressZoomWarnings');
await PageObjects.tileMap.clickMapZoomIn(waitForLoading); await PageObjects.tileMap.clickMapZoomIn(waitForLoading);

View file

@ -100,7 +100,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
private async loginIfPrompted(appUrl: string) { private async loginIfPrompted(appUrl: string) {
let currentUrl = await browser.getCurrentUrl(); let currentUrl = await browser.getCurrentUrl();
log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`); log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`);
await find.byCssSelector('[data-test-subj="kibanaChrome"]', 6 * defaultFindTimeout); // 60 sec waiting await testSubjects.find('kibanaChrome', 6 * defaultFindTimeout); // 60 sec waiting
const loginPage = currentUrl.includes('/login'); const loginPage = currentUrl.includes('/login');
const wantedLoginPage = appUrl.includes('/login') || appUrl.includes('/logout'); const wantedLoginPage = appUrl.includes('/login') || appUrl.includes('/logout');

View file

@ -255,14 +255,14 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
public async clickFieldListPlusFilter(field: string, value: string) { public async clickFieldListPlusFilter(field: string, value: string) {
// this method requires the field details to be open from clickFieldListItem() // this method requires the field details to be open from clickFieldListItem()
// testSubjects.find doesn't handle spaces in the data-test-subj value // testSubjects.find doesn't handle spaces in the data-test-subj value
await find.clickByCssSelector(`[data-test-subj="plus-${field}-${value}"]`); await testSubjects.click(`plus-${field}-${value}`);
await header.waitUntilLoadingHasFinished(); await header.waitUntilLoadingHasFinished();
} }
public async clickFieldListMinusFilter(field: string, value: string) { public async clickFieldListMinusFilter(field: string, value: string) {
// this method requires the field details to be open from clickFieldListItem() // this method requires the field details to be open from clickFieldListItem()
// testSubjects.find doesn't handle spaces in the data-test-subj value // testSubjects.find doesn't handle spaces in the data-test-subj value
await find.clickByCssSelector('[data-test-subj="minus-' + field + '-' + value + '"]'); await testSubjects.click(`minus-${field}-${value}`);
await header.waitUntilLoadingHasFinished(); await header.waitUntilLoadingHasFinished();
} }

View file

@ -54,7 +54,7 @@ export function NewsfeedPageProvider({ getService, getPageObjects }: FtrProvider
async getNewsfeedList() { async getNewsfeedList() {
const list = await testSubjects.find('NewsfeedFlyout'); const list = await testSubjects.find('NewsfeedFlyout');
const cells = await list.findAllByCssSelector('[data-test-subj="newsHeadAlert"]'); const cells = await list.findAllByTestSubject('newsHeadAlert');
const objects = []; const objects = [];
for (const cell of cells) { for (const cell of cells) {

View file

@ -211,9 +211,8 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
} }
async getScriptedFieldsTabCount() { async getScriptedFieldsTabCount() {
const selector = '[data-test-subj="tab-count-scriptedFields"]';
return await retry.try(async () => { return await retry.try(async () => {
const theText = await (await find.byCssSelector(selector)).getVisibleText(); const theText = await testSubjects.getVisibleText('tab-count-scriptedFields');
return theText.replace(/\((.*)\)/, '$1'); return theText.replace(/\((.*)\)/, '$1');
}); });
} }

View file

@ -19,7 +19,6 @@
export function TimelionPageProvider({ getService, getPageObjects }) { export function TimelionPageProvider({ getService, getPageObjects }) {
const testSubjects = getService('testSubjects'); const testSubjects = getService('testSubjects');
const find = getService('find');
const log = getService('log'); const log = getService('log');
const PageObjects = getPageObjects(['common', 'header']); const PageObjects = getPageObjects(['common', 'header']);
const esArchiver = getService('esArchiver'); const esArchiver = getService('esArchiver');
@ -55,12 +54,12 @@ export function TimelionPageProvider({ getService, getPageObjects }) {
} }
async getSuggestionItemsText() { async getSuggestionItemsText() {
const elements = await find.allByCssSelector('[data-test-subj="timelionSuggestionListItem"]'); const elements = await testSubjects.findAll('timelionSuggestionListItem');
return await Promise.all(elements.map(async element => await element.getVisibleText())); return await Promise.all(elements.map(async element => await element.getVisibleText()));
} }
async clickSuggestion(suggestionIndex = 0, waitTime = 500) { async clickSuggestion(suggestionIndex = 0, waitTime = 500) {
const elements = await find.allByCssSelector('[data-test-subj="timelionSuggestionListItem"]'); const elements = await testSubjects.findAll('timelionSuggestionListItem');
if (suggestionIndex > elements.length) { if (suggestionIndex > elements.length) {
throw new Error( throw new Error(
`Unable to select suggestion ${suggestionIndex}, only ${elements.length} suggestions available.` `Unable to select suggestion ${suggestionIndex}, only ${elements.length} suggestions available.`

View file

@ -485,7 +485,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
const labels = await testSubjects.findAll('aggRow'); const labels = await testSubjects.findAll('aggRow');
const label = labels[aggNth]; const label = labels[aggNth];
return (await label.findAllByCssSelector('[data-test-subj = "comboBoxInput"]'))[1]; return (await label.findAllByTestSubject('comboBoxInput'))[1];
} }
public async clickColorPicker(): Promise<void> { public async clickColorPicker(): Promise<void> {
@ -533,7 +533,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
*/ */
public async getAggregationCount(nth: number = 0): Promise<number> { public async getAggregationCount(nth: number = 0): Promise<number> {
const series = await this.getSeries(); const series = await this.getSeries();
const aggregation = await series[nth].findAllByCssSelector('[data-test-subj="draggable"]'); const aggregation = await series[nth].findAllByTestSubject('draggable');
return aggregation.length; return aggregation.length;
} }

View file

@ -110,7 +110,7 @@ export function VisualizeEditorPageProvider({ getService, getPageObjects }: FtrP
*/ */
public async clickBucket(bucketName: string, type = 'buckets') { public async clickBucket(bucketName: string, type = 'buckets') {
await testSubjects.click(`visEditorAdd_${type}`); await testSubjects.click(`visEditorAdd_${type}`);
await find.clickByCssSelector(`[data-test-subj="visEditorAdd_${type}_${bucketName}"`); await testSubjects.click(`visEditorAdd_${type}_${bucketName}`);
} }
public async clickEnableCustomRanges() { public async clickEnableCustomRanges() {

View file

@ -218,7 +218,7 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
return; return;
} }
const clearBtn = await comboBox.findByCssSelector('[data-test-subj="comboBoxClearButton"]'); const clearBtn = await comboBox.findByTestSubject('comboBoxClearButton');
await clearBtn.click(); await clearBtn.click();
const clearButtonStillExists = await this.doesClearButtonExist(comboBox); const clearButtonStillExists = await this.doesClearButtonExist(comboBox);
@ -230,8 +230,8 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
} }
public async doesClearButtonExist(comboBoxElement: WebElementWrapper): Promise<boolean> { public async doesClearButtonExist(comboBoxElement: WebElementWrapper): Promise<boolean> {
const found = await comboBoxElement.findAllByCssSelector( const found = await comboBoxElement.findAllByTestSubject(
'[data-test-subj="comboBoxClearButton"]', 'comboBoxClearButton',
WAIT_FOR_EXISTS_TIME WAIT_FOR_EXISTS_TIME
); );
return found.length > 0; return found.length > 0;
@ -264,9 +264,7 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
public async openOptionsList(comboBoxElement: WebElementWrapper): Promise<void> { public async openOptionsList(comboBoxElement: WebElementWrapper): Promise<void> {
const isOptionsListOpen = await testSubjects.exists('~comboBoxOptionsList'); const isOptionsListOpen = await testSubjects.exists('~comboBoxOptionsList');
if (!isOptionsListOpen) { if (!isOptionsListOpen) {
const toggleBtn = await comboBoxElement.findByCssSelector( const toggleBtn = await comboBoxElement.findByTestSubject('comboBoxToggleListButton');
'[data-test-subj="comboBoxToggleListButton"]'
);
await toggleBtn.click(); await toggleBtn.click();
} }
} }

View file

@ -48,12 +48,12 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
public async getBodyRows(): Promise<WebElementWrapper[]> { public async getBodyRows(): Promise<WebElementWrapper[]> {
const table = await this.getTable(); const table = await this.getTable();
return await table.findAllByCssSelector('[data-test-subj~="docTableRow"]'); return await table.findAllByTestSubject('~docTableRow');
} }
public async getAnchorRow(): Promise<WebElementWrapper> { public async getAnchorRow(): Promise<WebElementWrapper> {
const table = await this.getTable(); const table = await this.getTable();
return await table.findByCssSelector('[data-test-subj~="docTableAnchorRow"]'); return await table.findByTestSubject('~docTableAnchorRow');
} }
public async getRow(options: SelectOptions): Promise<WebElementWrapper> { public async getRow(options: SelectOptions): Promise<WebElementWrapper> {
@ -73,7 +73,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
options: SelectOptions = { isAnchorRow: false, rowIndex: 0 } options: SelectOptions = { isAnchorRow: false, rowIndex: 0 }
): Promise<void> { ): Promise<void> {
const row = await this.getRow(options); const row = await this.getRow(options);
const toggle = await row.findByCssSelector('[data-test-subj~="docTableExpandToggleColumn"]'); const toggle = await row.findByTestSubject('~docTableExpandToggleColumn');
await toggle.click(); await toggle.click();
} }
@ -90,7 +90,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
const detailsRow = options.isAnchorRow const detailsRow = options.isAnchorRow
? await this.getAnchorDetailsRow() ? await this.getAnchorDetailsRow()
: (await this.getDetailsRows())[options.rowIndex]; : (await this.getDetailsRows())[options.rowIndex];
return await detailsRow.findAllByCssSelector('[data-test-subj~="docTableRowAction"]'); return await detailsRow.findAllByTestSubject('~docTableRowAction');
} }
public async getFields(options: { isAnchorRow: boolean } = { isAnchorRow: false }) { public async getFields(options: { isAnchorRow: boolean } = { isAnchorRow: false }) {
@ -122,15 +122,13 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
detailsRow: WebElementWrapper, detailsRow: WebElementWrapper,
fieldName: WebElementWrapper fieldName: WebElementWrapper
): Promise<WebElementWrapper> { ): Promise<WebElementWrapper> {
return await detailsRow.findByCssSelector(`[data-test-subj~="tableDocViewRow-${fieldName}"]`); return await detailsRow.findByTestSubject(`~tableDocViewRow-${fieldName}`);
} }
public async getAddInclusiveFilterButton( public async getAddInclusiveFilterButton(
tableDocViewRow: WebElementWrapper tableDocViewRow: WebElementWrapper
): Promise<WebElementWrapper> { ): Promise<WebElementWrapper> {
return await tableDocViewRow.findByCssSelector( return await tableDocViewRow.findByTestSubject(`~addInclusiveFilterButton`);
`[data-test-subj~="addInclusiveFilterButton"]`
);
} }
public async addInclusiveFilter( public async addInclusiveFilter(
@ -146,7 +144,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
public async getAddExistsFilterButton( public async getAddExistsFilterButton(
tableDocViewRow: WebElementWrapper tableDocViewRow: WebElementWrapper
): Promise<WebElementWrapper> { ): Promise<WebElementWrapper> {
return await tableDocViewRow.findByCssSelector(`[data-test-subj~="addExistsFilterButton"]`); return await tableDocViewRow.findByTestSubject(`~addExistsFilterButton`);
} }
public async addExistsFilter( public async addExistsFilter(
@ -171,7 +169,7 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
const detailsRow = await row.findByXpath( const detailsRow = await row.findByXpath(
'./following-sibling::*[@data-test-subj="docTableDetailsRow"]' './following-sibling::*[@data-test-subj="docTableDetailsRow"]'
); );
return detailsRow.findByCssSelector('[data-test-subj~="docViewer"]'); return detailsRow.findByTestSubject('~docViewer');
}); });
} }
} }

View file

@ -537,6 +537,40 @@ export class WebElementWrapper {
}); });
} }
/**
* Gets the first element inside this element matching the given data-test-subj selector.
*
* @param {string} selector
* @return {Promise<WebElementWrapper>}
*/
public async findByTestSubject(selector: string) {
return await this.retryCall(async function find(wrapper) {
return wrapper._wrap(
await wrapper._webElement.findElement(wrapper.By.css(testSubjSelector(selector))),
wrapper.By.css(selector)
);
});
}
/**
* Gets all elements inside this element matching the given data-test-subj selector.
*
* @param {string} selector
* @param {number} timeout
* @return {Promise<WebElementWrapper[]>}
*/
public async findAllByTestSubject(selector: string, timeout?: number) {
return await this.retryCall(async function findAll(wrapper) {
return wrapper._wrapAll(
await wrapper._findWithCustomTimeout(
async () =>
await wrapper._webElement.findElements(wrapper.By.css(testSubjSelector(selector))),
timeout
)
);
});
}
/** /**
* Gets the first element inside this element matching the given CSS class name. * Gets the first element inside this element matching the given CSS class name.
* https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebElement.html#findElement * https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_WebElement.html#findElement

View file

@ -451,7 +451,7 @@ export function GisPageProvider({ getService, getPageObjects }) {
async getCodeBlockParsedJson(dataTestSubjName) { async getCodeBlockParsedJson(dataTestSubjName) {
log.debug(`Get parsed code block for ${dataTestSubjName}`); log.debug(`Get parsed code block for ${dataTestSubjName}`);
const indexRespCodeBlock = await find.byCssSelector(`[data-test-subj="${dataTestSubjName}"]`); const indexRespCodeBlock = await testSubjects.find(`${dataTestSubjName}`);
const indexRespJson = await indexRespCodeBlock.getAttribute('innerText'); const indexRespJson = await indexRespCodeBlock.getAttribute('innerText');
return JSON.parse(indexRespJson); return JSON.parse(indexRespJson);
} }

View file

@ -111,28 +111,18 @@ export function RollupPageProvider({ getService, getPageObjects }) {
async getJobList() { async getJobList() {
const jobs = await testSubjects.findAll('jobTableRow'); const jobs = await testSubjects.findAll('jobTableRow');
return mapAsync(jobs, async job => { return mapAsync(jobs, async job => {
const jobNameElement = await job.findByCssSelector('[data-test-subj="jobTableCell-id"]'); const jobNameElement = await job.findByTestSubject('jobTableCell-id');
const jobStatusElement = await job.findByCssSelector( const jobStatusElement = await job.findByTestSubject('jobTableCell-status');
'[data-test-subj="jobTableCell-status"]' const jobIndexPatternElement = await job.findByTestSubject('jobTableCell-indexPattern');
const jobRollUpIndexPatternElement = await job.findByTestSubject(
'jobTableCell-rollupIndex'
); );
const jobIndexPatternElement = await job.findByCssSelector( const jobDelayElement = await job.findByTestSubject('jobTableCell-rollupDelay');
'[data-test-subj="jobTableCell-indexPattern"]' const jobIntervalElement = await job.findByTestSubject(
); 'jobTableCell-dateHistogramInterval'
const jobRollUpIndexPatternElement = await job.findByCssSelector(
'[data-test-subj="jobTableCell-rollupIndex"]'
);
const jobDelayElement = await job.findByCssSelector(
'[data-test-subj="jobTableCell-rollupDelay"]'
);
const jobIntervalElement = await job.findByCssSelector(
'[data-test-subj="jobTableCell-dateHistogramInterval"]'
);
const jobGroupElement = await job.findByCssSelector(
'[data-test-subj="jobTableCell-groups"]'
);
const jobMetricsElement = await job.findByCssSelector(
'[data-test-subj="jobTableCell-metrics"]'
); );
const jobGroupElement = await job.findByTestSubject('jobTableCell-groups');
const jobMetricsElement = await job.findByTestSubject('jobTableCell-metrics');
return { return {
jobName: await jobNameElement.getVisibleText(), jobName: await jobNameElement.getVisibleText(),

View file

@ -229,13 +229,12 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
async getElasticsearchUsers() { async getElasticsearchUsers() {
const users = await testSubjects.findAll('userRow'); const users = await testSubjects.findAll('userRow');
return mapAsync(users, async user => { return mapAsync(users, async user => {
const fullnameElement = await user.findByCssSelector('[data-test-subj="userRowFullName"]'); const fullnameElement = await user.findByTestSubject('userRowFullName');
const usernameElement = await user.findByCssSelector('[data-test-subj="userRowUserName"]'); const usernameElement = await user.findByTestSubject('userRowUserName');
const emailElement = await user.findByCssSelector('[data-test-subj="userRowEmail"]'); const emailElement = await user.findByTestSubject('userRowEmail');
const rolesElement = await user.findByCssSelector('[data-test-subj="userRowRoles"]'); const rolesElement = await user.findByTestSubject('userRowRoles');
// findAllByCssSelector is substantially faster than `find.descendantExistsByCssSelector for negative cases // findAll is substantially faster than `find.descendantExistsByCssSelector for negative cases
const isUserReserved = const isUserReserved = (await user.findAllByTestSubject('userReserved', 1)).length > 0;
(await user.findAllByCssSelector('span[data-test-subj="userReserved"]', 1)).length > 0;
return { return {
username: await usernameElement.getVisibleText(), username: await usernameElement.getVisibleText(),
@ -251,15 +250,11 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
const users = await testSubjects.findAll('roleRow'); const users = await testSubjects.findAll('roleRow');
return mapAsync(users, async role => { return mapAsync(users, async role => {
const [rolename, reserved, deprecated] = await Promise.all([ const [rolename, reserved, deprecated] = await Promise.all([
role.findByCssSelector('[data-test-subj="roleRowName"]').then(el => el.getVisibleText()), role.findByTestSubject('roleRowName').then(el => el.getVisibleText()),
// findAllByCssSelector is substantially faster than `find.descendantExistsByCssSelector for negative cases // findAll is substantially faster than `find.descendantExistsByCssSelector for negative cases
role role.findAllByTestSubject('roleReserved', 1).then(el => el.length > 0),
.findAllByCssSelector('span[data-test-subj="roleReserved"]', 1) // findAll is substantially faster than `find.descendantExistsByCssSelector for negative cases
.then(el => el.length > 0), role.findAllByTestSubject('roleDeprecated', 1).then(el => el.length > 0),
// findAllByCssSelector is substantially faster than `find.descendantExistsByCssSelector for negative cases
role
.findAllByCssSelector('span[data-test-subj="roleDeprecated"]', 1)
.then(el => el.length > 0),
]); ]);
return { return {

View file

@ -28,21 +28,15 @@ export function SnapshotRestorePageProvider({ getService }: FtrProviderContext)
}, },
async getRepoList() { async getRepoList() {
const table = await testSubjects.find('repositoryTable'); const table = await testSubjects.find('repositoryTable');
const rows = await table.findAllByCssSelector('[data-test-subj="row"]'); const rows = await table.findAllByTestSubject('row');
return await Promise.all( return await Promise.all(
rows.map(async row => { rows.map(async row => {
return { return {
repoName: await ( repoName: await (await row.findByTestSubject('Name_cell')).getVisibleText(),
await row.findByCssSelector('[data-test-subj="Name_cell"]') repoLink: await (await row.findByTestSubject('Name_cell')).findByCssSelector('a'),
).getVisibleText(), repoType: await (await row.findByTestSubject('Type_cell')).getVisibleText(),
repoLink: await ( repoEdit: await row.findByTestSubject('editRepositoryButton'),
await row.findByCssSelector('[data-test-subj="Name_cell"]') repoDelete: await row.findByTestSubject('deleteRepositoryButton'),
).findByCssSelector('a'),
repoType: await (
await row.findByCssSelector('[data-test-subj="Type_cell"]')
).getVisibleText(),
repoEdit: await row.findByCssSelector('[data-test-subj="editRepositoryButton"]'),
repoDelete: await row.findByCssSelector('[data-test-subj="deleteRepositoryButton"]'),
}; };
}) })
); );

View file

@ -84,7 +84,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await testSubjects.click('slackAddVariableButton'); await testSubjects.click('slackAddVariableButton');
const variableMenuButton = await testSubjects.find('variableMenuButton-0'); const variableMenuButton = await testSubjects.find('variableMenuButton-0');
await variableMenuButton.click(); await variableMenuButton.click();
await find.clickByCssSelector('[data-test-subj="saveAlertButton"]'); await testSubjects.click('saveAlertButton');
const toastTitle = await pageObjects.common.closeToast(); const toastTitle = await pageObjects.common.closeToast();
expect(toastTitle).to.eql(`Saved '${alertName}'`); expect(toastTitle).to.eql(`Saved '${alertName}'`);
await pageObjects.triggersActionsUI.searchAlerts(alertName); await pageObjects.triggersActionsUI.searchAlerts(alertName);
@ -333,9 +333,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await testSubjects.click('collapsedItemActions'); await testSubjects.click('collapsedItemActions');
await testSubjects.click('deleteAlert'); await testSubjects.click('deleteAlert');
const emptyPrompt = await find.byCssSelector( const emptyPrompt = await testSubjects.find('createFirstAlertEmptyPrompt');
'[data-test-subj="createFirstAlertEmptyPrompt"]'
);
expect(await emptyPrompt.elementHasClass('euiEmptyPrompt')).to.be(true); expect(await emptyPrompt.elementHasClass('euiEmptyPrompt')).to.be(true);
}); });
@ -446,9 +444,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await testSubjects.click('deleteAll'); await testSubjects.click('deleteAll');
const emptyPrompt = await find.byCssSelector( const emptyPrompt = await testSubjects.find('createFirstAlertEmptyPrompt');
'[data-test-subj="createFirstAlertEmptyPrompt"]'
);
expect(await emptyPrompt.elementHasClass('euiEmptyPrompt')).to.be(true); expect(await emptyPrompt.elementHasClass('euiEmptyPrompt')).to.be(true);
}); });
}); });

View file

@ -19,14 +19,14 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext)
return await testSubjects.getVisibleText('appTitle'); return await testSubjects.getVisibleText('appTitle');
}, },
async clickCreateFirstConnectorButton() { async clickCreateFirstConnectorButton() {
const createBtn = await find.byCssSelector('[data-test-subj="createFirstActionButton"]'); const createBtn = await testSubjects.find('createFirstActionButton');
const createBtnIsVisible = await createBtn.isDisplayed(); const createBtnIsVisible = await createBtn.isDisplayed();
if (createBtnIsVisible) { if (createBtnIsVisible) {
await createBtn.click(); await createBtn.click();
} }
}, },
async clickCreateConnectorButton() { async clickCreateConnectorButton() {
const createBtn = await find.byCssSelector('[data-test-subj="createActionButton"]'); const createBtn = await testSubjects.find('createActionButton');
const createBtnIsVisible = await createBtn.isDisplayed(); const createBtnIsVisible = await createBtn.isDisplayed();
if (createBtnIsVisible) { if (createBtnIsVisible) {
await createBtn.click(); await createBtn.click();