kibana/x-pack/test/functional/page_objects/rollup_page.ts
Cee Chen a88cfc825d
Upgrade EUI to v95.9.0 (#190752)
`v95.7.0`  `v95.9.0`

> [!CAUTION]
> This PR contains the final set of Emotion conversions for all EuiForm
components.
> If your plugin contains any custom CSS/styling to **EuiFormRow,
EuiFormControlLayout, EuiCheckbox, EuiRadio, or EuiSwitch**, ⚠️ make
sure to QA your UI to ensure no visual regressions have occurred! ⚠️

---

## [`v95.9.0`](https://github.com/elastic/eui/releases/v95.9.0)

- Updated `EuiSearchBar`'s optional `box.schema` prop with a new
`recognizedFields` configuration. This allows specifying the phrases
that will be parsed as field clauses
([#7960](https://github.com/elastic/eui/pull/7960))
- Updated `EuiIcon` with a new `tokenSemanticText` glyph
([#7971](https://github.com/elastic/eui/pull/7971))
- Added support for TypeScript 5
([#7980](https://github.com/elastic/eui/pull/7980))

**Bug fixes**

- Fixed `EuiSelectableTemplateSitewide` styles when used within a
dark-themed `EuiHeader`
([#7977](https://github.com/elastic/eui/pull/7977))

## [`v95.8.0`](https://github.com/elastic/eui/releases/v95.8.0)

- Updated `EuiHeaderLinks`'s mobile menu to set a slight popover padding
by default ([#7961](https://github.com/elastic/eui/pull/7961))
- This can be overridden via `popoverProps.panelPaddingSize` if needed.
- Updated `EuiHeaderLink` to default to a size of `s` (down from `m`)
([#7961](https://github.com/elastic/eui/pull/7961))

**Accessibility**

- Updated the `aria-label` attribute for the `EuiFieldSearch` clear
button ([#7970](https://github.com/elastic/eui/pull/7970))

**Bug fixes**

- Fixed a visual bug with `<EuiDualRange showInput="inputWithPopover"
/>` form controls ([#7957](https://github.com/elastic/eui/pull/7957))

**Deprecations**

- Deprecated `EuiFormRow`'s `columnCompressedSwitch` display prop. Use
`columnCompressed` instead, which will automatically account for child
`EuiSwitch`es ([#7968](https://github.com/elastic/eui/pull/7968))
- Deprecated `EuiFormRow`'s `rowCompressed` display prop. Use `row`
instead for vertical forms, or `centerCompressed` for inline forms
([#7968](https://github.com/elastic/eui/pull/7968))
- (Styling) Updated `EuiFormRow`'s `hasEmptySpaceLabel` prop to no
longer attempt to automatically align its content to a vertical center.
Use the `display="center"` prop for that instead
([#7968](https://github.com/elastic/eui/pull/7968))

**CSS-in-JS conversions**

- Converted `EuiFormControlLayout` to Emotion
([#7954](https://github.com/elastic/eui/pull/7954))
- Removed `.euiFormControlLayout--*icons` classNames and
`--eui-form-control-layout-icons-padding` CSS var. Use
`--euiFormControlRightIconsCount` or `--euiFormControlLeftIconsCount`
instead
- Converted `EuiFormLayoutDelimited` to Emotion
([#7957](https://github.com/elastic/eui/pull/7957))
- Fixed `cloneElementWithCss` throwing an error when used multiple times
without a `key` prop ([#7957](https://github.com/elastic/eui/pull/7957))
- Updated `cloneElementWithCss` utility to support a third argument that
allows prepending vs. appending the cloned Emotion css className
([#7957](https://github.com/elastic/eui/pull/7957))
- Removed `@euiFormControlLayoutClearIcon` Sass mixin
([#7959](https://github.com/elastic/eui/pull/7959))
- Converted `EuiDescribedFormGroup` to Emotion
([#7964](https://github.com/elastic/eui/pull/7964))
- Converted `EuiForm`, `EuiFormHelpText`, and `EuiFormErrorText` to
Emotion ([#7966](https://github.com/elastic/eui/pull/7966))
- Converted `EuiFormLabel` and `EuiFormLegend` to Emotion; Removed
`@euiFormLabel` mixin
([#7967](https://github.com/elastic/eui/pull/7967))
- Converted `EuiFormRow` to Emotion
([#7968](https://github.com/elastic/eui/pull/7968))
- Converted `EuiCheckbox` to Emotion
([#7969](https://github.com/elastic/eui/pull/7969))
- Converted `EuiRadio` to Emotion
([#7969](https://github.com/elastic/eui/pull/7969))
- Converted `EuiSwitch` to Emotion
([#7969](https://github.com/elastic/eui/pull/7969))
- Removed the following Sass variables:
([#7969](https://github.com/elastic/eui/pull/7969))
  - `$euiFormCustomControlDisabledIconColor`
  - `$euiFormCustomControlBorderColor`
  - `$euiRadioSize`
  - `$euiCheckBoxSize`
  - `$euiCheckboxBorderRadius`
  - `$euiSwitchHeight` (and compressed/mini variants)
  - `$euiSwitchWidth` (and compressed/mini variants)
  - `$euiSwitchThumbSize` (and compressed/mini variants)
  - `$euiSwitchIconHeight`
  - `$euiSwitchOffColor`
- Removed the following Sass mixins:
([#7969](https://github.com/elastic/eui/pull/7969))
  - `euiIconBackground`
  - `euiCustomControl`
  - `euiCustomControlSelected`
  - `euiCustomControlDisabled`
  - `euiCustomControlFocused`

---------

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
2024-08-30 17:47:17 -07:00

160 lines
5.9 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import expect from '@kbn/expect';
import { FtrService } from '../ftr_provider_context';
export class RollupPageObject extends FtrService {
private readonly testSubjects = this.ctx.getService('testSubjects');
private readonly log = this.ctx.getService('log');
private readonly find = this.ctx.getService('find');
private readonly header = this.ctx.getPageObject('header');
private readonly common = this.ctx.getPageObject('common');
private readonly retry = this.ctx.getService('retry');
async createNewRollUpJob(
jobName: string,
indexPattern: string,
indexName: string,
interval: string,
delay = '1d',
startImmediately = false,
scheduledTime = { time: 'minute', cron: true }
) {
let stepNum = 1;
// Step 1
await this.common.navigateToUrlWithBrowserHistory('rollupJob', '/create');
await this.verifyStepIsActive(stepNum);
await this.addRollupNameandIndexPattern(jobName, indexPattern);
await this.verifyIndexPatternAccepted();
await this.setIndexName(indexName);
await this.setScheduleTime(scheduledTime.time, scheduledTime.cron);
await this.setRollupDelay(delay);
stepNum = await this.moveToNextStep(stepNum);
// Step 2: Histogram
await this.verifyStepIsActive(stepNum);
await this.setJobInterval(interval);
stepNum = await this.moveToNextStep(stepNum);
// Step 3: Terms (optional)
await this.verifyStepIsActive(stepNum);
stepNum = await this.moveToNextStep();
// Step 4: Histogram(optional)
await this.verifyStepIsActive(stepNum);
stepNum = await this.moveToNextStep();
// Step 5: Metrics(optional)
await this.verifyStepIsActive(stepNum);
stepNum = await this.moveToNextStep();
// Step 6: saveJob and verify the name in the list
await this.verifyStepIsActive(stepNum);
await this.saveJob(startImmediately);
}
async clickRollupJobsTab() {
await this.testSubjects.click('rollup_jobs');
await this.retry.waitFor('create policy button to be visible', async () => {
return await this.testSubjects.isDisplayed('createRollupJobButton');
});
}
async verifyStepIsActive(stepNumber = 0) {
await this.testSubjects.exists(`createRollupStep${stepNumber}--active`);
}
async setScheduleTime(time: string, isCron: boolean) {
if (isCron) {
await this.testSubjects.click('rollupShowAdvancedCronLink');
await this.testSubjects.setValue('rollupAdvancedCron', time);
}
// TODO: Add handling for if Cron is false to go through clicking options.
}
async addRollupNameandIndexPattern(name: string, indexPattern: string) {
this.log.debug(`Adding name ${name} to form`);
await this.testSubjects.setValue('rollupJobName', name);
await this.testSubjects.setValue('rollupIndexPattern', indexPattern);
}
async setRollupDelay(time: string) {
this.log.debug(`Setting rollup delay to "${time}"`);
await this.testSubjects.setValue('rollupDelay', time);
}
async verifyIndexPatternAccepted() {
const span = await this.testSubjects.find('fieldIndexPatternSuccessMessage');
const message = await span.findByCssSelector('p');
const text = await message.getVisibleText();
expect(text).to.be.equal('Success! Index pattern has matching indices.');
}
async setIndexName(name: string) {
await this.testSubjects.setValue('rollupIndexName', name);
}
async moveToNextStep(stepNum = 0) {
await this.testSubjects.click('rollupJobNextButton');
return stepNum + 1;
}
async setJobInterval(time: string) {
await this.testSubjects.setValue('rollupJobInterval', time);
}
async saveJob(startImmediately: boolean) {
if (startImmediately) {
const checkbox = await this.find.byCssSelector('.euiCheckbox__input');
await checkbox.click();
}
await this.testSubjects.click('rollupJobSaveButton');
await this.header.waitUntilLoadingHasFinished();
await this.retry.waitFor('detail flyout', async () => {
return await this.testSubjects.isDisplayed('rollupJobDetailsFlyoutTitle');
});
}
async closeFlyout() {
await this.testSubjects.click('euiFlyoutCloseButton');
await this.retry.waitFor('rollup list table', async () => {
return await this.testSubjects.isDisplayed('rollupJobsListTable');
});
}
async getJobList() {
const jobs = await this.testSubjects.findAll('jobTableRow');
return await Promise.all(
jobs.map(async (job) => {
const jobNameElement = await job.findByTestSubject('jobTableCell-id');
const jobStatusElement = await job.findByTestSubject('jobTableCell-status');
const jobIndexPatternElement = await job.findByTestSubject('jobTableCell-indexPattern');
const jobRollUpIndexPatternElement = await job.findByTestSubject(
'jobTableCell-rollupIndex'
);
const jobDelayElement = await job.findByTestSubject('jobTableCell-rollupDelay');
const jobIntervalElement = await job.findByTestSubject(
'jobTableCell-dateHistogramInterval'
);
const jobGroupElement = await job.findByTestSubject('jobTableCell-groups');
const jobMetricsElement = await job.findByTestSubject('jobTableCell-metrics');
return {
jobName: await jobNameElement.getVisibleText(),
jobStatus: await jobStatusElement.getVisibleText(),
jobIndexPattern: await jobIndexPatternElement.getVisibleText(),
jobRollUpIndexPattern: await jobRollUpIndexPatternElement.getVisibleText(),
jobDelayElement: await jobDelayElement.getVisibleText(),
jobInterval: await jobIntervalElement.getVisibleText(),
jobGroup: await jobGroupElement.getVisibleText(),
jobMetrics: await jobMetricsElement.getVisibleText(),
};
})
);
}
}