Skip to content

Commit

Permalink
redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp committed Aug 13, 2024
1 parent b829583 commit 5529c52
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
1 change: 1 addition & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/inspection-chamber/ /tools/inspection-chamber/ 301
65 changes: 58 additions & 7 deletions tests/chamber.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,74 @@ import { test, expect, type Page } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('http://localhost:4321/inspection-chamber-demo/first-page/');

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle('🔬 Inspection Chamber Demo | @vtbag');
});

test.describe("devToolbar", () => {
async function openClose(page: Page) {
const app = page.locator('#bar-container > button[data-app-id="vtbot"]');
await expect(app).toBeVisible();
await app.click();
}
async function toolbarAction(page: Page, status: string) {
await openClose(page);
const button = page.locator('#inspection-chamber-button button');
await expect(button).toBeVisible();
await expect(page.locator("#inspection-chamber-status")).toContainText(status);
return button;
}

test('can open and close', async ({ page }) => {
await page.goto('http://localhost:4321/');
await expect(page.locator('#inspection-chamber-button')).toBeHidden();
await toolbarAction(page, "There is an Inspection Chamber here");
await expect(page.locator('#inspection-chamber-button')).toBeVisible();
await openClose(page);
await expect(page.locator('#inspection-chamber-button')).toBeHidden();
});

test('can use', async ({ page }) => {
await page.goto('http://localhost:4321/');
let button = await toolbarAction(page, "There is an Inspection Chamber here");
await button.click();
await expect(page.locator('#vtbag-ui-panel')).toBeVisible();
await expect(page.locator('#vtbag-ui-reopen')).toBeHidden();
await page.click('#vtbag-ui-standby');
await expect(page.locator('#vtbag-ui-reopen')).toBeVisible();
await expect(page.locator('#vtbag-ui-panel')).toBeHidden();
await page.click("a[class*='primary']");
await page.waitForURL('http://localhost:4321/vtbag/');
await expect(page.locator('#vtbag-ui-reopen')).toBeVisible();
await expect(page.locator('#vtbag-ui-panel')).toBeHidden();
await page.click('#vtbag-ui-reopen');
await expect(page.locator('#vtbag-ui-reopen')).toBeHidden();
await expect(page.locator('#vtbag-ui-panel')).toBeVisible();
});



test('can detect standby', async ({ page }) => {
await page.goto('http://localhost:4321/');

let button = await toolbarAction(page, "There is an Inspection Chamber here");
await button.click();
await expect(page.locator('#vtbag-ui-panel')).toBeVisible();
await page.click('#vtbag-ui-standby');
await expect(page.locator('#vtbag-ui-reopen')).toBeVisible();
button = await toolbarAction(page, "The Chamber is currently in standby mode.");
await button.click();
await expect(page.locator('#vtbag-ui-panel')).toBeVisible();
});
});

test.describe("controls", () => {
test('can close', async ({ page }) => {
await page.goto('http://localhost:4321/inspection-chamber-demo/first-page/');

await expect(page.locator('#vtbag-ui-reopen')).toBeHidden();
await page.click('#vtbag-ui-standby');
await expect(page.locator('#vtbag-ui-reopen')).toBeVisible();

});
})

test('can reopen', async ({ page }) => {
await page.goto('http://localhost:4321/inspection-chamber-demo/first-page/');
Expand All @@ -33,11 +87,8 @@ test.describe("controls", () => {

await page.click('#vtbag-ui-standby');
await expect(page.locator('#vtbag-ui-panel')).toBeHidden();

await page.click("main div p a");

await page.waitForURL('http://localhost:4321/inspection-chamber-demo/second-page/');

await page.click('#vtbag-ui-reopen');
await expect(page.locator('#vtbag-ui-reopen')).toBeHidden();
await expect(page.locator('#vtbag-ui-panel')).toBeVisible();
Expand Down

0 comments on commit 5529c52

Please sign in to comment.