Skip to content

Commit

Permalink
add basic exists check for switch
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Oct 22, 2024
1 parent c25cdee commit f4c9ed0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ export function RunControls({
helpText={i18n.translate(
'xpack.ml.timeSeriesExplorer.runControls.neverExpireHelpText',
{
defaultMessage:
'When selected, forecast results will be retained indefinitely. If disabled, forecasts will be retained for 14 days.',
defaultMessage: 'If disabled, forecasts will be retained for 14 days.',
}
)}
>
<EuiSwitch
data-test-subj="mlModalForecastNeverExpireSwitch"
disabled={disabledState.isDisabled}
label={i18n.translate(
'xpack.ml.timeSeriesExplorer.runControls.neverExpireLabel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default function ({ getService }: FtrProviderContext) {
await ml.forecast.assertForecastButtonExists();
await ml.forecast.assertForecastButtonEnabled(true);
await ml.forecast.openForecastModal();
await ml.forecast.assertForecastNeverExpireSwitchExists();
await ml.forecast.assertForecastModalRunButtonEnabled(true);

await ml.testExecution.logTestStep('should run the forecast and close the modal');
Expand Down
5 changes: 5 additions & 0 deletions x-pack/test/functional/services/ml/forecast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export function MachineLearningForecastProvider({ getPageObject, getService }: F
});
},

async assertForecastNeverExpireSwitchExists() {
await testSubjects.existOrFail('mlModalForecastNeverExpireSwitch');
expect(await testSubjects.isChecked('mlModalForecastNeverExpireSwitch')).to.be(false);
},

async assertForecastModalRunButtonEnabled(expectedValue: boolean) {
await headerPage.waitUntilLoadingHasFinished();
const isEnabled = await testSubjects.isEnabled('mlModalForecast > mlModalForecastButtonRun');
Expand Down

0 comments on commit f4c9ed0

Please sign in to comment.