Make console log outputs multiline. (#119675) (#119991)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Justin Kambic <justin.kambic@elastic.co>
This commit is contained in:
Kibana Machine 2021-11-30 13:17:42 -05:00 committed by GitHub
parent 8324c851e9
commit f32d32676d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View file

@ -82,4 +82,19 @@ describe('ExecutedStep', () => {
expect(getByText('Console output'));
expect(getByText(browserConsole[0]));
});
it('renders multi-line console output', () => {
const browserConsole = ['line1', 'line2', 'line3'];
const { getByText } = render(
<ExecutedStep browserConsoles={browserConsole} index={3} step={step} loading={false} />
);
expect(getByText('Console output'));
const codeBlock = getByText('line1 line2', { exact: false });
expect(codeBlock.innerHTML).toEqual(`line1
line2
line3`);
});
});

View file

@ -88,14 +88,7 @@ export const ExecutedStep: FC<ExecutedStepProps> = ({ loading, step, index, brow
language="javascript"
initialIsOpen={!isSucceeded}
>
<>
{browserConsoles?.map((browserConsole) => (
<>
{browserConsole}
<EuiSpacer />
</>
))}
</>
{browserConsoles?.join('\n')}
</CodeBlockAccordion>
<EuiSpacer />
<StepScreenshots step={step} />