Skip to content

Commit

Permalink
[ML] Fix functional tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed May 4, 2020
1 parent bf06d9e commit 004d099
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default function({ getService }: FtrProviderContext) {
return `user-${this.transformId}`;
},
expected: {
pivotAdvancedEditorValueArr: ['{', ' "group_by": {', ' "category.keyword": {'],
pivotAdvancedEditorValue: {
group_by: {
'category.keyword': {
Expand Down Expand Up @@ -117,6 +118,7 @@ export default function({ getService }: FtrProviderContext) {
return `user-${this.transformId}`;
},
expected: {
pivotAdvancedEditorValueArr: ['{', ' "group_by": {', ' "geoip.country_iso_code": {'],
pivotAdvancedEditorValue: {
group_by: {
'geoip.country_iso_code': {
Expand Down Expand Up @@ -233,7 +235,7 @@ export default function({ getService }: FtrProviderContext) {
it('displays the advanced configuration', async () => {
await transform.wizard.enabledAdvancedPivotEditor();
await transform.wizard.assertAdvancedPivotEditorContent(
testData.expected.pivotAdvancedEditorValue
testData.expected.pivotAdvancedEditorValueArr
);
});

Expand Down
11 changes: 8 additions & 3 deletions x-pack/test/functional/services/transform_ui/wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,15 @@ export function TransformWizardProvider({ getService }: FtrProviderContext) {
await this.assertAggregationEntryExists(index, expectedLabel);
},

async assertAdvancedPivotEditorContent(expectedValue: Record<string, any>) {
async assertAdvancedPivotEditorContent(expectedValue: string[]) {
const advancedEditorString = await aceEditor.getValue('transformAdvancedPivotEditor');
const advancedEditorValue = JSON.parse(advancedEditorString);
expect(advancedEditorValue).to.eql(expectedValue);
// Not all lines may be visible in the editor and thus aceEditor may not return all lines.
// This means we might not get back valid JSON so we only test against the first few lines
// and see if the string matches.

// const advancedEditorValue = JSON.parse(advancedEditorString);
// expect(advancedEditorValue).to.eql(expectedValue);
expect(advancedEditorString.split('\n').splice(0, 3)).to.eql(expectedValue);
},

async assertAdvancedPivotEditorSwitchExists() {
Expand Down

0 comments on commit 004d099

Please sign in to comment.