Skip to content

Commit

Permalink
added playwright test
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane committed Dec 25, 2024
1 parent f82a924 commit 0f35eac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/basic/delays.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ servers:
html: first - 200ms delay
delay:
ms: 200
- path: /none
html: no config-based delay
- path: /500
html: second - 500ms delay
delay:
Expand Down
13 changes: 13 additions & 0 deletions tests/delays.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ test.describe(
expect(diff).toBeGreaterThan(200);
expect(diff).toBeLessThan(300);
});
test("no config-based delay (url param)", async ({ request, bs }) => {
const start = Date.now();
const response = await request.get(
bs.path("/none?bslive.delay.ms=200"),
);

const body = await response.body();
const diff = Date.now() - start;

expect(body.toString()).toBe(`no config-based delay`);
expect(diff).toBeGreaterThan(200);
expect(diff).toBeLessThan(300);
});
test("500ms delay", async ({ request, bs }) => {
const start = Date.now();
const response = await request.get(bs.path("/500"));
Expand Down

0 comments on commit 0f35eac

Please sign in to comment.