mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Improve launchSampleData of HomePageProvider for cloud testing * Migrate to typescript
This commit is contained in:
parent
78e95b5295
commit
eb13fa3691
1 changed files with 20 additions and 20 deletions
|
@ -17,47 +17,42 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
export function HomePageProvider({ getService }) {
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function HomePageProvider({ getService }: FtrProviderContext) {
|
||||
const testSubjects = getService('testSubjects');
|
||||
const retry = getService('retry');
|
||||
const find = getService('find');
|
||||
|
||||
class HomePage {
|
||||
async clickSynopsis(title) {
|
||||
async clickSynopsis(title: string) {
|
||||
await testSubjects.click(`homeSynopsisLink${title}`);
|
||||
}
|
||||
|
||||
async doesSynopsisExist(title) {
|
||||
async doesSynopsisExist(title: string) {
|
||||
return await testSubjects.exists(`homeSynopsisLink${title}`);
|
||||
}
|
||||
|
||||
async doesSampleDataSetExist(id) {
|
||||
async doesSampleDataSetExist(id: string) {
|
||||
return await testSubjects.exists(`sampleDataSetCard${id}`);
|
||||
}
|
||||
|
||||
async doesSampleDataSetSuccessfulInstallToastExist() {
|
||||
return await testSubjects.exists('sampleDataSetInstallToast');
|
||||
}
|
||||
|
||||
async doesSampleDataSetSuccessfulUninstallToastExist() {
|
||||
return await testSubjects.exists('sampleDataSetUninstallToast');
|
||||
}
|
||||
|
||||
async isSampleDataSetInstalled(id) {
|
||||
async isSampleDataSetInstalled(id: string) {
|
||||
return await testSubjects.exists(`removeSampleDataSet${id}`);
|
||||
}
|
||||
|
||||
async addSampleDataSet(id) {
|
||||
async addSampleDataSet(id: string) {
|
||||
await testSubjects.click(`addSampleDataSet${id}`);
|
||||
await this._waitForSampleDataLoadingAction(id);
|
||||
}
|
||||
|
||||
async removeSampleDataSet(id) {
|
||||
async removeSampleDataSet(id: string) {
|
||||
await testSubjects.click(`removeSampleDataSet${id}`);
|
||||
await this._waitForSampleDataLoadingAction(id);
|
||||
}
|
||||
|
||||
// loading action is either uninstall and install
|
||||
async _waitForSampleDataLoadingAction(id) {
|
||||
async _waitForSampleDataLoadingAction(id: string) {
|
||||
const sampleDataCard = await testSubjects.find(`sampleDataSetCard${id}`);
|
||||
await retry.try(async () => {
|
||||
// waitForDeletedByCssSelector needs to be inside retry because it will timeout at least once
|
||||
|
@ -66,22 +61,27 @@ export function HomePageProvider({ getService }) {
|
|||
});
|
||||
}
|
||||
|
||||
async launchSampleDataSet(id) {
|
||||
await testSubjects.click(`launchSampleDataSet${id}`);
|
||||
async launchSampleDataSet(id: string) {
|
||||
if (await find.existsByCssSelector(`#sampleDataLinks${id}`)) {
|
||||
// omits cloud test failures
|
||||
await find.clickByCssSelectorWhenNotDisabled(`#sampleDataLinks${id}`);
|
||||
await find.clickByCssSelector('.euiContextMenuItem:nth-of-type(1)');
|
||||
} else {
|
||||
await testSubjects.click(`launchSampleDataSet${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
async loadSavedObjects() {
|
||||
await retry.try(async () => {
|
||||
await testSubjects.click('loadSavedObjects');
|
||||
const successMsgExists = await testSubjects.exists('loadSavedObjects_success', {
|
||||
timeout: 5000
|
||||
timeout: 5000,
|
||||
});
|
||||
if (!successMsgExists) {
|
||||
throw new Error('Failed to load saved objects');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new HomePage();
|
Loading…
Add table
Add a link
Reference in a new issue