diff --git a/x-pack/test/functional/apps/transform/creation_index_pattern.ts b/x-pack/test/functional/apps/transform/creation_index_pattern.ts index 0e61635fb70e4..150b2a9a15147 100644 --- a/x-pack/test/functional/apps/transform/creation_index_pattern.ts +++ b/x-pack/test/functional/apps/transform/creation_index_pattern.ts @@ -58,6 +58,7 @@ export default function({ getService }: FtrProviderContext) { return `user-${this.transformId}`; }, expected: { + pivotAdvancedEditorValueArr: ['{', ' "group_by": {', ' "category.keyword": {'], pivotAdvancedEditorValue: { group_by: { 'category.keyword': { @@ -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': { @@ -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 ); }); diff --git a/x-pack/test/functional/services/transform_ui/wizard.ts b/x-pack/test/functional/services/transform_ui/wizard.ts index e63af493438d6..4b136746eb525 100644 --- a/x-pack/test/functional/services/transform_ui/wizard.ts +++ b/x-pack/test/functional/services/transform_ui/wizard.ts @@ -274,10 +274,15 @@ export function TransformWizardProvider({ getService }: FtrProviderContext) { await this.assertAggregationEntryExists(index, expectedLabel); }, - async assertAdvancedPivotEditorContent(expectedValue: Record) { + 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() {