-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from BrowserSync/not_found_2
not found v2
- Loading branch information
Showing
14 changed files
with
270 additions
and
229 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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
servers: | ||
- name: "fallback" | ||
routes: | ||
- path: / | ||
dir: examples/basic/empty |
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,15 +1,29 @@ | ||
import {bstest, test} from './utils'; | ||
import { bstest, test } from "./utils"; | ||
import { expect } from "@playwright/test"; | ||
|
||
test.describe('Browsersync bslive 404 UI', { | ||
test.describe("Browsersync bslive 404 UI", { | ||
annotation: { | ||
type: bstest({ | ||
input: 'examples/basic/headers.yml' | ||
}) | ||
} | ||
input: "examples/basic/headers.yml", | ||
}), | ||
}, | ||
}, () => { | ||
test("shows the UI", async ({ page, request, bs }) => { | ||
await page.goto(bs.path("/__bslive")); | ||
await page.locator("bs-header").waitFor({ timeout: 1000 }); | ||
}); | ||
}); | ||
|
||
test('shows the UI', async ({page, request, bs}) => { | ||
await page.goto(bs.path('/__bslive')); | ||
await page.locator('bs-header').waitFor({timeout: 1000}); | ||
test.describe("Browsersync bslive 404 fallback", { | ||
annotation: { | ||
type: bstest({ | ||
input: "examples/basic/fallback.yml", | ||
}), | ||
}, | ||
}, () => { | ||
test("shows the UI as fallback on DIR", async ({ page, bs }) => { | ||
const r = await page.goto(bs.path("/")); | ||
await page.locator("bs-header").waitFor({ timeout: 1000 }); | ||
expect(r?.status()).toEqual(404); | ||
}); | ||
}) | ||
}); |
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,14 +1,13 @@ | ||
import {bstest, test} from "./utils"; | ||
import {expect} from "@playwright/test"; | ||
|
||
test.describe('examples/basic/client.yml', { | ||
test.describe("examples/basic/client.yml", { | ||
annotation: { | ||
type: bstest({ | ||
input: 'examples/basic/client.yml' | ||
input: "examples/basic/client.yml", | ||
}), | ||
description: '' | ||
} | ||
description: "", | ||
}, | ||
}, () => { | ||
test('configures log level', async ({request, bs}) => { | ||
test("configures log level", async ({request, bs}) => { | ||
}); | ||
}) | ||
}); |
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,34 +1,34 @@ | ||
import {bstest, test} from "./utils"; | ||
import {expect} from "@playwright/test"; | ||
import { bstest, test } from "./utils"; | ||
import { expect } from "@playwright/test"; | ||
|
||
test.describe('examples/basic/delays.yml', { | ||
test.describe("examples/basic/delays.yml", { | ||
annotation: { | ||
type: bstest({ | ||
input: 'examples/basic/delays.yml' | ||
input: "examples/basic/delays.yml", | ||
}), | ||
description: '' | ||
} | ||
description: "", | ||
}, | ||
}, () => { | ||
test('first delay item', async ({request, bs}) => { | ||
test("first delay item", async ({ request, bs }) => { | ||
const start = Date.now(); | ||
const response = await request.get(bs.path('/')); | ||
const response = await request.get(bs.path("/")); | ||
|
||
const body = await response.body(); | ||
const diff = Date.now() - start; | ||
|
||
expect(body.toString()).toBe(`first - 200ms delay`) | ||
expect(diff).toBeGreaterThan(200) | ||
expect(diff).toBeLessThan(300) | ||
expect(body.toString()).toBe(`first - 200ms delay`); | ||
expect(diff).toBeGreaterThan(200); | ||
expect(diff).toBeLessThan(300); | ||
}); | ||
test('500ms delay', async ({request, bs}) => { | ||
test("500ms delay", async ({ request, bs }) => { | ||
const start = Date.now(); | ||
const response = await request.get(bs.path('/500')); | ||
const response = await request.get(bs.path("/500")); | ||
|
||
const body = await response.body(); | ||
const diff = Date.now() - start; | ||
|
||
expect(body.toString()).toBe(`second - 500ms delay`) | ||
expect(diff).toBeGreaterThan(500) | ||
expect(diff).toBeLessThan(600) | ||
expect(body.toString()).toBe(`second - 500ms delay`); | ||
expect(diff).toBeGreaterThan(500); | ||
expect(diff).toBeLessThan(600); | ||
}); | ||
}) | ||
}); |
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,31 +1,31 @@ | ||
import {bstest, test} from "./utils"; | ||
import {expect} from "@playwright/test"; | ||
import { bstest, test } from "./utils"; | ||
import { expect } from "@playwright/test"; | ||
|
||
test.describe('examples/basic/inject.yml', { | ||
test.describe("examples/basic/inject.yml", { | ||
annotation: { | ||
type: bstest({ | ||
input: 'examples/basic/inject.yml' | ||
input: "examples/basic/inject.yml", | ||
}), | ||
description: '' | ||
} | ||
description: "", | ||
}, | ||
}, () => { | ||
test('inject bslive:connector', async ({request, bs}) => { | ||
const response = await request.get(bs.path('/'), { | ||
test("inject bslive:connector", async ({ request, bs }) => { | ||
const response = await request.get(bs.path("/"), { | ||
headers: { | ||
accept: 'text/html' | ||
} | ||
accept: "text/html", | ||
}, | ||
}); | ||
const body = await response.body(); | ||
expect(body.toString()).toMatchSnapshot(); | ||
|
||
{ | ||
const response = await request.get(bs.path('/form.html'), { | ||
const response = await request.get(bs.path("/form.html"), { | ||
headers: { | ||
accept: 'text/html' | ||
} | ||
accept: "text/html", | ||
}, | ||
}); | ||
const body = await response.body(); | ||
expect(body.toString()).toMatchSnapshot(); | ||
} | ||
}); | ||
}) | ||
}); |
Oops, something went wrong.