Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 22 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,17 @@ You can also check out these [examples](https://github.com/guidepup/guidepup-pla
In your `playwright.config.ts` add the following for the best results with Guidepup for Screen Reader automation:

```ts
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "@guidepup/playwright";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
import { withGuidepup } from "@guidepup/playwright";

export default withGuidepup({
// ... your custom config
};

export default config;
});
```

Check out the configuration this adds [in the `config.ts` file](./src/config.ts).
`withGuidepup` configures Playwright to run tests serially and forces headed
browsers, including when browser options are specified in individual projects.
The existing `screenReaderConfig` export remains available if you prefer to
spread the configuration manually.

### Web content navigation

Expand Down Expand Up @@ -145,23 +143,20 @@ The default for NVDA, Orca, and VoiceOver is set to `"initial"`. `true` captures
`playwright.config.ts`:

```ts
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "@guidepup/playwright";
import { devices } from "@playwright/test";
import { withGuidepup } from "@guidepup/playwright";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 2,
projects: [
{
name: "chrome",
// Take care to ensure all usage is headed - screen readers cannot
// operate against headless browsers.
use: { ...devices["Desktop Chrome"], headless: false },
use: { ...devices["Desktop Chrome"] },
},
],
};
});

export default config;
```
Expand Down Expand Up @@ -207,23 +202,20 @@ test.describe("Playwright NVDA", () => {
`playwright.config.ts`:

```ts
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "@guidepup/playwright";
import { devices } from "@playwright/test";
import { withGuidepup } from "@guidepup/playwright";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 2,
projects: [
{
name: "firefox",
// Take care to ensure all usage is headed - screen readers cannot
// operate against headless browsers.
use: { ...devices["Desktop Firefox"], headless: false },
use: { ...devices["Desktop Firefox"] },
},
],
};
});

export default config;
```
Expand Down Expand Up @@ -269,23 +261,20 @@ test.describe("Playwright Orca", () => {
`playwright.config.ts`:

```ts
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "@guidepup/playwright";
import { devices } from "@playwright/test";
import { withGuidepup } from "@guidepup/playwright";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 2,
projects: [
{
name: "webkit",
// Take care to ensure all usage is headed - screen readers cannot
// operate against headless browsers.
use: { ...devices["Desktop Safari"], headless: false },
use: { ...devices["Desktop Safari"] },
},
],
};
});

export default config;
```
Expand Down
11 changes: 5 additions & 6 deletions examples/playwright-nvda/chromium.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"], headless: false },
use: { ...devices["Desktop Chrome"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
11 changes: 5 additions & 6 deletions examples/playwright-nvda/firefox.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "firefox",
use: { ...devices["Desktop Firefox"], headless: false },
use: { ...devices["Desktop Firefox"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
11 changes: 5 additions & 6 deletions examples/playwright-orca/firefox.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "firefox",
use: { ...devices["Desktop Firefox"], headless: false },
use: { ...devices["Desktop Firefox"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
11 changes: 5 additions & 6 deletions examples/playwright-screenreader/chromium.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"], headless: false },
use: { ...devices["Desktop Chrome"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
11 changes: 5 additions & 6 deletions examples/playwright-screenreader/firefox.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "firefox",
use: { ...devices["Desktop Firefox"], headless: false },
use: { ...devices["Desktop Firefox"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
11 changes: 5 additions & 6 deletions examples/playwright-voiceover/chromium.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"], headless: false },
use: { ...devices["Desktop Chrome"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
11 changes: 5 additions & 6 deletions examples/playwright-voiceover/firefox.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "firefox",
use: { ...devices["Desktop Firefox"], headless: false },
use: { ...devices["Desktop Firefox"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
11 changes: 5 additions & 6 deletions examples/playwright-voiceover/webkit.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { devices, PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "../../src";
import { devices } from "@playwright/test";
import { withGuidepup } from "../../src";

const config: PlaywrightTestConfig = {
...screenReaderConfig,
const config = withGuidepup({
reportSlowTests: null,
timeout: 5 * 60 * 1000,
retries: 5,
projects: [
{
name: "webkit",
use: { ...devices["Desktop Safari"], headless: false },
use: { ...devices["Desktop Safari"] },
},
],
reporter: process.env.CI ? [["github"], ["html", { open: "never" }]] : "list",
};
});

export default config;
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export { screenReaderTest } from "./screenReaderTest";
export type { ScreenReaderPlaywright } from "./screenReaderTest";
export { voiceOverTest } from "./voiceOverTest";
export type { VoiceOverPlaywright } from "./voiceOverTest";
export { withGuidepup } from "./withGuidepup";
21 changes: 21 additions & 0 deletions src/withGuidepup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { PlaywrightTestConfig } from "@playwright/test";
import { screenReaderConfig } from "./screenReaderConfig";

export const withGuidepup = (
config: PlaywrightTestConfig,
): PlaywrightTestConfig => ({
...config,
workers: screenReaderConfig.workers,
fullyParallel: screenReaderConfig.fullyParallel,
use: {
...config.use,
...screenReaderConfig.use,
},
projects: config.projects?.map((project) => ({
...project,
use: {
...project.use,
...screenReaderConfig.use,
},
})),
});
Loading