chore: Initial commit (#1)
This commit is contained in:
Родитель
610de48991
Коммит
76cc47c9cd
|
@ -0,0 +1,2 @@
|
|||
vscode.d.ts
|
||||
vscode.proposed.d.ts
|
|
@ -0,0 +1,20 @@
|
|||
/**@type {import('eslint').Linter.Config} */
|
||||
// eslint-disable-next-line no-undef
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
rules: {
|
||||
'semi': [2, "always"],
|
||||
'@typescript-eslint/no-unused-vars': 0,
|
||||
'@typescript-eslint/no-explicit-any': 0,
|
||||
'@typescript-eslint/explicit-module-boundary-types': 0,
|
||||
'@typescript-eslint/no-non-null-assertion': 0,
|
||||
}
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
name: Node.js CI
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
- run: npm run compile
|
|
@ -1,104 +1,8 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
/out/
|
||||
node_modules
|
||||
.vscode-test/
|
||||
*.vsix
|
||||
yarn.lock
|
||||
/vscode.d.ts
|
||||
/vscode.proposed.d.ts
|
||||
/example/package-lock.json
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [{
|
||||
"name": "Run Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"${workspaceFolder}/example"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "npm: watch"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
223
LICENSE
223
LICENSE
|
@ -1,21 +1,202 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Portions Copyright (c) Microsoft Corporation.
|
||||
Portions Copyright 2017 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
38
README.md
38
README.md
|
@ -1,33 +1,9 @@
|
|||
# Project
|
||||
# Playwright for Visual Studio Code
|
||||
|
||||
> This repo has been populated by an initial template to help get you started. Please
|
||||
> make sure to update the content to build a great experience for community-building.
|
||||
## Running the Example
|
||||
|
||||
As the maintainer of this project, please make a few updates:
|
||||
|
||||
- Improving this README.MD file to provide a great experience
|
||||
- Updating SUPPORT.MD with content about this project's support experience
|
||||
- Understanding the security reporting process in SECURITY.MD
|
||||
- Remove this section from the README
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
||||
|
||||
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
||||
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
||||
provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
|
||||
## Trademarks
|
||||
|
||||
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
||||
trademarks or logos is subject to and must follow
|
||||
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
||||
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
||||
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
||||
- Run `npm install` in terminal to install dependencies
|
||||
- Run the `Run Extension` target in the Debug View. This will:
|
||||
- Start a task `npm: watch` to compile the code
|
||||
- Run the extension in a new VS Code window
|
||||
- Open a Playwright test file
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test("should be awesome1", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("1212me", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test.describe("should be awesome²", () => {
|
||||
test("me333", ({ page }) => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test.describe("layer 2", () => {
|
||||
|
||||
test("you", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("he", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("she123", ({ page }) => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("it", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat234", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat4", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("but not my cat45", () => {
|
||||
expect(2).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,27 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test("should be awesome1", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test.describe("should be awesome²", () => {
|
||||
test("me", () => {
|
||||
expect(2).toBe(1);
|
||||
});
|
||||
test("you", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("he", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("she123", ({page}) => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("it", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,27 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test("should be awesome1", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test.describe("should be awesome²", () => {
|
||||
test("me", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("you", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("he", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("she123", ({page}) => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("it", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,32 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test("should be awesome1", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("me", () => {
|
||||
expect(2).toBe(1);
|
||||
});
|
||||
|
||||
test.describe("should be awesome²", () => {
|
||||
test("you", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("he", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("she123", ({page}) => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("it", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("but not my cat23", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test("should be awesome1", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test.describe("should be awesome²", () => {
|
||||
test("me", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("you", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("he", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("she123", ({ page }) => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
test("it", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat2", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat3", async({page}) => {
|
||||
expect(await page.evaluate(() => window.navigator.userAgent)).toContain("WebKit");
|
||||
});
|
||||
|
||||
|
||||
test("but not my cat4", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test("but not my cat121", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
test.describe("foobar", () => {
|
||||
test("but dfsdnot my cat3434343", () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
test("this is a great new test", () => {
|
||||
expect(2).toBe(2);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "example",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@playwright/test": "^1.13.0-next-1624521754000"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// playwright.config.ts
|
||||
import { PlaywrightTestConfig } from '@playwright/test';
|
||||
|
||||
const config: PlaywrightTestConfig = {
|
||||
projects: [
|
||||
{
|
||||
name: 'Chromium',
|
||||
use: {
|
||||
// Configure the browser to use.
|
||||
browserName: 'chromium',
|
||||
// Any Chromium-specific options.
|
||||
viewport: { width: 600, height: 800 },
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Firefox',
|
||||
use: { browserName: 'firefox' },
|
||||
},
|
||||
{
|
||||
name: 'WebKit',
|
||||
use: { browserName: 'webkit' },
|
||||
},
|
||||
],
|
||||
};
|
||||
export default config;
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 16 KiB |
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "playwright-vscode",
|
||||
"displayName": "Playwright Test for VSCode",
|
||||
"description": "Integration of Playwright Test and Visual Studio Code.",
|
||||
"icon": "images/playwright-logo.png",
|
||||
"version": "0.0.1",
|
||||
"publisher": "Microsoft",
|
||||
"repository": "https://github.com/Microsoft/playwright-vscode",
|
||||
"enableProposedApi": true,
|
||||
"engines": {
|
||||
"vscode": "^1.58.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"workspaceContains:*.spec.js",
|
||||
"workspaceContains:*.spec.ts"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "playwright-test-provider.selectProject",
|
||||
"title": "Select Playwright Test project"
|
||||
}
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 120,
|
||||
"singleQuote": true,
|
||||
"arrowParens": "avoid"
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"lint": "eslint . --ext .ts,.tsx",
|
||||
"watch": "tsc -watch -p ./",
|
||||
"download-api": "vscode-dts dev",
|
||||
"postdownload-api": "vscode-dts main",
|
||||
"postinstall": "npm run download-api"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^15.12.4",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
||||
"@typescript-eslint/parser": "^4.28.0",
|
||||
"eslint": "^7.29.0",
|
||||
"typescript": "^4.3.4",
|
||||
"vscode-dts": "^0.3.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { PlaywrightTestNPMPackage } from './playwrightTest';
|
||||
import { TestCase, TestFile, testData } from './testTree';
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
const ctrl = vscode.test.createTestController('playwrightTestController');
|
||||
context.subscriptions.push(ctrl);
|
||||
|
||||
if (!vscode.workspace.workspaceFolders) {
|
||||
vscode.window.showWarningMessage('Playwright Test only works when a folder is opened.');
|
||||
return;
|
||||
}
|
||||
|
||||
// All VS Code tests are in a tree, starting at the automatically created "root".
|
||||
// We'll give it a label, and set its status so that VS Code will call
|
||||
// `resolveChildrenHandler` when the test explorer is opened.
|
||||
ctrl.root.label = 'Playwright Test';
|
||||
ctrl.root.canResolveChildren = true;
|
||||
|
||||
ctrl.runHandler = (request: vscode.TestRunRequest, cancellation: vscode.CancellationToken) => {
|
||||
const queue: { test: vscode.TestItem; data: TestCase }[] = [];
|
||||
const run = ctrl.createTestRun(request);
|
||||
const discoverTests = async (tests: Iterable<vscode.TestItem>) => {
|
||||
for (const test of tests) {
|
||||
if (request.exclude?.includes(test)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const data = testData.get(test);
|
||||
if (data instanceof TestCase) {
|
||||
run.setState(test, vscode.TestResultState.Queued);
|
||||
queue.push({test, data});
|
||||
} else {
|
||||
if (data instanceof TestFile && test.children.size === 0) {
|
||||
await data.updateFromDisk(ctrl, test);
|
||||
}
|
||||
|
||||
await discoverTests(test.children.values());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const runTestQueue = async () => {
|
||||
for (const {test, data} of queue) {
|
||||
run.appendOutput(`Running ${test.id}\r\n`);
|
||||
if (cancellation.isCancellationRequested) {
|
||||
run.setState(test, vscode.TestResultState.Skipped);
|
||||
} else {
|
||||
run.setState(test, vscode.TestResultState.Running);
|
||||
await data.run(test, run);
|
||||
}
|
||||
run.appendOutput(`Completed ${test.id}\r\n`);
|
||||
}
|
||||
|
||||
run.end();
|
||||
};
|
||||
|
||||
discoverTests(request.tests).then(runTestQueue);
|
||||
};
|
||||
|
||||
const playwrightTest = await PlaywrightTestNPMPackage.create(vscode.workspace.workspaceFolders[0].uri.path);
|
||||
|
||||
ctrl.resolveChildrenHandler = async item => {
|
||||
if (item === ctrl.root) {
|
||||
await startWatchingWorkspace(ctrl, playwrightTest);
|
||||
return;
|
||||
}
|
||||
const data = testData.get(item);
|
||||
if (data instanceof TestFile)
|
||||
await data.updateFromDisk(ctrl, item);
|
||||
};
|
||||
|
||||
function updateNodeForDocument(e: vscode.TextDocument) {
|
||||
if (!['.ts', '.js'].some(extension => e.uri.path.endsWith(extension))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { file, data } = getOrCreateFile(ctrl, e.uri, playwrightTest);
|
||||
data.updateFromDisk(ctrl, file);
|
||||
}
|
||||
|
||||
for (const document of vscode.workspace.textDocuments) {
|
||||
updateNodeForDocument(document);
|
||||
}
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.workspace.onDidOpenTextDocument(updateNodeForDocument),
|
||||
vscode.workspace.onDidSaveTextDocument(updateNodeForDocument)
|
||||
);
|
||||
|
||||
const commandHandler = async () => {
|
||||
const tests = await playwrightTest.listTests(vscode.workspace.workspaceFolders![0].uri.path);
|
||||
if (!tests)
|
||||
return;
|
||||
const items: vscode.QuickPickItem[] = tests.config.projects.map(project => ({
|
||||
label: project.name,
|
||||
description: `Playwright Test project: ${project.name}`,
|
||||
}));
|
||||
|
||||
const selection = await vscode.window.showQuickPick(items);
|
||||
// the user canceled the selection
|
||||
if (!selection) {
|
||||
return;
|
||||
}
|
||||
playwrightTest.setProject(selection.label);
|
||||
};
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('playwright-test-provider.selectProject', commandHandler)
|
||||
);
|
||||
}
|
||||
|
||||
function getOrCreateFile(controller: vscode.TestController, uri: vscode.Uri, playwrightTest: PlaywrightTestNPMPackage) {
|
||||
const existing = controller.root.children.get(uri.toString());
|
||||
if (existing) {
|
||||
return { file: existing, data: testData.get(existing) as TestFile };
|
||||
}
|
||||
|
||||
const file = controller.createTestItem(
|
||||
uri.toString(),
|
||||
uri.path.split('/').pop()!,
|
||||
controller.root,
|
||||
uri,
|
||||
);
|
||||
|
||||
const data = new TestFile(playwrightTest);
|
||||
testData.set(file, data);
|
||||
|
||||
file.canResolveChildren = true;
|
||||
return { file, data };
|
||||
}
|
||||
|
||||
function startWatchingWorkspace(controller: vscode.TestController, playwrightTest: PlaywrightTestNPMPackage) {
|
||||
if (!vscode.workspace.workspaceFolders) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Promise.all(
|
||||
vscode.workspace.workspaceFolders.map(async workspaceFolder => {
|
||||
const tests = await playwrightTest.listTests(workspaceFolder.uri.path);
|
||||
if (!tests)
|
||||
return;
|
||||
// set default project
|
||||
playwrightTest.setProject(tests.config.projects[0].name);
|
||||
for (const suite of tests.suites)
|
||||
getOrCreateFile(controller, vscode.Uri.file(suite.file), playwrightTest);
|
||||
})
|
||||
);
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { spawn, SpawnOptionsWithoutStdio } from 'child_process';
|
||||
import * as playwrightTestTypes from './testTypes';
|
||||
|
||||
function spawnAsync(cmd: string, args: string[], options: SpawnOptionsWithoutStdio): Promise<{ stdout: Buffer, stderr: Buffer, code: number | null, error?: Error }> {
|
||||
const process = spawn(cmd, args, options);
|
||||
|
||||
return new Promise(resolve => {
|
||||
let stdout = Buffer.from([]);
|
||||
let stderr = Buffer.from([]);
|
||||
if (process.stdout)
|
||||
process.stdout.on('data', data => stdout = Buffer.concat([stdout, data]));
|
||||
if (process.stderr)
|
||||
process.stderr.on('data', data => stderr = Buffer.concat([stderr, data]));
|
||||
process.on('close', code => resolve({ stdout, stderr, code }));
|
||||
process.on('error', error => resolve({ stdout, stderr, code: 1, error }));
|
||||
});
|
||||
}
|
||||
|
||||
async function fileExistsAsync(file: string): Promise<boolean> {
|
||||
return fs.promises.access(file, fs.constants.F_OK)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
export class PlaywrightTestNPMPackage {
|
||||
private _projectName?: string;
|
||||
private _directory: string;
|
||||
private _cliEntrypoint: string;
|
||||
constructor(directory: string) {
|
||||
this._directory = directory;
|
||||
this._cliEntrypoint = path.join(directory, 'node_modules', '@playwright', 'test', 'lib', 'cli', 'cli.js');
|
||||
}
|
||||
static async create(directory: string) {
|
||||
const pwTest = new PlaywrightTestNPMPackage(directory);
|
||||
try {
|
||||
await fileExistsAsync(pwTest._cliEntrypoint);
|
||||
} catch (error) {
|
||||
throw new Error(`Could not locate Playwright Test. Is it installed? 'npm install -D @playwright/test'`);
|
||||
}
|
||||
return pwTest;
|
||||
}
|
||||
public async listTests(fileOrFolder: string): Promise<playwrightTestTypes.PlaywrightTestOutput | null> {
|
||||
const proc = await spawnAsync('node', [this._cliEntrypoint, 'test', '--reporter=json', '--list', fileOrFolder], {
|
||||
cwd: this._directory,
|
||||
});
|
||||
if (proc.code !== 0) {
|
||||
if (proc.stderr.includes("no tests found."))
|
||||
return null;
|
||||
throw new Error(proc.stderr.toString() + "\n" + proc.stdout.toString());
|
||||
}
|
||||
return JSON.parse(proc.stdout.toString());
|
||||
}
|
||||
public async runTest(path: string, line: number): Promise<playwrightTestTypes.PlaywrightTestOutput> {
|
||||
const proc = await spawnAsync('node', [this._cliEntrypoint, 'test', '--reporter=json', `--project=${this._projectName}`, `${path}:${line}`], {
|
||||
cwd: this._directory,
|
||||
});
|
||||
return JSON.parse(proc.stdout.toString());
|
||||
}
|
||||
public setProject(projectName: string) {
|
||||
this._projectName = projectName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { PlaywrightTestNPMPackage } from './playwrightTest';
|
||||
import * as playwrightTestTypes from './testTypes';
|
||||
|
||||
type MarkdownTestData = TestFile | TestHeading | TestCase;
|
||||
|
||||
let generationCounter = 0;
|
||||
export const testData = new WeakMap<vscode.TestItem, MarkdownTestData>();
|
||||
|
||||
export class TestFile {
|
||||
constructor(
|
||||
private readonly playwrightTest: PlaywrightTestNPMPackage,
|
||||
) { }
|
||||
|
||||
public async updateFromDisk(controller: vscode.TestController, item: vscode.TestItem) {
|
||||
try {
|
||||
item.error = undefined;
|
||||
await this.updateFromDiskImpl(controller, item);
|
||||
} catch (e) {
|
||||
console.debug("--Playwright Test Exception while reloading the tests--");
|
||||
console.debug(e);
|
||||
vscode.window.showErrorMessage(e.toString());
|
||||
item.error = e.stack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the tests from the input text, and updates the tests contained
|
||||
* by this file to be those from the text,
|
||||
*/
|
||||
private async updateFromDiskImpl(controller: vscode.TestController, item: vscode.TestItem) {
|
||||
const ancestors: vscode.TestItem[] = [item];
|
||||
const thisGeneration = generationCounter++;
|
||||
const tests = await this.playwrightTest.listTests(item.uri!.path);
|
||||
if (!tests)
|
||||
return;
|
||||
|
||||
const addTests = (suite: playwrightTestTypes.Suite, parent: vscode.TestItem) => {
|
||||
for (const test of suite.specs) {
|
||||
const data = new TestCase(this.playwrightTest, test, thisGeneration);
|
||||
const id = `${item.uri}/${data.getLabel()}`;
|
||||
const existing = parent.children.get(id);
|
||||
const range = createRangeFromPlaywright(test);
|
||||
if (existing) {
|
||||
(testData.get(existing) as TestHeading).generation = thisGeneration;
|
||||
existing.range = range;
|
||||
} else {
|
||||
const tcase = controller.createTestItem(id, data.getLabel(), parent, item.uri);
|
||||
testData.set(tcase, data);
|
||||
tcase.range = range;
|
||||
}
|
||||
}
|
||||
for (const subSuite of suite.suites || []) {
|
||||
const id = `${item.uri}/${subSuite.title}`;
|
||||
const existing = parent.children.get(id);
|
||||
const data = existing && testData.get(existing);
|
||||
const range = createRangeFromPlaywright(subSuite);
|
||||
if (existing && data instanceof TestHeading) {
|
||||
ancestors.push(existing);
|
||||
data.generation = thisGeneration;
|
||||
existing.range = range;
|
||||
addTests(subSuite, existing);
|
||||
} else {
|
||||
existing?.dispose();
|
||||
const thead = controller.createTestItem(id, subSuite.title, parent, item.uri);
|
||||
thead.range = range;
|
||||
testData.set(thead, new TestHeading(thisGeneration));
|
||||
ancestors.push(thead);
|
||||
addTests(subSuite, thead);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (const suite of tests.suites)
|
||||
addTests(suite, item);
|
||||
|
||||
this.prune(item, thisGeneration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes tests that were deleted from the source. Each test suite and case
|
||||
* has a 'generation' counter which is updated each time we discover it. This
|
||||
* is called after discovery is finished to remove any children who are no
|
||||
* longer in this generation.
|
||||
*/
|
||||
private prune(item: vscode.TestItem, thisGeneration: number) {
|
||||
const queue: vscode.TestItem[] = [item];
|
||||
for (const parent of queue) {
|
||||
for (const child of parent.children.values()) {
|
||||
const data = testData.get(child) as TestCase | TestHeading;
|
||||
if (data.generation < thisGeneration) {
|
||||
child.dispose();
|
||||
} else if (data instanceof TestHeading) {
|
||||
queue.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class TestHeading {
|
||||
constructor(public generation: number) { }
|
||||
}
|
||||
|
||||
export class TestCase {
|
||||
constructor(
|
||||
private readonly playwrightTest: PlaywrightTestNPMPackage,
|
||||
private readonly spec: playwrightTestTypes.TestSpec,
|
||||
public generation: number
|
||||
) { }
|
||||
|
||||
getLabel() {
|
||||
return this.spec.title;
|
||||
}
|
||||
|
||||
async run(item: vscode.TestItem, options: vscode.TestRun): Promise<void> {
|
||||
const result = await this.playwrightTest.runTest(item.uri!.path, this.spec.line);
|
||||
const processSpec = (spec: playwrightTestTypes.TestSpec) => {
|
||||
if (!spec.tests || spec.tests.length === 0)
|
||||
throw new Error("todo");
|
||||
const test = spec.tests[0];
|
||||
if (test.results[0].status === 'passed') {
|
||||
options.setState(item, vscode.TestResultState.Passed, test.results[0].duration);
|
||||
} else if (test.results[0].status === 'failed') {
|
||||
if (test.results[0].error) {
|
||||
const message = new vscode.TestMessage(test.results[0].error.stack);
|
||||
message.location = new vscode.Location(item.uri!, item.range!);
|
||||
options.appendMessage(item, message);
|
||||
}
|
||||
// TODO: better diffs
|
||||
/**
|
||||
*
|
||||
const message = vscode.TestMessage.diff(`Expected ${item.label}`, String(this.expected), String(actual));
|
||||
message.location = new vscode.Location(item.uri!, item.range!);
|
||||
options.appendMessage(item, message);
|
||||
options.setState(item, vscode.TestResultState.Failed, duration);
|
||||
*/
|
||||
options.setState(item, vscode.TestResultState.Failed, test.results[0].duration);
|
||||
}
|
||||
};
|
||||
let found = false;
|
||||
const visit = (suite: playwrightTestTypes.Suite) => {
|
||||
if (found)
|
||||
return;
|
||||
for (const spec of suite.specs) {
|
||||
if (spec.line === this.spec.line && spec.column === this.spec.column) {
|
||||
found = true;
|
||||
processSpec(spec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const subSuite of suite.suites || [])
|
||||
visit(subSuite);
|
||||
};
|
||||
for (const suite of result.suites)
|
||||
visit(suite);
|
||||
}
|
||||
}
|
||||
|
||||
function createRangeFromPlaywright(subSuite: playwrightTestTypes.Suite | playwrightTestTypes.TestSpec): vscode.Range {
|
||||
return new vscode.Range(new vscode.Position(subSuite.line - 1, subSuite.column), new vscode.Position(subSuite.line - 1, subSuite.column + 1));
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface PlaywrightTestOutput {
|
||||
config: Config;
|
||||
suites: Suite[];
|
||||
errors: any[];
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
forbidOnly: boolean;
|
||||
globalSetup: null;
|
||||
globalTeardown: null;
|
||||
globalTimeout: number;
|
||||
maxFailures: number;
|
||||
preserveOutput: string;
|
||||
projects: Project[];
|
||||
reporter: Array<string[]>;
|
||||
rootDir: string;
|
||||
quiet: boolean;
|
||||
shard: null;
|
||||
updateSnapshots: string;
|
||||
workers: number;
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
outputDir: string;
|
||||
repeatEach: number;
|
||||
retries: number;
|
||||
name: string;
|
||||
testDir: string;
|
||||
testIgnore: any[];
|
||||
testMatch: string[];
|
||||
timeout: number;
|
||||
}
|
||||
|
||||
export interface Suite {
|
||||
title: string;
|
||||
file: string;
|
||||
line: number;
|
||||
column: number;
|
||||
specs: TestSpec[];
|
||||
suites?: Suite[];
|
||||
}
|
||||
|
||||
export interface TestSpec {
|
||||
title: string;
|
||||
ok: boolean;
|
||||
tests: Test[];
|
||||
file: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface Test {
|
||||
timeout: number;
|
||||
annotations: any[];
|
||||
expectedStatus: string;
|
||||
projectName: string;
|
||||
results: TestResult[];
|
||||
}
|
||||
|
||||
export interface TestResult {
|
||||
workerIndex: number
|
||||
status: "passed" | "failed"
|
||||
duration: number
|
||||
stdout: string[]
|
||||
stderr: string[]
|
||||
retry: number
|
||||
error?: {
|
||||
message: string
|
||||
stack: string
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2019",
|
||||
"lib": ["ES2019"],
|
||||
"outDir": "out",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"rootDir": "src"
|
||||
},
|
||||
"exclude": ["node_modules", ".vscode-test", "example"]
|
||||
}
|
Загрузка…
Ссылка в новой задаче