open-index/open-npm huggingface dataset:
npm package: @playwright-labs/fixture-ajv-ts
Description: Utility to test your schema for ajv-ts package
Author: Vitali Haradkou
Latest version: 1.0.3

# Ajv-ts fixture

## Get started

1. Install the package(s)

```sh
pnpm i @playwright/test
pnpm i ajv-ts
pnpm i @playwright-labs/fixture-ajv-ts
```

2. Add (or create) in your fixture

```ts
// file: fixture.ts
import { mergeExpects, mergeTests } from "@playwright/test";
import {
  expect as ajvTsExpect,
  test as ajvTsTests,
} from "@playwright-labs/fixture-ajv-ts";

export const expect = mergeExpects(ajvTsExpect);
export const test = mergeTests(ajvTsTests);
```

3. Use it!

```ts
import { test, expect } from "./fixture";

test("use some schema", async ({ schema }) => {
  const mySchema = schema.string();
  expect("qwe").toMatchSchema(mySchema); // OK
});
```

4. Or define schema separately and use it for test:

```ts
// api-response.ts
import { s } from "ajv-ts";

export const someResponse = s.object({
  data: s.string().or(s.number()),
});
```

```ts
import { someResponse } from "./api-response";
import { test, expect } from "./fixture";

test("use some schema", async () => {
  const resp = await fetch("https://example.com/data.json");
  expect(await resp.json()).toMatchSchema(someResponse);
});
```
npm package: @playwright-labs/fixture-faker
Description: Faker fixture integration for Playwright
Author: Vitali Haradkou
Latest version: 1.0.3

# Faker fixture

This is a base @faker-js/faker all-in-one fixture and helpers for playwright from Playwright labs team!

## Installation

1. Install playwright (optional)

```sh
npm i  @playwright/test
pnpm add @playwright/test
yarn add @playwright/test
```

2. Install [`@playwright-labs/fixture-faker`](https://www.npmjs.com/package/@playwright-labs/fixture-faker)

```sh
npm i @playwright-labs/fixture-faker
pnpm add @playwright-labs/fixture-faker
yarn add @playwright-labs/fixture-faker
```

## Usage

### Basic Test Setup

```typescript
import { test, expect } from "@playwright-labs/fixture-faker";

test("my test", async ({ page, faker }) => {
  await page.goto("https://example.com");

  await page.fill("#username", faker.internet.email());
  await page.fill("#password", faker.internet.password());
  await page.click("#submit");
});
```

### Advanced Usage (fixture)

```ts
// filename: custom-fixture.ts
import { mergeExpects, mergeTests } from "@playwright/test";
import {
  expect as allureExpect,
  test as allureTests,
} from "@playwright-labs/fixture-allure";

export const expect = mergeExpects(allureExpect);
export const test = mergeTests(allureTests);
```

And now you are ready to use the custom fixture in your tests.

```ts
import { expect, test } from "./custom-fixture";

test("Login", async ({ page, faker }) => {
  await page.goto("https://example.com");

  await page.fill("#username", faker.internet.email());
  await page.fill("#password", faker.internet.password());
  await page.click("#submit");
});
```

### Using different locale

We exports `useFaker` function to configure faker with different options(e.g. `locale`)

```ts
import { test } from "@playwright-labs/fixture-faker";

test("simple test", async ({ page, useFaker }) => {
  const faker = await useFaker({ locale: "fr" });

  await page.fill("#username", faker.internet.email());
  await page.fill("#password", faker.internet.password());
  await page.click("#submit");
});
```