Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export const CustomUrlEditor: FC<CustomUrlEditorProps> = ({
onChange={onLabelChange}
isInvalid={isInvalidLabel}
compressed
data-test-subj="mlJobCustomUrlLabelInput"
/>
</EuiFormRow>
<EuiFormRow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ export class CustomUrls extends Component<CustomUrlsProps, CustomUrlsState> {
: true;

const addButton = (
<EuiButton onClick={this.addNewCustomUrl} isDisabled={!isValidEditorSettings}>
<EuiButton
onClick={this.addNewCustomUrl}
isDisabled={!isValidEditorSettings}
data-test-subj="mlJobAddCustomUrl"
>
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.customUrls.addButtonLabel"
defaultMessage="Add"
Expand Down Expand Up @@ -270,7 +274,12 @@ export class CustomUrls extends Component<CustomUrlsProps, CustomUrlsState> {
</EuiPanel>
) : (
<EuiOverlayMask>
<EuiModal onClose={this.closeEditor} initialFocus="[name=label]" style={{ width: 500 }}>
<EuiModal
onClose={this.closeEditor}
initialFocus="[name=label]"
style={{ width: 500 }}
data-test-subj="mlJobNewCustomUrlFormModal"
>
<EuiModalHeader>
<EuiModalHeaderTitle>
<FormattedMessage
Expand Down Expand Up @@ -299,7 +308,11 @@ export class CustomUrls extends Component<CustomUrlsProps, CustomUrlsState> {
<>
<EuiSpacer size="m" />
{(!editorOpen || editMode === 'modal') && (
<EuiButton size="s" onClick={this.editNewCustomUrl}>
<EuiButton
size="s"
onClick={this.editNewCustomUrl}
data-test-subj="mlJobOpenCustomUrlFormButton"
>
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.customUrls.addCustomUrlButtonLabel"
defaultMessage="Add custom URL"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ export const AdditionalSection: FC<Props> = ({ additionalExpanded, setAdditional
buttonContent={ButtonContent}
onToggle={setAdditionalExpanded}
initialIsOpen={additionalExpanded}
data-test-subj="mlJobWizardToggleAdditionalSettingsSection"
>
<EuiSpacer />
<section data-test-subj="mlJobWizardAdditionalSettingsSection">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why section is being used here, it seems to me to be a misuse of this tag.
A div might be more appropriate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it's semantically a section for additional settings

@jgowdyelastic jgowdyelastic Dec 6, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use the section element as a generic container; this is what div is for

IMO section is for documents, not web apps.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a problem, i was just wondering if there was some specific reason for using it here as i've only ever seen it being used for documents or webpages where the contents are similar in theme.
Searching through the rest of kibana i see It's been used in a similar way a couple of times.

<EuiSpacer />

<EuiFlexGroup gutterSize="xl" style={{ marginLeft: '0px', marginRight: '0px' }}>
<EuiFlexItem>
<CustomUrlsSelection />
</EuiFlexItem>
</EuiFlexGroup>
<EuiFlexGroup gutterSize="xl" style={{ marginLeft: '0px', marginRight: '0px' }}>
<EuiFlexItem>
<CustomUrlsSelection />
</EuiFlexItem>
</EuiFlexGroup>

<EuiFlexGroup gutterSize="xl" style={{ marginLeft: '0px', marginRight: '0px' }}>
<EuiFlexItem>
<CalendarsSelection />
</EuiFlexItem>
<EuiFlexItem />
</EuiFlexGroup>
<EuiFlexGroup gutterSize="xl" style={{ marginLeft: '0px', marginRight: '0px' }}>
<EuiFlexItem>
<CalendarsSelection />
</EuiFlexItem>
<EuiFlexItem />
</EuiFlexGroup>
</section>
</EuiAccordion>
</Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const CalendarsSelection: FC = () => {
<Description>
<EuiFlexGroup gutterSize="xs" alignItems="center">
<EuiFlexItem>
<EuiComboBox {...comboBoxProps} />
<EuiComboBox {...comboBoxProps} data-test-subj="mlJobWizardComboBoxCalendars" />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiToolTip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export default function({ getService }: FtrProviderContext) {
this.tags(['smoke', 'mlqa']);
before(async () => {
await esArchiver.load('ml/ecommerce');
await ml.api.createCalendar('wizard-test-calendar');
});

after(async () => {
Comment thread
pheyos marked this conversation as resolved.
Expand Down Expand Up @@ -464,6 +465,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(testData.jobGroups);
});

it('job creation opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job creation adds a new custom url', async () => {
await ml.jobWizardCommon.addCustomUrl();
});

it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.assignCalendar('wizard-test-calendar');
});

it('job creation displays the model plot switch', async () => {
await ml.jobWizardCommon.assertModelPlotSwitchExists({ withAdvancedSection: false });
});
Expand Down Expand Up @@ -709,6 +722,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(testData.jobGroupsClone);
});

it('job cloning opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job cloning persists custom urls', async () => {
await ml.customUrls.assertCustomUrlItem(0);
});

it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']);
});

it('job cloning pre-fills the model plot switch', async () => {
await ml.jobWizardCommon.assertModelPlotSwitchExists({ withAdvancedSection: false });
await ml.jobWizardCommon.assertModelPlotSwitchCheckedState(false, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default function({ getService }: FtrProviderContext) {
this.tags(['smoke', 'mlqa']);
before(async () => {
await esArchiver.load('ml/farequote');
await ml.api.createCalendar('wizard-test-calendar');
});

after(async () => {
Comment thread
pheyos marked this conversation as resolved.
Expand Down Expand Up @@ -170,6 +171,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(jobGroups);
});

it('job creation opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job creation adds a new custom url', async () => {
await ml.jobWizardCommon.addCustomUrl();
});

it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.assignCalendar('wizard-test-calendar');
});

it('job creation opens the advanced section', async () => {
await ml.jobWizardCommon.ensureAdvancedSectionOpen();
});
Expand Down Expand Up @@ -306,6 +319,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(jobGroupsClone);
});

it('job cloning opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job cloning persists custom urls', async () => {
await ml.customUrls.assertCustomUrlItem(0);
});

it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']);
});

it('job cloning opens the advanced section', async () => {
await ml.jobWizardCommon.ensureAdvancedSectionOpen();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default function({ getService }: FtrProviderContext) {
this.tags(['smoke', 'mlqa']);
before(async () => {
await esArchiver.load('ml/ecommerce');
await ml.api.createCalendar('wizard-test-calendar');
});

after(async () => {
Comment thread
pheyos marked this conversation as resolved.
Expand Down Expand Up @@ -197,6 +198,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(jobGroups);
});

it('job creation opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job creation adds a new custom url', async () => {
await ml.jobWizardCommon.addCustomUrl();
});

it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.assignCalendar('wizard-test-calendar');
});

it('job creation opens the advanced section', async () => {
await ml.jobWizardCommon.ensureAdvancedSectionOpen();
});
Expand Down Expand Up @@ -344,6 +357,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(jobGroupsClone);
});

it('job cloning opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job cloning persists custom urls', async () => {
await ml.customUrls.assertCustomUrlItem(0);
});

it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']);
});

it('job cloning opens the advanced section', async () => {
await ml.jobWizardCommon.ensureAdvancedSectionOpen();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default function({ getService }: FtrProviderContext) {
this.tags(['smoke', 'mlqa']);
before(async () => {
await esArchiver.load('ml/farequote');
await ml.api.createCalendar('wizard-test-calendar');
});

after(async () => {
Comment thread
pheyos marked this conversation as resolved.
Expand Down Expand Up @@ -151,6 +152,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(jobGroups);
});

it('job creation opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job creation adds a new custom url', async () => {
await ml.jobWizardCommon.addCustomUrl();
});

it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.assignCalendar('wizard-test-calendar');
});

it('job creation opens the advanced section', async () => {
await ml.jobWizardCommon.ensureAdvancedSectionOpen();
});
Expand Down Expand Up @@ -271,6 +284,18 @@ export default function({ getService }: FtrProviderContext) {
await ml.jobWizardCommon.assertJobGroupSelection(jobGroupsClone);
});

it('job cloning opens the additional settings section', async () => {
await ml.jobWizardCommon.ensureAdditionalSettingsSectionOpen();
});

it('job cloning persists custom urls', async () => {
await ml.customUrls.assertCustomUrlItem(0);
});

it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']);
});

