feat(testing): set playwright to public and restrict exports (#18275)

This commit is contained in:
Jack Hsu 2023-07-31 10:49:05 -04:00 committed by GitHub
parent 9c7ded0b1a
commit 8adee8ec9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 423 additions and 2 deletions

View File

@ -6814,6 +6814,57 @@
"isExternal": false,
"disableCollapsible": false
},
{
"id": "playwright",
"path": "/packages/playwright",
"name": "playwright",
"children": [
{
"id": "executors",
"path": "/packages/playwright/executors",
"name": "executors",
"children": [
{
"id": "playwright",
"path": "/packages/playwright/executors/playwright",
"name": "playwright",
"children": [],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "generators",
"path": "/packages/playwright/generators",
"name": "generators",
"children": [
{
"id": "configuration",
"path": "/packages/playwright/generators/configuration",
"name": "configuration",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "init",
"path": "/packages/playwright/generators/init",
"name": "init",
"children": [],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "plugin",
"path": "/packages/plugin",

View File

@ -1833,6 +1833,47 @@
"generators": {},
"path": "/packages/nx"
},
"playwright": {
"githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "playwright",
"packageName": "@nx/playwright",
"description": "The Nx Plugin for Playwright contains executors and generators allowing your workspace to use the powerful Playwright integration testing capabilities.",
"documents": {},
"root": "/packages/playwright",
"source": "/packages/playwright/src",
"executors": {
"/packages/playwright/executors/playwright": {
"description": "Run Playwright tests.",
"file": "generated/packages/playwright/executors/playwright.json",
"hidden": false,
"name": "playwright",
"originalFilePath": "/packages/playwright/src/executors/playwright/schema.json",
"path": "/packages/playwright/executors/playwright",
"type": "executor"
}
},
"generators": {
"/packages/playwright/generators/configuration": {
"description": "Add Nx Playwright configuration to your project",
"file": "generated/packages/playwright/generators/configuration.json",
"hidden": false,
"name": "configuration",
"originalFilePath": "/packages/playwright/src/generators/configuration/schema.json",
"path": "/packages/playwright/generators/configuration",
"type": "generator"
},
"/packages/playwright/generators/init": {
"description": "Initializes a Playwright project in the current workspace",
"file": "generated/packages/playwright/generators/init.json",
"hidden": false,
"name": "init",
"originalFilePath": "/packages/playwright/src/generators/init/schema.json",
"path": "/packages/playwright/generators/init",
"type": "generator"
}
},
"path": "/packages/playwright"
},
"plugin": {
"githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "plugin",

View File

@ -1816,6 +1816,46 @@
"root": "/packages/nx",
"source": "/packages/nx/src"
},
{
"description": "The Nx Plugin for Playwright contains executors and generators allowing your workspace to use the powerful Playwright integration testing capabilities.",
"documents": [],
"executors": [
{
"description": "Run Playwright tests.",
"file": "generated/packages/playwright/executors/playwright.json",
"hidden": false,
"name": "playwright",
"originalFilePath": "/packages/playwright/src/executors/playwright/schema.json",
"path": "playwright/executors/playwright",
"type": "executor"
}
],
"generators": [
{
"description": "Add Nx Playwright configuration to your project",
"file": "generated/packages/playwright/generators/configuration.json",
"hidden": false,
"name": "configuration",
"originalFilePath": "/packages/playwright/src/generators/configuration/schema.json",
"path": "playwright/generators/configuration",
"type": "generator"
},
{
"description": "Initializes a Playwright project in the current workspace",
"file": "generated/packages/playwright/generators/init.json",
"hidden": false,
"name": "init",
"originalFilePath": "/packages/playwright/src/generators/init/schema.json",
"path": "playwright/generators/init",
"type": "generator"
}
],
"githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "playwright",
"packageName": "@nx/playwright",
"root": "/packages/playwright",
"source": "/packages/playwright/src"
},
{
"description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
"documents": [

View File

@ -0,0 +1,163 @@
{
"name": "playwright",
"implementation": "/packages/playwright/src/executors/playwright/playwright.ts",
"schema": {
"$schema": "http://json-schema.org/schema",
"version": 2,
"title": "Playwright executor",
"description": "Run Playwright tests.",
"type": "object",
"properties": {
"browser": {
"type": "string",
"description": "Browser to use for tests, one of 'all', 'chromium', 'firefox' or 'webkit'. If a playwright config is provided/discovered then the browserName value is expected from the configured 'projects'",
"x-priority": "important"
},
"config": {
"type": "string",
"description": "Configuration file, or a test directory with optional",
"x-completion-type": "file",
"x-completion-glob": "playwright?(*)@(.js|.cjs|.mjs|.ts|.cts|.mtx)",
"x-priority": "important"
},
"debug": {
"type": "boolean",
"description": "Run tests with Playwright Inspector. Shortcut for 'PWDEBUG=1' environment variable and '--timeout=0',--max-failures=1 --headed --workers=1' options"
},
"forbidOnly": {
"type": "boolean",
"description": "Fail if test.only is called"
},
"fullyParallel": {
"type": "boolean",
"description": "Run all tests in parallel"
},
"grep": {
"alias": "g",
"type": "string",
"description": "Only run tests matching this regular expression"
},
"globalTimeout": {
"type": "number",
"description": "Maximum time this test suite can run in milliseconds"
},
"grepInvert": {
"alias": "gv",
"type": "string",
"description": "Only run tests that do not match this regular expression"
},
"headed": {
"type": "boolean",
"description": "Run tests in headed browsers",
"x-priority": "important"
},
"ignoreSnapshots": {
"type": "boolean",
"description": "Ignore screenshot and snapshot expectations"
},
"workers": {
"alias": "j",
"type": "string",
"description": "Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker"
},
"list": {
"type": "boolean",
"description": "Collect all the tests and report them, but do not run"
},
"maxFailures": {
"alias": "x",
"oneOf": [{ "type": "number" }, { "type": "boolean" }],
"description": "Stop after the first N failures"
},
"noDeps": {
"type": "boolean",
"description": "Do not run project dependencies"
},
"output": {
"type": "string",
"description": "Folder for output artifacts"
},
"passWithNoTests": {
"type": "boolean",
"description": "Makes test run succeed even if no tests were found",
"default": true
},
"project": {
"description": "Only run tests from the specified list of projects",
"type": "array",
"items": { "type": "string" }
},
"quiet": {
"alias": "q",
"type": "boolean",
"description": "Suppress stdio"
},
"repeatEach": {
"type": "number",
"description": "Run each test N times"
},
"reporter": {
"type": "string",
"enum": [
"list",
"line",
"dot",
"json",
"junit",
"null",
"github",
"html",
"blob"
],
"description": "Reporter to use, comma-separated, can be 'list', 'line', 'dot', 'json', 'junit', 'null', 'github', 'html', 'blob'. To configure reporter options, use the playwright configuration."
},
"retries": {
"type": "number",
"description": "Maximum retry count for flaky tests, zero for no retries"
},
"shard": {
"type": "string",
"description": "Shard tests and execute only the selected shard, specify in the form 'current/all', 1-based, for example '3/5'"
},
"timeout": {
"type": "number",
"description": "Specify test timeout threshold in milliseconds, zero for unlimited"
},
"trace": {
"type": "string",
"enum": [
"on",
"off",
"on-first-retry",
"on-all-retries",
"retain-on-failure"
],
"description": "Force tracing mode, can be 'on', 'off', 'on-first-retry', 'on-all-retries', 'retain-on-failure'"
},
"updateSnapshots": {
"alias": "u",
"type": "boolean",
"description": "Update snapshots with actual results. Snapshots will be created if missing."
},
"ui": {
"type": "boolean",
"description": "Run tests in interactive UI mode"
},
"uiHost": {
"type": "string",
"description": "Host to serve UI on; specifying this option opens UI in a browser tab"
},
"uiPort": {
"type": "string",
"description": "Port to serve UI on, 0 for any free port; specifying this option opens UI in a browser tab"
}
},
"required": [],
"presets": []
},
"description": "Run Playwright tests.",
"aliases": [],
"hidden": false,
"path": "/packages/playwright/src/executors/playwright/schema.json",
"type": "executor"
}

View File

@ -0,0 +1,70 @@
{
"name": "configuration",
"factory": "./src/generators/configuration/configuration",
"schema": {
"$schema": "http://json-schema.org/schema",
"$id": "NxPlaywrightConfiguration",
"description": "Add a Playwright configuration.",
"title": "Add a Playwright configuration",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The project to add a Playwright configuration to",
"$default": { "$source": "projectName" },
"x-priority": "important",
"x-prompt": "What is the name of the project to set up Playwright for?"
},
"directory": {
"type": "string",
"description": "A directory where the project is placed relative from the project root",
"x-priority": "important",
"default": "playwright"
},
"js": {
"type": "boolean",
"description": "Generate JavaScript files rather than TypeScript files.",
"default": false
},
"webServerCommand": {
"type": "string",
"description": "The command to start the web server."
},
"webServerAddress": {
"type": "string",
"description": "The address of the web server."
},
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "none"],
"default": "eslint"
},
"setParserOptionsProject": {
"type": "boolean",
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
"default": false
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false,
"x-priority": "internal"
},
"skipPackageJson": {
"type": "boolean",
"default": false,
"description": "Do not add dependencies to `package.json`.",
"x-priority": "internal"
}
},
"required": ["project"],
"presets": []
},
"description": "Add Nx Playwright configuration to your project",
"implementation": "/packages/playwright/src/generators/configuration/configuration.ts",
"aliases": [],
"hidden": false,
"path": "/packages/playwright/src/generators/configuration/schema.json",
"type": "generator"
}

View File

@ -0,0 +1,33 @@
{
"name": "init",
"factory": "./src/generators/init/init",
"schema": {
"$schema": "http://json-schema.org/schema",
"$id": "NxPlaywrightInit",
"title": "Playwright Init Generator",
"description": "Initializes a Playwright project in the current workspace.",
"type": "object",
"properties": {
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false,
"x-priority": "internal"
},
"skipPackageJson": {
"type": "boolean",
"default": false,
"description": "Do not add dependencies to `package.json`.",
"x-priority": "internal"
}
},
"required": [],
"presets": []
},
"description": "Initializes a Playwright project in the current workspace",
"implementation": "/packages/playwright/src/generators/init/init.ts",
"aliases": [],
"hidden": false,
"path": "/packages/playwright/src/generators/init/schema.json",
"type": "generator"
}

View File

@ -481,6 +481,12 @@
- [noop](/packages/nx/executors/noop)
- [run-commands](/packages/nx/executors/run-commands)
- [run-script](/packages/nx/executors/run-script)
- [playwright](/packages/playwright)
- [executors](/packages/playwright/executors)
- [playwright](/packages/playwright/executors/playwright)
- [generators](/packages/playwright/generators)
- [configuration](/packages/playwright/generators/configuration)
- [init](/packages/playwright/generators/init)
- [plugin](/packages/plugin)
- [documents](/packages/plugin/documents)
- [Overview](/packages/plugin/documents/overview)

View File

@ -0,0 +1,6 @@
<svg width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M161.661 262.296V239.863L99.3324 257.537C99.3324 257.537 103.938 230.777 136.444 221.556C146.302 218.762 154.713 218.781 161.661 220.123V128.11H192.869C189.471 117.61 186.184 109.526 183.423 103.909C178.856 94.612 174.174 100.775 163.545 109.665C156.059 115.919 137.139 129.261 108.668 136.933C80.1966 144.61 57.179 142.574 47.5752 140.911C33.9601 138.562 26.8387 135.572 27.5049 145.928C28.0847 155.062 30.2605 169.224 35.2445 187.928C46.0272 228.433 81.663 306.481 149.01 288.342C166.602 283.602 179.019 274.233 187.626 262.291H161.661V262.296ZM61.0848 188.484L108.946 175.876C108.946 175.876 107.551 194.288 89.6087 199.018C71.6614 203.743 61.0848 188.484 61.0848 188.484Z" fill="#999999"/>
<path d="M341.786 129.174C329.345 131.355 299.498 134.072 262.612 124.185C225.716 114.304 201.236 97.0224 191.537 88.8994C177.788 77.3834 171.74 69.3802 165.788 81.4857C160.526 92.163 153.797 109.54 147.284 133.866C133.171 186.543 122.623 297.706 209.867 321.098C297.093 344.47 343.53 242.92 357.644 190.238C364.157 165.917 367.013 147.5 367.799 135.625C368.695 122.173 359.455 126.078 341.786 129.174ZM166.497 172.756C166.497 172.756 180.246 151.372 203.565 158C226.899 164.628 228.706 190.425 228.706 190.425L166.497 172.756ZM223.42 268.713C182.403 256.698 176.077 223.99 176.077 223.99L286.262 254.796C286.262 254.791 264.021 280.578 223.42 268.713ZM262.377 201.495C262.377 201.495 276.107 180.126 299.422 186.773C322.736 193.411 324.572 219.208 324.572 219.208L262.377 201.495Z" fill="#AAAAAA"/>
<path d="M139.88 246.04L99.3324 257.532C99.3324 257.532 103.737 232.44 133.607 222.496L110.647 136.33L108.663 136.933C80.1918 144.611 57.1742 142.574 47.5704 140.911C33.9554 138.563 26.834 135.572 27.5001 145.929C28.08 155.063 30.2557 169.224 35.2397 187.929C46.0225 228.433 81.6583 306.481 149.005 288.342L150.989 287.719L139.88 246.04ZM61.0848 188.485L108.946 175.876C108.946 175.876 107.551 194.288 89.6087 199.018C71.6615 203.743 61.0848 188.485 61.0848 188.485Z" fill="#999999"/>
<path d="M225.27 269.163L223.415 268.712C182.398 256.698 176.072 223.99 176.072 223.99L232.89 239.872L262.971 124.281L262.607 124.185C225.711 114.304 201.232 97.0224 191.532 88.8994C177.783 77.3834 171.735 69.3802 165.783 81.4857C160.526 92.163 153.797 109.54 147.284 133.866C133.171 186.543 122.623 297.706 209.867 321.097L211.655 321.5L225.27 269.163ZM166.497 172.756C166.497 172.756 180.246 151.372 203.565 158C226.899 164.628 228.706 190.425 228.706 190.425L166.497 172.756Z" fill="#555555"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -16,6 +16,7 @@ export const iconsMap: Record<string, string> = {
next: '/images/icons/nextdotjs.svg',
node: '/images/icons/nodedotjs.svg',
nx: '/images/icons/nx.svg',
playwright: '/images/icons/playwright.svg',
plugin: '/images/icons/nx.svg',
react: '/images/icons/react.svg',
'react-native': '/images/icons/react.svg',

View File

@ -3,7 +3,7 @@
"version": "0.0.1",
"type": "commonjs",
"homepage": "https://nx.dev",
"private": true,
"private": false,
"description": "The Nx Plugin for Playwright contains executors and generators allowing your workspace to use the powerful Playwright integration testing capabilities.",
"keywords": [
"Monorepo",
@ -42,5 +42,15 @@
}
},
"executors": "./executors.json",
"generators": "./generators.json"
"generators": "./generators.json",
"exports": {
".": "./index.js",
"./package.json": "./package.json",
"./migrations.json": "./migrations.json",
"./generators.json": "./generators.json",
"./generators/*/schema.json": "./src/generators/*/schema.json",
"./executors.json": "./executors.json",
"./executors/*/schema.json": "./src/executors/*/schema.json",
"./preset": "./src/utils/preset.js"
}
}