Skip to content

Commit

Permalink
update tests with simple 200 check and add instructions to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ethangardner committed Jun 25, 2024
1 parent d6a0fd1 commit 7b245e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ You can add the `--no-cache` flag to build from scratch.
To run the container (best for development):

```bash
docker run -p 9090:9090 -it --name e2e --rm playwright
docker run -p 4321:4321 -it --name e2e --rm playwright
```

```bash
Expand All @@ -107,5 +107,5 @@ docker exec -it e2e pnpm playwright test
To debug and follow the flow of a test in a browser, you can run:

```bash
pnpm playwright test --ui-port=8080 --ui-host=0.0.0.0
export E2E_ENDPOINT=http://localhost:4321; pnpm playwright test --ui-port=8080 --ui-host=0.0.0.0
```
8 changes: 7 additions & 1 deletion e2e/create.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, Page } from '@playwright/test';
import { test, expect, Page, Response } from '@playwright/test';
import { GuidedFormCreation, Create } from '../packages/design/src/FormManager/routes';
import { BASE_URL } from './constants';

Expand All @@ -10,6 +10,7 @@ const createNewForm = async (page: Page) => {
}

const getLocalStorageData = async (page: Page, token: string) => {
console.log(localStorage);
const localStorageValue = await page.evaluate((token) => localStorage.getItem(token), token);
return JSON.parse((localStorageValue as string));
};
Expand All @@ -19,6 +20,11 @@ const getPatternData = (storageData: any, pageNumber: number, patternIndex: numb
return storageData.patterns[patternPage].data.patterns[patternIndex];
}

test('Open site', async ({ page }) => {
const response = await page.goto(`${BASE_URL}`);
await expect(response.ok()).toBe(true);
});

test('Create form from scratch', async ({ page }) => {
const createPage = new RegExp(`${uuidPattern}/${Create.slug}$`, 'i');
await createNewForm(page);
Expand Down

0 comments on commit 7b245e2

Please sign in to comment.