|
3 | 3 |
|
4 | 4 | import { expect, galata, test } from '@jupyterlab/galata'; |
5 | 5 | import * as path from 'path'; |
| 6 | +import { globSync } from 'glob'; |
6 | 7 |
|
7 | | -const fileName = 'myst_tests.md'; |
8 | 8 | const FACTORY = 'Markdown Preview'; |
9 | 9 | // test.use({ tmpPath: 'notebook-run-test' }); |
10 | 10 |
|
11 | | -test.describe.serial('File Run', () => { |
12 | | - test.beforeEach(async ({ request, page, tmpPath }) => { |
13 | | - const contents = galata.newContentsHelper(request, page); |
14 | | - await contents.uploadFile( |
15 | | - path.resolve(__dirname, `./files/${fileName}`), |
16 | | - `${tmpPath}/${fileName}` |
17 | | - ); |
18 | | - }); |
| 11 | +const files = globSync('files/*.md', { cwd: __dirname }); |
| 12 | + |
| 13 | +for (const file of files) { |
| 14 | + const fileName = path.basename(file); |
| 15 | + test.describe.serial(`File Run: ${file}`, () => { |
| 16 | + test.beforeEach(async ({ request, page, tmpPath }) => { |
| 17 | + const contents = galata.newContentsHelper(request, page); |
| 18 | + await contents.uploadFile( |
| 19 | + path.resolve(__dirname, file), |
| 20 | + `${tmpPath}/${fileName}` |
| 21 | + ); |
| 22 | + }); |
19 | 23 |
|
20 | | - test('View Markdown file and render result', async ({ page, tmpPath }) => { |
21 | | - const filePath = `${tmpPath}/${fileName}`; |
22 | | - await page.filebrowser.open(filePath, FACTORY); |
| 24 | + test('View Markdown file and render result', async ({ page, tmpPath }) => { |
| 25 | + const filePath = `${tmpPath}/${fileName}`; |
| 26 | + await page.filebrowser.open(filePath, FACTORY); |
23 | 27 |
|
24 | | - const name = path.basename(filePath); |
25 | | - await page.activity.getTab(name); |
| 28 | + const name = path.basename(filePath); |
| 29 | + await page.activity.getTab(name); |
26 | 30 |
|
27 | | - const panel = await page.activity.getPanel(name); |
| 31 | + const panel = await page.activity.getPanel(name); |
28 | 32 |
|
29 | | - expect(await panel!.screenshot()).toMatchSnapshot(); |
| 33 | + expect(await panel!.screenshot()).toMatchSnapshot(); |
| 34 | + }); |
30 | 35 | }); |
31 | | -}); |
| 36 | +} |
0 commit comments