Skip to content

Commit

Permalink
chore: add test for file in nested folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemikolh committed Sep 17, 2024
1 parent a7eb0d3 commit 627c989
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Baz
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ import { ButtonWriteToFile } from '@components/ButtonWriteToFile';
# Happy path filesystem test

<ButtonWriteToFile client:load filePath="/bar.txt" newContent='Something else' useWebcontainer />
<ButtonWriteToFile client:load filePath="/a/b/baz.txt" newContent='Foo' useWebcontainer testId='write-to-file-in-subfolder' />
19 changes: 18 additions & 1 deletion e2e/test/filesystem-sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';

const BASE_URL = '/tests/filesystem-sync';

test('editor should reflect changes made in webcontainer', async ({ page }) => {
test('editor should reflect changes made from webcontainer', async ({ page }) => {
const testCase = 'happy-path';
await page.goto(`${BASE_URL}/${testCase}`);

Expand All @@ -16,3 +16,20 @@ test('editor should reflect changes made in webcontainer', async ({ page }) => {
useInnerText: true,
});
});

test('editor should reflect changes made from webcontainer in file in nested folder', async ({ page }) => {
const testCase = 'happy-path';
await page.goto(`${BASE_URL}/${testCase}`);

await page.getByRole('button', { name: 'baz.txt' }).click();

await expect(page.getByRole('textbox', { name: 'Editor' })).toHaveText('Baz', {
useInnerText: true,
});

await page.getByTestId('write-to-file-in-subfolder').click();

await expect(page.getByRole('textbox', { name: 'Editor' })).toHaveText('Foo', {
useInnerText: true,
});
});

0 comments on commit 627c989

Please sign in to comment.