mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* [@kbn/expect] "fork" expect.js into repo * [eslint] autofix references to expect.js * [tslint] autofix all expect.js imports * now that expect.js is in strict mode, avoid reassigning fn.length
81 lines
2.7 KiB
JavaScript
81 lines
2.7 KiB
JavaScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
|
|
import expect from '@kbn/expect';
|
|
|
|
export function UpgradeAssistantProvider({ getService, getPageObjects }) {
|
|
const retry = getService('retry');
|
|
const log = getService('log');
|
|
const browser = getService('browser');
|
|
const find = getService('find');
|
|
const testSubjects = getService('testSubjects');
|
|
const PageObjects = getPageObjects(['common', 'settings', 'security']);
|
|
|
|
class UpgradeAssistant {
|
|
async initTests() {
|
|
log.debug('UpgradeAssistant:initTests');
|
|
}
|
|
|
|
async navigateToPage() {
|
|
return await retry.try(async () => {
|
|
await PageObjects.common.navigateToApp('settings');
|
|
await testSubjects.click('upgrade_assistant');
|
|
});
|
|
}
|
|
|
|
async expectUpgradeAssistant() {
|
|
return await retry.try(async () => {
|
|
log.debug(`expectUpgradeAssistant()`);
|
|
expect(testSubjects.exists('upgradeAssistantRoot')).to.be.true;
|
|
const url = await browser.getCurrentUrl();
|
|
expect(url).to.contain(`/upgrade_assistant`);
|
|
});
|
|
}
|
|
|
|
async toggleDeprecationLogging() {
|
|
return await retry.try(async () => {
|
|
log.debug('toggleDeprecationLogging()');
|
|
await testSubjects.click('upgradeAssistantDeprecationToggle');
|
|
});
|
|
}
|
|
|
|
async expectDeprecationLoggingLabel(labelText) {
|
|
return await retry.try(async () => {
|
|
log.debug('expectDeprecationLoggingLabel()');
|
|
const label = await find.byCssSelector('[data-test-subj="upgradeAssistantDeprecationToggle"] ~ label');
|
|
const value = await label.getVisibleText();
|
|
expect(value).to.equal(labelText);
|
|
});
|
|
}
|
|
|
|
async clickTab(tabId) {
|
|
return await retry.try(async () => {
|
|
log.debug('clickTab()');
|
|
const tab = await find.byCssSelector(`.euiTabs .euiTab#${tabId}`);
|
|
await tab.click();
|
|
});
|
|
}
|
|
|
|
async expectIssueSummary(summary) {
|
|
return await retry.try(async () => {
|
|
log.debug('expectIssueSummary()');
|
|
const summaryEl = await testSubjects.find('upgradeAssistantIssueSummary');
|
|
const summaryElText = await summaryEl.getVisibleText();
|
|
expect(summaryElText).to.eql(summary);
|
|
});
|
|
}
|
|
|
|
async expectTelemetryHasFinish() {
|
|
return await retry.try(async () => {
|
|
log.debug('expectTelemetryHasFinish');
|
|
const isTelemetryFinished = !(await testSubjects.exists('upgradeAssistantTelemetryRunning'));
|
|
expect(isTelemetryFinished).to.equal(true);
|
|
});
|
|
}
|
|
}
|
|
|
|
return new UpgradeAssistant();
|
|
}
|