@taqwright/taqwright 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +108 -0
- package/dist/auto-appium.d.ts +12 -0
- package/dist/auto-appium.js +77 -0
- package/dist/bin/branding.d.ts +6 -0
- package/dist/bin/branding.js +22 -0
- package/dist/bin/index.d.ts +2 -0
- package/dist/bin/index.js +321 -0
- package/dist/bin/init.d.ts +26 -0
- package/dist/bin/init.js +902 -0
- package/dist/bin/inspect.d.ts +9 -0
- package/dist/bin/inspect.js +91 -0
- package/dist/bin/report-branding.d.ts +2 -0
- package/dist/bin/report-branding.js +42 -0
- package/dist/branding-assets.d.ts +1 -0
- package/dist/branding-assets.js +1 -0
- package/dist/capabilities-helpers.d.ts +7 -0
- package/dist/capabilities-helpers.js +14 -0
- package/dist/capabilities.d.ts +6 -0
- package/dist/capabilities.js +86 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.js +235 -0
- package/dist/discovery-setup.d.ts +1 -0
- package/dist/discovery-setup.js +61 -0
- package/dist/discovery.d.ts +17 -0
- package/dist/discovery.js +55 -0
- package/dist/docs/configuration.html +376 -0
- package/dist/docs/custom-reporters.html +265 -0
- package/dist/docs/docker.html +339 -0
- package/dist/docs/docs.js +173 -0
- package/dist/docs/generating-tests.html +161 -0
- package/dist/docs/images/taqwright-html-report.png +0 -0
- package/dist/docs/index.html +13 -0
- package/dist/docs/installation.html +686 -0
- package/dist/docs/parallel.html +271 -0
- package/dist/docs/running-tests.html +385 -0
- package/dist/docs/styles.css +460 -0
- package/dist/docs/writing-tests.html +565 -0
- package/dist/doctor.d.ts +33 -0
- package/dist/doctor.js +508 -0
- package/dist/expect.d.ts +38 -0
- package/dist/expect.js +96 -0
- package/dist/fixture/artifact-mode.d.ts +2 -0
- package/dist/fixture/artifact-mode.js +7 -0
- package/dist/fixture/index.d.ts +15 -0
- package/dist/fixture/index.js +324 -0
- package/dist/images/taqwright-html-report.png +0 -0
- package/dist/images/taqwright_favicon.png +0 -0
- package/dist/images/taqwright_logo.png +0 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/dist/inspector/codegen-appium.d.ts +3 -0
- package/dist/inspector/codegen-appium.js +228 -0
- package/dist/inspector/devices.d.ts +41 -0
- package/dist/inspector/devices.js +422 -0
- package/dist/inspector/locator-suggester.d.ts +23 -0
- package/dist/inspector/locator-suggester.js +539 -0
- package/dist/inspector/recorder.d.ts +128 -0
- package/dist/inspector/recorder.js +162 -0
- package/dist/inspector/server.d.ts +39 -0
- package/dist/inspector/server.js +1210 -0
- package/dist/inspector/session.d.ts +84 -0
- package/dist/inspector/session.js +262 -0
- package/dist/inspector/ui.d.ts +1 -0
- package/dist/inspector/ui.js +5508 -0
- package/dist/keys.d.ts +3 -0
- package/dist/keys.js +28 -0
- package/dist/locator/index.d.ts +206 -0
- package/dist/locator/index.js +1506 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.js +5 -0
- package/dist/mobile/index.d.ts +130 -0
- package/dist/mobile/index.js +762 -0
- package/dist/network/android.d.ts +5 -0
- package/dist/network/android.js +87 -0
- package/dist/network/ca.d.ts +10 -0
- package/dist/network/ca.js +136 -0
- package/dist/network/har.d.ts +90 -0
- package/dist/network/har.js +101 -0
- package/dist/network/host-proxy.d.ts +16 -0
- package/dist/network/host-proxy.js +134 -0
- package/dist/network/index.d.ts +26 -0
- package/dist/network/index.js +105 -0
- package/dist/network/ios-sim.d.ts +3 -0
- package/dist/network/ios-sim.js +29 -0
- package/dist/network/proxy.d.ts +13 -0
- package/dist/network/proxy.js +310 -0
- package/dist/providers/appium.d.ts +23 -0
- package/dist/providers/appium.js +288 -0
- package/dist/providers/browserstack/index.d.ts +5 -0
- package/dist/providers/browserstack/index.js +77 -0
- package/dist/providers/browserstack/utils.d.ts +1 -0
- package/dist/providers/browserstack/utils.js +6 -0
- package/dist/providers/cloud.d.ts +53 -0
- package/dist/providers/cloud.js +117 -0
- package/dist/providers/emulator/index.d.ts +8 -0
- package/dist/providers/emulator/index.js +47 -0
- package/dist/providers/index.d.ts +10 -0
- package/dist/providers/index.js +33 -0
- package/dist/providers/lambdatest/index.d.ts +28 -0
- package/dist/providers/lambdatest/index.js +99 -0
- package/dist/providers/lambdatest/utils.d.ts +1 -0
- package/dist/providers/lambdatest/utils.js +6 -0
- package/dist/providers/local/index.d.ts +9 -0
- package/dist/providers/local/index.js +53 -0
- package/dist/providers/local-session.d.ts +16 -0
- package/dist/providers/local-session.js +55 -0
- package/dist/setup/archive.d.ts +2 -0
- package/dist/setup/archive.js +43 -0
- package/dist/setup/avd.d.ts +12 -0
- package/dist/setup/avd.js +103 -0
- package/dist/setup/index.d.ts +6 -0
- package/dist/setup/index.js +55 -0
- package/dist/setup/install-android.d.ts +2 -0
- package/dist/setup/install-android.js +70 -0
- package/dist/setup/install-appium.d.ts +1 -0
- package/dist/setup/install-appium.js +64 -0
- package/dist/setup/install-jdk.d.ts +1 -0
- package/dist/setup/install-jdk.js +58 -0
- package/dist/setup/paths.d.ts +16 -0
- package/dist/setup/paths.js +88 -0
- package/dist/setup/spawn-tool.d.ts +3 -0
- package/dist/setup/spawn-tool.js +11 -0
- package/dist/tracer/index.d.ts +34 -0
- package/dist/tracer/index.js +687 -0
- package/dist/tracer/proxy.d.ts +3 -0
- package/dist/tracer/proxy.js +60 -0
- package/dist/types/index.d.ts +189 -0
- package/dist/types/index.js +6 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +37 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 The taqwright contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="src/images/taqwright_logo.png" alt="Taqwright logo" width="120" />
|
|
3
|
+
<br />
|
|
4
|
+
Taqwright
|
|
5
|
+
</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/taqelah/taqwright/tags"><img src="https://img.shields.io/badge/version-0.0.24-blue" alt="version" /></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
E2E mobile UI testing on the Playwright runner, with a flat locator API on top of Appium 3.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { test, expect } from '@taqwright/taqwright';
|
|
15
|
+
|
|
16
|
+
test('User can login', async ({ mobile }) => {
|
|
17
|
+
await mobile.getByLabel('Username').fill('admin');
|
|
18
|
+
await mobile.getByLabel('Password').fill('password');
|
|
19
|
+
await mobile.getByText('Login').click();
|
|
20
|
+
await expect(mobile.getByText('Welcome')).toBeVisible();
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> 📚 **Full documentation: [taqwright.dev/docs](https://www.taqwright.dev/docs/category/getting-started)** — install taqwright, write and generate tests, run and debug them, and scale out in parallel.
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- Node.js **24.x or 25.x** (Node 26+ has a known bug).
|
|
29
|
+
- A booted Android emulator, iOS simulator, or connected device.
|
|
30
|
+
- [Appium 3.x](https://appium.io) (`npm i -g appium@^3`) running on `localhost:4723`, with the relevant driver installed:
|
|
31
|
+
- Android: `appium driver install uiautomator2`
|
|
32
|
+
- iOS: `appium driver install xcuitest`
|
|
33
|
+
- Platform tools on `PATH`: `adb` (Android), `xcrun` (iOS, macOS only), `java` (UiAutomator2).
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
taqwright is published on npm:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install --save-dev @taqwright/taqwright
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
In `package.json` it looks like:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@taqwright/taqwright": "^0.0.24"
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The package imports as `@taqwright/taqwright` and the CLI command is `taqwright`.
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx taqwright init # interactive scaffolder — creates package.json, tsconfig, sample test
|
|
57
|
+
npx taqwright doctor # verify your env (adb, xcrun, java, appium)
|
|
58
|
+
npx taqwright devices # list local emulators / simulators
|
|
59
|
+
npx taqwright codegen # record a test as you tap through the app (Playwright-codegen-style)
|
|
60
|
+
npx taqwright test # run your tests
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Configure
|
|
64
|
+
|
|
65
|
+
Create `taqwright.config.ts` at your project root:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { defineConfig, Platform } from '@taqwright/taqwright';
|
|
69
|
+
|
|
70
|
+
export default defineConfig({
|
|
71
|
+
timeout: 30_000,
|
|
72
|
+
projects: [
|
|
73
|
+
{
|
|
74
|
+
name: 'android',
|
|
75
|
+
use: {
|
|
76
|
+
platform: Platform.ANDROID,
|
|
77
|
+
device: { provider: 'emulator', name: /Pixel 10 Pro XL/ },
|
|
78
|
+
buildPath: '/abs/path/to/app.apk',
|
|
79
|
+
appBundleId: 'com.example.app',
|
|
80
|
+
resetBetweenTests: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Every `defineConfig` / `use` option is documented in the [Configuration guide](https://www.taqwright.dev/docs/configuration).
|
|
88
|
+
|
|
89
|
+
## Guides
|
|
90
|
+
|
|
91
|
+
| Guide | What it covers |
|
|
92
|
+
| --------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
93
|
+
| [Installation](https://www.taqwright.dev/docs/installation) | Set up a configured project ready for its first test. |
|
|
94
|
+
| [Writing tests](https://www.taqwright.dev/docs/writing-tests) | Drive live devices and assert UI state with auto-waiting locators. |
|
|
95
|
+
| [Generating tests](https://www.taqwright.dev/docs/generating-tests) | Record tests in a browser-based device viewer that ranks selectors. |
|
|
96
|
+
| [Running & debugging](https://www.taqwright.dev/docs/running-and-debugging) | Per-action traces, full-run videos, and Playwright reporters. |
|
|
97
|
+
| [Parallel runs](https://www.taqwright.dev/docs/parallel-runs) | Scale out with local device pools or cloud providers. |
|
|
98
|
+
| [Configuration](https://www.taqwright.dev/docs/configuration) | Every `defineConfig` / `use` option. |
|
|
99
|
+
|
|
100
|
+
## Acknowledgements
|
|
101
|
+
|
|
102
|
+
- [**Appium**](https://appium.io) — the underlying mobile automation server taqwright drives.
|
|
103
|
+
- [**Playwright**](https://playwright.dev) — test runner, reporter, fixture machinery.
|
|
104
|
+
- [**AppWright**](https://github.com/empirical-run/appwright) — thanks for the inspiration.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
Apache-2.0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChildProcess } from 'node:child_process';
|
|
2
|
+
import type { TaqwrightConfig } from './types/index.js';
|
|
3
|
+
export interface AutoStartTarget {
|
|
4
|
+
name: string;
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
basePath?: string;
|
|
8
|
+
avd?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function isPortOpen(host: string, port: number, timeoutMs?: number): Promise<boolean>;
|
|
11
|
+
export declare function autoStartTargets(cfg: TaqwrightConfig, projectFilter?: string[]): AutoStartTarget[];
|
|
12
|
+
export declare function maybeAutoStartAppium(configPath: string, projectFilter?: string[]): Promise<ChildProcess[]>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createConnection } from 'node:net';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { loadTaqwrightConfig } from './config.js';
|
|
4
|
+
import { startAppiumServer, killAppiumOnPort } from './providers/appium.js';
|
|
5
|
+
import { isCloudProvider } from './providers/index.js';
|
|
6
|
+
import { bootableAvdName } from './setup/avd.js';
|
|
7
|
+
export async function isPortOpen(host, port, timeoutMs = 500) {
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
const sock = createConnection({ host, port });
|
|
10
|
+
const done = (ok) => {
|
|
11
|
+
sock.destroy();
|
|
12
|
+
resolve(ok);
|
|
13
|
+
};
|
|
14
|
+
sock.setTimeout(timeoutMs);
|
|
15
|
+
sock.once('connect', () => done(true));
|
|
16
|
+
sock.once('timeout', () => done(false));
|
|
17
|
+
sock.once('error', () => done(false));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async function waitForPortClosed(host, port, timeoutMs = 5000) {
|
|
21
|
+
const deadline = Date.now() + timeoutMs;
|
|
22
|
+
while (Date.now() < deadline) {
|
|
23
|
+
if (!(await isPortOpen(host, port)))
|
|
24
|
+
return;
|
|
25
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function autoStartTargets(cfg, projectFilter = []) {
|
|
29
|
+
const filterSet = new Set(projectFilter);
|
|
30
|
+
const seen = new Set();
|
|
31
|
+
const targets = [];
|
|
32
|
+
for (const project of cfg.projects) {
|
|
33
|
+
if (filterSet.size > 0 && !filterSet.has(project.name ?? ''))
|
|
34
|
+
continue;
|
|
35
|
+
const device = project.use?.device;
|
|
36
|
+
if (isCloudProvider(device?.provider))
|
|
37
|
+
continue;
|
|
38
|
+
const hasPool = Array.isArray(device?.pool) && device.pool.length > 0;
|
|
39
|
+
if (hasPool || device?.autoDiscover === true)
|
|
40
|
+
continue;
|
|
41
|
+
const appium = project.use?.appium;
|
|
42
|
+
if (!appium?.autoStart)
|
|
43
|
+
continue;
|
|
44
|
+
const host = appium.host ?? 'localhost';
|
|
45
|
+
const port = appium.port ?? 4723;
|
|
46
|
+
const key = `${host}:${port}`;
|
|
47
|
+
if (seen.has(key))
|
|
48
|
+
continue;
|
|
49
|
+
seen.add(key);
|
|
50
|
+
const avd = project.use ? bootableAvdName(project.use) : undefined;
|
|
51
|
+
targets.push({ name: project.name ?? '', host, port, basePath: appium.path, avd });
|
|
52
|
+
}
|
|
53
|
+
return targets;
|
|
54
|
+
}
|
|
55
|
+
export async function maybeAutoStartAppium(configPath, projectFilter = []) {
|
|
56
|
+
const cfg = await loadTaqwrightConfig(dirname(configPath));
|
|
57
|
+
if (!cfg)
|
|
58
|
+
return [];
|
|
59
|
+
const procs = [];
|
|
60
|
+
for (const { host, port, basePath, avd } of autoStartTargets(cfg, projectFilter)) {
|
|
61
|
+
if (await isPortOpen(host, port)) {
|
|
62
|
+
const killed = await killAppiumOnPort(port);
|
|
63
|
+
if (killed) {
|
|
64
|
+
console.log(`taqwright: killed stale Appium on ${host}:${port}, restarting…`);
|
|
65
|
+
await waitForPortClosed(host, port);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log(`taqwright: ${host}:${port} is in use by a non-Appium process; leaving it untouched.`);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
console.log(`taqwright: starting Appium server on ${host}:${port}…`);
|
|
73
|
+
const proc = await startAppiumServer('unknown', { host, port, basePath }, avd);
|
|
74
|
+
procs.push(proc);
|
|
75
|
+
}
|
|
76
|
+
return procs;
|
|
77
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function brandLine(s) {
|
|
2
|
+
return s.split('playwright show-report').join('taqwright show-report');
|
|
3
|
+
}
|
|
4
|
+
export class BrandingBuffer {
|
|
5
|
+
buf = '';
|
|
6
|
+
push(chunk) {
|
|
7
|
+
this.buf += chunk;
|
|
8
|
+
const nl = this.buf.lastIndexOf('\n');
|
|
9
|
+
if (nl === -1)
|
|
10
|
+
return '';
|
|
11
|
+
const ready = this.buf.slice(0, nl + 1);
|
|
12
|
+
this.buf = this.buf.slice(nl + 1);
|
|
13
|
+
return brandLine(ready);
|
|
14
|
+
}
|
|
15
|
+
flush() {
|
|
16
|
+
if (!this.buf)
|
|
17
|
+
return '';
|
|
18
|
+
const out = brandLine(this.buf);
|
|
19
|
+
this.buf = '';
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
}
|