Skip to content

Commit

Permalink
Add test for monaco, add screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
vanpelt committed Jun 22, 2024
1 parent 08c3159 commit 68325a8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ jobs:
if: always()
with:
name: playwright-report
path: ./frontend/playwright-report/
path: |
./frontend/playwright-report/
./frontend/screenshots/
retention-days: 30

release:
Expand Down
23 changes: 22 additions & 1 deletion frontend/integration_tests/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test('test good flow', async ({ page }) => {
.click()
await page.getByRole('button', { name: 'Change theme', exact: true }).click()
await page.getByRole('button', { name: 'Orange' }).click()
const iframe = await page.frameLocator('#version-0')
let iframe = await page.frameLocator('#version-0')
await expect(iframe.locator('h1')).toHaveText('Hello, world!')
await expect(iframe.locator('img')).toHaveAttribute(
'src',
Expand All @@ -27,4 +27,25 @@ test('test good flow', async ({ page }) => {
await annotator?.screenshot({
path: './screenshots/annotator-screenshot.png'
})
await page.getByRole('button', { name: 'Edit HTML', exact: true }).click()
let monacoEditor = page.locator('.monaco-editor').nth(0)
await monacoEditor.click({
position: {
x: 300,
y: 300
}
})
await monacoEditor.click({
position: {
x: 300,
y: 300
}
})
await page.keyboard.type(
'<div class="edited">Inserted some cool text</div>\n'
)
iframe = await page.frameLocator('#version-1')
await expect(iframe.locator('div.edited')).toHaveText(

Check failure on line 48 in frontend/integration_tests/basic.spec.ts

View workflow job for this annotation

GitHub Actions / test

[Mobile Safari] › basic.spec.ts:4:1 › test good flow

1) [Mobile Safari] › basic.spec.ts:4:1 › test good flow ────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: frameLocator('#version-1').locator('div.edited') Expected string: "Inserted some cool text" Received: <element(s) not found> Call log: - expect.toHaveText with timeout 5000ms - waiting for frameLocator('#version-1').locator('div.edited') 46 | ) 47 | iframe = await page.frameLocator('#version-1') > 48 | await expect(iframe.locator('div.edited')).toHaveText( | ^ 49 | 'Inserted some cool text' 50 | ) 51 | }) at /home/runner/work/openui/openui/frontend/integration_tests/basic.spec.ts:48:45

Check failure on line 48 in frontend/integration_tests/basic.spec.ts

View workflow job for this annotation

GitHub Actions / test

[Mobile Safari] › basic.spec.ts:4:1 › test good flow

1) [Mobile Safari] › basic.spec.ts:4:1 › test good flow ────────────────────────────────────────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: frameLocator('#version-1').locator('div.edited') Expected string: "Inserted some cool text" Received: <element(s) not found> Call log: - expect.toHaveText with timeout 5000ms - waiting for frameLocator('#version-1').locator('div.edited') 46 | ) 47 | iframe = await page.frameLocator('#version-1') > 48 | await expect(iframe.locator('div.edited')).toHaveText( | ^ 49 | 'Inserted some cool text' 50 | ) 51 | }) at /home/runner/work/openui/openui/frontend/integration_tests/basic.spec.ts:48:45

Check failure on line 48 in frontend/integration_tests/basic.spec.ts

View workflow job for this annotation

GitHub Actions / test

[Mobile Safari] › basic.spec.ts:4:1 › test good flow

1) [Mobile Safari] › basic.spec.ts:4:1 › test good flow ────────────────────────────────────────── Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: frameLocator('#version-1').locator('div.edited') Expected string: "Inserted some cool text" Received: <element(s) not found> Call log: - expect.toHaveText with timeout 5000ms - waiting for frameLocator('#version-1').locator('div.edited') 46 | ) 47 | iframe = await page.frameLocator('#version-1') > 48 | await expect(iframe.locator('div.edited')).toHaveText( | ^ 49 | 'Inserted some cool text' 50 | ) 51 | }) at /home/runner/work/openui/openui/frontend/integration_tests/basic.spec.ts:48:45
'Inserted some cool text'
)
})
1 change: 1 addition & 0 deletions frontend/src/components/HtmlAnnotator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ export default function HTMLAnnotator({ error, id }: HTMLAnnotatorProps) {
}}
>
<CodeIcon strokeWidth={4} className='h-5 w-5' />
<span className='sr-only'>Edit HTML</span>
</Button>
</TooltipTrigger>
<TooltipContent>Edit HTML</TooltipContent>
Expand Down

0 comments on commit 68325a8

Please sign in to comment.