-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6bcd39
commit c3f68a9
Showing
6 changed files
with
62 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,65 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { test, expect, Request } from '@playwright/test'; | ||
|
||
test('has title', async ({ page }) => { | ||
test('renders', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle(/JCR Hopper/); | ||
await expect(page).toHaveTitle(/JCR Hopper Script Builder/); | ||
await expect(page).toHaveScreenshot({ fullPage: true }); | ||
}); | ||
|
||
test('add step', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
await page.getByRole('button', { name: 'Add', exact: true }).click(); | ||
|
||
await expect(page).toHaveScreenshot(); | ||
await page.getByRole('option', { name: 'Query JCR' }).click(); | ||
await page.getByLabel('Log Level: INFO').click(); | ||
await page.getByRole('option', { name: 'TRACE' }).click(); | ||
await expect(page).toHaveScreenshot(); | ||
|
||
const step = page.locator('.hop-config.nodeQuery'); | ||
|
||
await expect(step.locator('summary')).toMatchAriaSnapshot(` | ||
- heading "Query JCR Using SQL2 for SELECT * FROM [cq:Page] AS page" [level=2] | ||
- button "arrow up" [disabled]: | ||
- img "arrow up" | ||
- button "arrow down" [disabled]: | ||
- img "arrow down" | ||
- button "duplicate": | ||
- img "duplicate" | ||
- button "delete": | ||
- img "delete" | ||
`); | ||
await step.getByRole('heading', { name: 'Query JCR Using SQL2 for' }).click(); | ||
await step.getByLabel('Selector Name:').click(); | ||
await step.getByLabel('Selector Name:').fill('page'); | ||
await step.getByLabel('Selector Name:').press('Tab'); | ||
|
||
await expect(step).toHaveScreenshot(); | ||
|
||
let runScriptRequest: Promise<Request> | Request = page.waitForRequest('/mock/mock-response.jsonl'); | ||
await page.getByRole('button', { name: 'Run' }).click(); | ||
runScriptRequest = await runScriptRequest; | ||
|
||
expect(runScriptRequest.method()).toBe('POST'); | ||
expect(runScriptRequest.postData()).toContain( | ||
'{"logLevel":"trace","hops":[{"type":"nodeQuery","query":"SELECT * FROM [cq:Page] AS page","queryType":"JCR-SQL2","hops":[],"selectorName":"page"}],"parameters":[]}', | ||
); | ||
|
||
const output = page.locator('.output'); | ||
|
||
await expect(output).toMatchAriaSnapshot(` | ||
- group: | ||
- text: ▼ | ||
- heading /✅ \\d+\\/\\d+\\/\\d+, \\d+:\\d+:\\d+/ [level=3] | ||
- text: "/trace Starting JCR Hopper with 6 parameters, for 4 of which arguments were passed: \\\\[\\\\] debug JCR Hopper script started at \\\\d+ Some plain text output/" | ||
- img "file csv" | ||
- text: /Test\\.csv text\\/csv;charset=utf-8 \\d+ bytes/ | ||
- link "Download": | ||
- button "Download" | ||
- text: /info JCR Hopper script finished after \\d+[hmsp]+ warn Not saving changes as dry run is enabled error Script execution aborted with exception/ | ||
- button "!!" | ||
`); | ||
|
||
}); |
Binary file added
BIN
+28.4 KB
src/test/playwright/basic.spec.ts-snapshots/add-step-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26.4 KB
src/test/playwright/basic.spec.ts-snapshots/add-step-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26 KB
src/test/playwright/basic.spec.ts-snapshots/add-step-3-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.9 KB
src/test/playwright/basic.spec.ts-snapshots/renders-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.