mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #33868 from overleaf/dk-package-loading-tests
[web] Add tests for pyodide worker streams and output pane rendering GitOrigin-RevId: 41ffc25230be23d68d50c61980cfaf1260a0247d
This commit is contained in:
@@ -302,6 +302,62 @@ describe('<PythonOutputPane />', function () {
|
||||
)
|
||||
})
|
||||
|
||||
it('renders stdout, stderr, and info lines with visually distinct CSS classes', function () {
|
||||
const executablePythonFileContents = [
|
||||
'import sys',
|
||||
"print('hello!')",
|
||||
"sys.stderr.write('boom\\n')",
|
||||
'while True:',
|
||||
' pass',
|
||||
].join('\n')
|
||||
const projectFiles = {
|
||||
[pythonExecutableScript.filename]: executablePythonFileContents,
|
||||
}
|
||||
const ProjectProvider = makeProjectProvider(projectFiles)
|
||||
|
||||
cy.mount(
|
||||
<EditorProviders
|
||||
scope={{
|
||||
editor: {
|
||||
sharejs_doc: {
|
||||
doc_id: pythonExecutableScript.file_id,
|
||||
getSnapshot: () => executablePythonFileContents,
|
||||
},
|
||||
currentDocumentId: pythonExecutableScript.file_id,
|
||||
openDocName: pythonExecutableScript.filename,
|
||||
},
|
||||
}}
|
||||
providers={{ FileTreePathProvider, ProjectProvider }}
|
||||
>
|
||||
<PythonExecutionProvider>
|
||||
<PythonOutputPane />
|
||||
</PythonExecutionProvider>
|
||||
</EditorProviders>
|
||||
)
|
||||
|
||||
cy.findByRole('button', { name: 'Run Python code' })
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
|
||||
cy.findByText('hello!')
|
||||
.should('have.class', 'ide-redesign-python-output-pane-line-stdout')
|
||||
.and('not.have.class', 'ide-redesign-python-output-pane-line-stderr')
|
||||
.and('not.have.class', 'ide-redesign-python-output-pane-line-info')
|
||||
cy.findByText('boom')
|
||||
.should('have.class', 'ide-redesign-python-output-pane-line-stderr')
|
||||
.and('not.have.class', 'ide-redesign-python-output-pane-line-stdout')
|
||||
.and('not.have.class', 'ide-redesign-python-output-pane-line-info')
|
||||
|
||||
cy.findByRole('button', { name: 'Stop Python execution' })
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
|
||||
cy.findByText('Execution interrupted')
|
||||
.should('have.class', 'ide-redesign-python-output-pane-line-info')
|
||||
.and('not.have.class', 'ide-redesign-python-output-pane-line-stdout')
|
||||
.and('not.have.class', 'ide-redesign-python-output-pane-line-stderr')
|
||||
})
|
||||
|
||||
it('can load common python data analysis packages on code execution', function () {
|
||||
const executablePythonFileContents = [
|
||||
'import tomli',
|
||||
|
||||
Reference in New Issue
Block a user