gradio/js/app/test/queue_full_e2e_test.spec.ts
Hannah bed2f82e22
Implement JS Client tests (#8109)
* add msw setup and initialisation tests

* add changeset

* add walk_and_store_blobs improvements and add tests

* add changeset

* api_info tests

* add direct space URL link tests

* fix tests

* add view_api tests

* add post_message test

* tweak

* add spaces tests

* jwt and protocol tests

* add post_data tests

* test tweaks

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-30 18:50:38 +02:00

30 lines
1.1 KiB
TypeScript

import { test, expect } from "@gradio/tootils";
test("When the queue is full the queue full message gets shown. Also when there is an exception in a user function the queue does not get blocked", async ({
page
}) => {
await page.pause();
await page.getByRole("button", { name: "First Call" }).click();
await page.getByRole("button", { name: "Second Call" }).click();
await page.getByRole("button", { name: "Third Call" }).click();
await page.getByRole("button", { name: "Fourth Call" }).click();
await expect(page.getByTestId("toast-body")).toHaveCount(2, {
timeout: 10000
});
const all_toast = (await page.getByTestId("toast-body").all()).map(
async (t) => await t.innerText()
);
const all_text = await Promise.all(all_toast);
expect(all_text.join("\n")).toContain("This is a gradio error");
expect(all_text.join("\n")).toContain("This application is currently busy");
await expect
.poll(async () => page.getByLabel("First Result").inputValue())
.toBeTruthy();
await expect
.poll(async () => page.getByLabel("First Result").inputValue())
.toBeTruthy();
});