Skip to content

Commit

Permalink
fix(console): add sanity test (#5926)
Browse files Browse the repository at this point in the history
Resolves #5925

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
polamoros authored Mar 13, 2024
1 parent 75e2d95 commit be0cfa9
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/wing-console/console/app/test/cloud.api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const runApiTest = async (
route: string,
response: string,
) => {
await getResourceNode(page, "root/Default/cloud.Api").click();
await getResourceNode(page, "root/Default/Api").click();

await page.getByTestId("cloud.api:method-toggle").click();
await page.getByTestId(`cloud.api:method-entry-${method}`).click();
Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/test/cloud.bucket/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("opens file preview", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Bucket").click();
await getResourceNode(page, "root/Default/Bucket").click();

await page.getByTestId("cloud.bucket:files-entry-test.txt").click();

Expand All @@ -15,7 +15,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("deletes a file", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Bucket").click();
await getResourceNode(page, "root/Default/Bucket").click();

const file = page.getByTestId("cloud.bucket:files-entry-test.txt");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("increase counter", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Counter").click();
await getResourceNode(page, "root/Default/Counter").click();

const currentValue = page.getByTestId("cloud.counter:current-value");

Expand All @@ -17,7 +17,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("decreases counter", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Counter").click();
await getResourceNode(page, "root/Default/Counter").click();

const currentValue = page.getByTestId("cloud.counter:current-value");

Expand All @@ -29,7 +29,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("resets counter", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Counter").click();
await getResourceNode(page, "root/Default/Counter").click();

const currentValue = page.getByTestId("cloud.counter:current-value");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("executes function and shows response", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Function").click();
await getResourceNode(page, "root/Default/Function").click();

await page.getByTestId("cloud.function:invoke").click();

Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/test/cloud.queue/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("pushes message", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Queue").click();
await getResourceNode(page, "root/Default/Queue").click();

await page.getByTestId("cloud.queue:message").fill("Hello world!");

Expand All @@ -17,7 +17,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("purges message", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Queue").click();
await getResourceNode(page, "root/Default/Queue").click();

await page.getByTestId("cloud.queue:message").fill("Hello world!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("publishes message", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Topic").click();
await getResourceNode(page, "root/Default/Topic").click();

await page.getByTestId("cloud.topic:message").fill("Hello world!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js";

describe(`${__dirname}/main.w`, () => {
test.skip("open website", async ({ page }) => {
await getResourceNode(page, "root/Default/cloud.Website").click();
await getResourceNode(page, "root/Default/Website").click();

// not working when app mode is not "local"
// const url = await page.getByTestId("cloud.website:url").inputValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const addRow = async (page: Page, data?: Record<string, any>) => {

describe(`${__dirname}/main.w`, () => {
test.skip("adds new item", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.DynamodbTable").click();
await getResourceNode(page, "root/Default/DynamodbTable").click();

await addRow(page, { id: "1", key1: "value1", key2: "value2" });
});

test.skip("removes row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.DynamodbTable").click();
await getResourceNode(page, "root/Default/DynamodbTable").click();

await addRow(page, { id: "1", key1: "value1", key2: "value2" });

Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/test/ex.redis/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("opens redis help", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Redis").click();
await getResourceNode(page, "root/Default/Redis").click();

const input = page.getByTestId("ex.redis:input");

Expand All @@ -40,7 +40,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("navigates history", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Redis").click();
await getResourceNode(page, "root/Default/Redis").click();

const input = page.getByTestId("ex.redis:input");

Expand Down
6 changes: 3 additions & 3 deletions apps/wing-console/console/app/test/ex.table/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ const addRow = async (

describe(`${__dirname}/main.w`, () => {
test.skip("adds new row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Table").click();
await getResourceNode(page, "root/Default/Table").click();

await addRow(page, "Hello World!");
});

test.skip("edits row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Table").click();
await getResourceNode(page, "root/Default/Table").click();

const rowId = "Hello World!";

Expand All @@ -55,7 +55,7 @@ describe(`${__dirname}/main.w`, () => {
});

test.skip("removes row", async ({ page }) => {
await getResourceNode(page, "root/Default/ex.Table").click();
await getResourceNode(page, "root/Default/Table").click();

const rowId = "Hello World!";

Expand Down
10 changes: 10 additions & 0 deletions apps/wing-console/console/app/test/health/health.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { expect, test } from "@playwright/test";

import { describe } from "../describe.js";

describe(`${__dirname}/main.w`, () => {
test("Health check", async ({ page }) => {
const appState = page.getByTestId("app-state");
await expect(appState).toContainText("success");
});
});
2 changes: 2 additions & 0 deletions apps/wing-console/console/app/test/health/main.w
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bring cloud;

1 change: 1 addition & 0 deletions apps/wing-console/console/ui/src/layout/status-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const StatusBar = ({
<span>Status:</span>
<span className={classNames(theme.text2)}>
<span
data-testid="app-state"
className={classNames([
isError ? "text-red-500" : theme.text2,
"flex",
Expand Down

0 comments on commit be0cfa9

Please sign in to comment.