[Upgrade Assistant] Fixes to Upgrade Assistant Tests and Page Objects To Stop CI Failures (#89942)
* Updated test to use no hard coded waits which could be contributing to CI failures. Expect functions should be in the test file itself so I changed the page objects for page actions and extracted out the expect calls to the test files. * Added retry within the test file to retry the assertion if it doesn't pass on the first attempt. Simplified the toggle function to just click the toggle. * Fixed type check issue. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
06bc99d825
commit
14cf1875b5
|
@ -4,6 +4,7 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* you may not use this file except in compliance with the Elastic License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import expect from '@kbn/expect';
|
||||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||||
|
|
||||||
export default function upgradeAssistantFunctionalTests({
|
export default function upgradeAssistantFunctionalTests({
|
||||||
|
@ -14,6 +15,7 @@ export default function upgradeAssistantFunctionalTests({
|
||||||
const PageObjects = getPageObjects(['upgradeAssistant', 'common']);
|
const PageObjects = getPageObjects(['upgradeAssistant', 'common']);
|
||||||
const security = getService('security');
|
const security = getService('security');
|
||||||
const log = getService('log');
|
const log = getService('log');
|
||||||
|
const retry = getService('retry');
|
||||||
|
|
||||||
describe('Upgrade Checkup', function () {
|
describe('Upgrade Checkup', function () {
|
||||||
this.tags('includeFirefox');
|
this.tags('includeFirefox');
|
||||||
|
@ -24,41 +26,52 @@ export default function upgradeAssistantFunctionalTests({
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await PageObjects.upgradeAssistant.expectTelemetryHasFinish();
|
await PageObjects.upgradeAssistant.waitForTelemetryHidden();
|
||||||
await esArchiver.unload('empty_kibana');
|
await esArchiver.unload('empty_kibana');
|
||||||
await security.testUser.restoreDefaults();
|
await security.testUser.restoreDefaults();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows user to navigate to upgrade checkup', async () => {
|
it('allows user to navigate to upgrade checkup', async () => {
|
||||||
await PageObjects.upgradeAssistant.navigateToPage();
|
await PageObjects.upgradeAssistant.navigateToPage();
|
||||||
await PageObjects.upgradeAssistant.expectUpgradeAssistant();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows user to toggle deprecation logging', async () => {
|
it('allows user to toggle deprecation logging', async () => {
|
||||||
await PageObjects.upgradeAssistant.navigateToPage();
|
|
||||||
log.debug('expect initial state to be ON');
|
log.debug('expect initial state to be ON');
|
||||||
await PageObjects.upgradeAssistant.expectDeprecationLoggingLabel('On');
|
expect(await PageObjects.upgradeAssistant.deprecationLoggingEnabledLabel()).to.be('On');
|
||||||
log.debug('Now toggle to off');
|
expect(await PageObjects.upgradeAssistant.isDeprecationLoggingEnabled()).to.be(true);
|
||||||
await PageObjects.upgradeAssistant.toggleDeprecationLogging();
|
|
||||||
await PageObjects.common.sleep(2000);
|
await retry.try(async () => {
|
||||||
log.debug('expect state to be OFF after toggle');
|
log.debug('Now toggle to off');
|
||||||
await PageObjects.upgradeAssistant.expectDeprecationLoggingLabel('Off');
|
await PageObjects.upgradeAssistant.toggleDeprecationLogging();
|
||||||
await PageObjects.upgradeAssistant.toggleDeprecationLogging();
|
|
||||||
await PageObjects.common.sleep(2000);
|
log.debug('expect state to be OFF after toggle');
|
||||||
log.debug('expect state to be ON after toggle');
|
expect(await PageObjects.upgradeAssistant.isDeprecationLoggingEnabled()).to.be(false);
|
||||||
await PageObjects.upgradeAssistant.expectDeprecationLoggingLabel('On');
|
expect(await PageObjects.upgradeAssistant.deprecationLoggingEnabledLabel()).to.be('Off');
|
||||||
|
});
|
||||||
|
|
||||||
|
log.debug('Now toggle back on.');
|
||||||
|
await retry.try(async () => {
|
||||||
|
await PageObjects.upgradeAssistant.toggleDeprecationLogging();
|
||||||
|
log.debug('expect state to be ON after toggle');
|
||||||
|
expect(await PageObjects.upgradeAssistant.isDeprecationLoggingEnabled()).to.be(true);
|
||||||
|
expect(await PageObjects.upgradeAssistant.deprecationLoggingEnabledLabel()).to.be('On');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows user to open cluster tab', async () => {
|
it('allows user to open cluster tab', async () => {
|
||||||
await PageObjects.upgradeAssistant.navigateToPage();
|
await PageObjects.upgradeAssistant.navigateToPage();
|
||||||
await PageObjects.upgradeAssistant.clickTab('cluster');
|
await PageObjects.upgradeAssistant.clickTab('cluster');
|
||||||
await PageObjects.upgradeAssistant.expectIssueSummary('You have no cluster issues.');
|
expect(await PageObjects.upgradeAssistant.issueSummaryText()).to.be(
|
||||||
|
'You have no cluster issues.'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows user to open indices tab', async () => {
|
it('allows user to open indices tab', async () => {
|
||||||
await PageObjects.upgradeAssistant.navigateToPage();
|
await PageObjects.upgradeAssistant.navigateToPage();
|
||||||
await PageObjects.upgradeAssistant.clickTab('indices');
|
await PageObjects.upgradeAssistant.clickTab('indices');
|
||||||
await PageObjects.upgradeAssistant.expectIssueSummary('You have no index issues.');
|
expect(await PageObjects.upgradeAssistant.issueSummaryText()).to.be(
|
||||||
|
'You have no index issues.'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* you may not use this file except in compliance with the Elastic License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import expect from '@kbn/expect';
|
|
||||||
import { FtrProviderContext } from '../ftr_provider_context';
|
import { FtrProviderContext } from '../ftr_provider_context';
|
||||||
|
|
||||||
export function UpgradeAssistantPageProvider({ getPageObjects, getService }: FtrProviderContext) {
|
export function UpgradeAssistantPageProvider({ getPageObjects, getService }: FtrProviderContext) {
|
||||||
|
@ -24,34 +23,32 @@ export function UpgradeAssistantPageProvider({ getPageObjects, getService }: Ftr
|
||||||
return await retry.try(async () => {
|
return await retry.try(async () => {
|
||||||
await common.navigateToApp('settings');
|
await common.navigateToApp('settings');
|
||||||
await testSubjects.click('upgrade_assistant');
|
await testSubjects.click('upgrade_assistant');
|
||||||
});
|
retry.waitFor('url to contain /upgrade_assistant', async () => {
|
||||||
}
|
const url = await browser.getCurrentUrl();
|
||||||
|
return url.includes('/upgrade_assistant');
|
||||||
async expectUpgradeAssistant() {
|
});
|
||||||
return await retry.try(async () => {
|
|
||||||
log.debug(`expectUpgradeAssistant()`);
|
|
||||||
expect(await testSubjects.exists('upgradeAssistantRoot')).to.equal(true);
|
|
||||||
const url = await browser.getCurrentUrl();
|
|
||||||
expect(url).to.contain(`/upgrade_assistant`);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleDeprecationLogging() {
|
async toggleDeprecationLogging() {
|
||||||
return await retry.try(async () => {
|
log.debug('toggleDeprecationLogging()');
|
||||||
log.debug('toggleDeprecationLogging()');
|
await testSubjects.click('upgradeAssistantDeprecationToggle');
|
||||||
await testSubjects.click('upgradeAssistantDeprecationToggle');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async expectDeprecationLoggingLabel(labelText: string) {
|
async isDeprecationLoggingEnabled() {
|
||||||
return await retry.try(async () => {
|
const isDeprecationEnabled = await testSubjects.getAttribute(
|
||||||
log.debug('expectDeprecationLoggingLabel()');
|
'upgradeAssistantDeprecationToggle',
|
||||||
const label = await find.byCssSelector(
|
'aria-checked'
|
||||||
'[data-test-subj="upgradeAssistantDeprecationToggle"] ~ span'
|
);
|
||||||
);
|
log.debug(`Deprecation enabled == ${isDeprecationEnabled}`);
|
||||||
const value = await label.getVisibleText();
|
return isDeprecationEnabled === 'true';
|
||||||
expect(value).to.equal(labelText);
|
}
|
||||||
});
|
|
||||||
|
async deprecationLoggingEnabledLabel() {
|
||||||
|
const loggingEnabledLabel = await find.byCssSelector(
|
||||||
|
'[data-test-subj="upgradeAssistantDeprecationToggle"] ~ span'
|
||||||
|
);
|
||||||
|
return await loggingEnabledLabel.getVisibleText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickTab(tabId: string) {
|
async clickTab(tabId: string) {
|
||||||
|
@ -61,22 +58,20 @@ export function UpgradeAssistantPageProvider({ getPageObjects, getService }: Ftr
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async expectIssueSummary(summary: string) {
|
async waitForTelemetryHidden() {
|
||||||
return await retry.try(async () => {
|
const self = this;
|
||||||
log.debug('expectIssueSummary()');
|
retry.waitFor('Telemetry to disappear.', async () => {
|
||||||
const summaryElText = await testSubjects.getVisibleText('upgradeAssistantIssueSummary');
|
return (await self.isTelemetryExists()) === false;
|
||||||
expect(summaryElText).to.eql(summary);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async expectTelemetryHasFinish() {
|
async issueSummaryText() {
|
||||||
return await retry.try(async () => {
|
log.debug('expectIssueSummary()');
|
||||||
log.debug('expectTelemetryHasFinish');
|
return await testSubjects.getVisibleText('upgradeAssistantIssueSummary');
|
||||||
const isTelemetryFinished = !(await testSubjects.exists(
|
}
|
||||||
'upgradeAssistantTelemetryRunning'
|
|
||||||
));
|
async isTelemetryExists() {
|
||||||
expect(isTelemetryFinished).to.equal(true);
|
return await testSubjects.exists('upgradeAssistantTelemetryRunning');
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue