Skip to content

Commit

Permalink
test: tests for loading specs
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Jun 20, 2023
1 parent cd8d468 commit 7eae77c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { PlaywrightTestConfig } from "@playwright/test";

const config: PlaywrightTestConfig = {
webServer: {
command: "npm run build && npm run preview",
command: "pnpm build && pnpm preview",
port: 4173,
},
testDir: "tests",
Expand Down
21 changes: 21 additions & 0 deletions tests/load.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { expect, test } from "@playwright/test";

test("can load yaml spec", async ({ page }) => {
await page.goto(
"/x?url=https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
);
await expect(page.title()).resolves.toMatch("OpenAPI Petstore");
await expect(page.locator("meta[name=description]").first()).toHaveAttribute(
"content",
"This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.",
);
});

test("can load json spec", async ({ page }) => {
await page.goto("/x?url=https://generator3.swagger.io/openapi.json");
await expect(page.title()).resolves.toMatch("Swagger Generator");
await expect(page.locator("meta[name=description]").first()).toHaveAttribute(
"content",
"This is an online swagger codegen server. You can find out more at https://github.com/swagger-api/swagger-codegen or on [irc.freenode.net, #swagger](http://swagger.io/irc/).",
);
});
6 changes: 0 additions & 6 deletions tests/test.ts

This file was deleted.

0 comments on commit 7eae77c

Please sign in to comment.