it('job cloning opens the advanced section', async () => {
await ml.jobWizardCommon.ensureAdvancedSectionOpen();
});
Expand Down
11 changes: 11 additions & 0 deletions x-pack/test/functional/services/machine_learning/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,16 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
}
});
},

async createCalendar(calendarId: string, body = { description: '', job_ids: [] }) {
await esSupertest
.put(`/_ml/calendars/${calendarId}`)
.send(body)
.expect(200);
},
Comment thread
pheyos marked this conversation as resolved.
Outdated

async deleteCalendar(calendarId: string) {
await esSupertest.delete(`/_ml/calendars/${calendarId}`).expect(200);
},
Comment thread
pheyos marked this conversation as resolved.
};
}
37 changes: 37 additions & 0 deletions x-pack/test/functional/services/machine_learning/custom_urls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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';

import { FtrProviderContext } from '../../ftr_provider_context';

export function MachineLearningCustomUrlsProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');

return {
async assertCustomUrlLabelValue(expectedValue: string) {
const actualCustomUrlLabel = await testSubjects.getAttribute(
'mlJobCustomUrlLabelInput',
'value'
);
expect(actualCustomUrlLabel).to.eql(expectedValue);
},

async setCustomUrlLabel(customUrlsLabel: string) {
await testSubjects.setValue('mlJobCustomUrlLabelInput', customUrlsLabel, {
clearWithKeyboard: true,
});
await this.assertCustomUrlLabelValue(customUrlsLabel);
},

async assertCustomUrlItem(index: number) {
await testSubjects.existOrFail(`mlJobEditCustomUrlInput_${index}`);
Comment thread
pheyos marked this conversation as resolved.
Outdated
},

async addCustomUrl() {
Comment thread
pheyos marked this conversation as resolved.
Outdated
await testSubjects.click('mlJobAddCustomUrl');
Comment thread
pheyos marked this conversation as resolved.
},
};
}
1 change: 1 addition & 0 deletions x-pack/test/functional/services/machine_learning/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

export { MachineLearningAnomalyExplorerProvider } from './anomaly_explorer';
export { MachineLearningAPIProvider } from './api';
export { MachineLearningCustomUrlsProvider } from './custom_urls';
export { MachineLearningDataFrameAnalyticsProvider } from './data_frame_analytics';
export { MachineLearningDataFrameAnalyticsCreationProvider } from './data_frame_analytics_creation';
export { MachineLearningDataFrameAnalyticsTableProvider } from './data_frame_analytics_table';
Expand Down
Loading