Skip to content

Commit

Permalink
Make console log outputs multiline. (#119675) (#119991)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Justin Kambic <[email protected]>
  • Loading branch information
kibanamachine and justinkambic authored Nov 30, 2021
1 parent 8324c85 commit f32d326
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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} />
Expand Down

0 comments on commit f32d326

Please sign in to comment.