testdriverai 5.3.12 → 5.3.14

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.
Files changed (148) hide show
  1. package/agent.js +21 -18
  2. package/docs/30x30.mdx +1 -1
  3. package/docs/action/secrets.mdx +1 -1
  4. package/docs/commands/assert.mdx +4 -4
  5. package/docs/commands/exec.mdx +33 -23
  6. package/docs/commands/focus-application.mdx +3 -3
  7. package/docs/commands/hover-image.mdx +6 -6
  8. package/docs/commands/hover-text.mdx +3 -3
  9. package/docs/commands/if.mdx +1 -1
  10. package/docs/commands/match-image.mdx +4 -4
  11. package/docs/commands/run.mdx +1 -1
  12. package/docs/commands/scroll-until-image.mdx +6 -3
  13. package/docs/commands/scroll-until-text.mdx +3 -3
  14. package/docs/commands/type.mdx +1 -1
  15. package/docs/commands/wait-for-image.mdx +1 -1
  16. package/docs/commands/wait-for-text.mdx +1 -1
  17. package/docs/docs.json +1 -1
  18. package/docs/features/auto-healing.mdx +1 -1
  19. package/docs/features/cross-platform.mdx +1 -1
  20. package/docs/features/generation.mdx +76 -142
  21. package/docs/features/parallel-testing.mdx +1 -1
  22. package/docs/features/selectorless.mdx +1 -1
  23. package/docs/getting-started/generating.mdx +90 -30
  24. package/docs/getting-started/vscode.mdx +1 -1
  25. package/docs/guide/assertions.mdx +1 -1
  26. package/docs/guide/authentication.mdx +10 -26
  27. package/docs/guide/code.mdx +31 -141
  28. package/docs/guide/lifecycle.mdx +41 -0
  29. package/docs/guide/locating.mdx +1 -1
  30. package/docs/guide/variables.mdx +35 -121
  31. package/docs/guide/waiting.mdx +26 -101
  32. package/docs/interactive/assert.mdx +2 -2
  33. package/docs/interactive/undo.mdx +1 -1
  34. package/docs/overview/what-is-testdriver.mdx +1 -1
  35. package/docs/quickstart.mdx +3 -1
  36. package/docs/security/action.mdx +2 -2
  37. package/docs/security/agent.mdx +4 -4
  38. package/docs/security/platform.mdx +1 -1
  39. package/lib/init.js +0 -1
  40. package/lib/upload-secrets.js +1 -0
  41. package/package.json +3 -3
  42. package/styles/.vale-config/2-MDX.ini +5 -0
  43. package/styles/Microsoft/AMPM.yml +9 -0
  44. package/styles/Microsoft/Accessibility.yml +30 -0
  45. package/styles/Microsoft/Acronyms.yml +64 -0
  46. package/styles/Microsoft/Adverbs.yml +272 -0
  47. package/styles/Microsoft/Auto.yml +11 -0
  48. package/styles/Microsoft/Avoid.yml +14 -0
  49. package/styles/Microsoft/Contractions.yml +50 -0
  50. package/styles/Microsoft/Dashes.yml +13 -0
  51. package/styles/Microsoft/DateFormat.yml +8 -0
  52. package/styles/Microsoft/DateNumbers.yml +40 -0
  53. package/styles/Microsoft/DateOrder.yml +8 -0
  54. package/styles/Microsoft/Ellipses.yml +9 -0
  55. package/styles/Microsoft/FirstPerson.yml +16 -0
  56. package/styles/Microsoft/Foreign.yml +13 -0
  57. package/styles/Microsoft/Gender.yml +8 -0
  58. package/styles/Microsoft/GenderBias.yml +42 -0
  59. package/styles/Microsoft/GeneralURL.yml +11 -0
  60. package/styles/Microsoft/HeadingAcronyms.yml +7 -0
  61. package/styles/Microsoft/HeadingColons.yml +8 -0
  62. package/styles/Microsoft/HeadingPunctuation.yml +13 -0
  63. package/styles/Microsoft/Headings.yml +28 -0
  64. package/styles/Microsoft/Hyphens.yml +14 -0
  65. package/styles/Microsoft/Negative.yml +13 -0
  66. package/styles/Microsoft/Ordinal.yml +13 -0
  67. package/styles/Microsoft/OxfordComma.yml +8 -0
  68. package/styles/Microsoft/Passive.yml +183 -0
  69. package/styles/Microsoft/Percentages.yml +7 -0
  70. package/styles/Microsoft/Plurals.yml +7 -0
  71. package/styles/Microsoft/Quotes.yml +7 -0
  72. package/styles/Microsoft/RangeTime.yml +13 -0
  73. package/styles/Microsoft/Semicolon.yml +8 -0
  74. package/styles/Microsoft/SentenceLength.yml +7 -0
  75. package/styles/Microsoft/Spacing.yml +8 -0
  76. package/styles/Microsoft/Suspended.yml +7 -0
  77. package/styles/Microsoft/Terms.yml +42 -0
  78. package/styles/Microsoft/URLFormat.yml +9 -0
  79. package/styles/Microsoft/Units.yml +16 -0
  80. package/styles/Microsoft/Vocab.yml +25 -0
  81. package/styles/Microsoft/We.yml +11 -0
  82. package/styles/Microsoft/Wordiness.yml +127 -0
  83. package/styles/Microsoft/meta.json +4 -0
  84. package/styles/alex/Ablist.yml +245 -0
  85. package/styles/alex/Condescending.yml +16 -0
  86. package/styles/alex/Gendered.yml +108 -0
  87. package/styles/alex/LGBTQ.yml +55 -0
  88. package/styles/alex/OCD.yml +10 -0
  89. package/styles/alex/Press.yml +11 -0
  90. package/styles/alex/ProfanityLikely.yml +1289 -0
  91. package/styles/alex/ProfanityMaybe.yml +282 -0
  92. package/styles/alex/ProfanityUnlikely.yml +251 -0
  93. package/styles/alex/README.md +27 -0
  94. package/styles/alex/Race.yml +83 -0
  95. package/styles/alex/Suicide.yml +24 -0
  96. package/styles/alex/meta.json +4 -0
  97. package/styles/config/vocabularies/Docs/accept.txt +6 -0
  98. package/styles/proselint/Airlinese.yml +8 -0
  99. package/styles/proselint/AnimalLabels.yml +48 -0
  100. package/styles/proselint/Annotations.yml +9 -0
  101. package/styles/proselint/Apologizing.yml +8 -0
  102. package/styles/proselint/Archaisms.yml +52 -0
  103. package/styles/proselint/But.yml +8 -0
  104. package/styles/proselint/Cliches.yml +782 -0
  105. package/styles/proselint/CorporateSpeak.yml +30 -0
  106. package/styles/proselint/Currency.yml +5 -0
  107. package/styles/proselint/Cursing.yml +15 -0
  108. package/styles/proselint/DateCase.yml +7 -0
  109. package/styles/proselint/DateMidnight.yml +7 -0
  110. package/styles/proselint/DateRedundancy.yml +10 -0
  111. package/styles/proselint/DateSpacing.yml +7 -0
  112. package/styles/proselint/DenizenLabels.yml +52 -0
  113. package/styles/proselint/Diacritical.yml +95 -0
  114. package/styles/proselint/GenderBias.yml +45 -0
  115. package/styles/proselint/GroupTerms.yml +39 -0
  116. package/styles/proselint/Hedging.yml +8 -0
  117. package/styles/proselint/Hyperbole.yml +6 -0
  118. package/styles/proselint/Jargon.yml +11 -0
  119. package/styles/proselint/LGBTOffensive.yml +13 -0
  120. package/styles/proselint/LGBTTerms.yml +15 -0
  121. package/styles/proselint/Malapropisms.yml +8 -0
  122. package/styles/proselint/Needless.yml +358 -0
  123. package/styles/proselint/Nonwords.yml +38 -0
  124. package/styles/proselint/Oxymorons.yml +22 -0
  125. package/styles/proselint/P-Value.yml +6 -0
  126. package/styles/proselint/RASSyndrome.yml +30 -0
  127. package/styles/proselint/README.md +12 -0
  128. package/styles/proselint/Skunked.yml +13 -0
  129. package/styles/proselint/Spelling.yml +17 -0
  130. package/styles/proselint/Typography.yml +11 -0
  131. package/styles/proselint/Uncomparables.yml +50 -0
  132. package/styles/proselint/Very.yml +6 -0
  133. package/styles/proselint/meta.json +17 -0
  134. package/styles/write-good/Cliches.yml +702 -0
  135. package/styles/write-good/E-Prime.yml +32 -0
  136. package/styles/write-good/Illusions.yml +11 -0
  137. package/styles/write-good/Passive.yml +183 -0
  138. package/styles/write-good/README.md +27 -0
  139. package/styles/write-good/So.yml +5 -0
  140. package/styles/write-good/ThereIs.yml +6 -0
  141. package/styles/write-good/TooWordy.yml +221 -0
  142. package/styles/write-good/Weasel.yml +29 -0
  143. package/styles/write-good/meta.json +4 -0
  144. package/testdriver/testdriver_2025-04-17T16-04-30-454Z.yaml +6 -0
  145. package/vale.ini +18 -0
  146. package/docs/guide/setup-teardown.mdx +0 -162
  147. package/docs/reference/interactive/assert.mdx +0 -0
  148. /package/{docs/reference/commands/scroll.mdx → styles/config/vocabularies/Docs/reject.txt} +0 -0
@@ -0,0 +1,11 @@
1
+ extends: repetition
2
+ message: "'%s' is repeated!"
3
+ level: warning
4
+ alpha: true
5
+ action:
6
+ name: edit
7
+ params:
8
+ - truncate
9
+ - " "
10
+ tokens:
11
+ - '[^\s]+'
@@ -0,0 +1,183 @@
1
+ extends: existence
2
+ message: "'%s' may be passive voice. Use active voice if you can."
3
+ ignorecase: true
4
+ level: warning
5
+ raw:
6
+ - \b(am|are|were|being|is|been|was|be)\b\s*
7
+ tokens:
8
+ - '[\w]+ed'
9
+ - awoken
10
+ - beat
11
+ - become
12
+ - been
13
+ - begun
14
+ - bent
15
+ - beset
16
+ - bet
17
+ - bid
18
+ - bidden
19
+ - bitten
20
+ - bled
21
+ - blown
22
+ - born
23
+ - bought
24
+ - bound
25
+ - bred
26
+ - broadcast
27
+ - broken
28
+ - brought
29
+ - built
30
+ - burnt
31
+ - burst
32
+ - cast
33
+ - caught
34
+ - chosen
35
+ - clung
36
+ - come
37
+ - cost
38
+ - crept
39
+ - cut
40
+ - dealt
41
+ - dived
42
+ - done
43
+ - drawn
44
+ - dreamt
45
+ - driven
46
+ - drunk
47
+ - dug
48
+ - eaten
49
+ - fallen
50
+ - fed
51
+ - felt
52
+ - fit
53
+ - fled
54
+ - flown
55
+ - flung
56
+ - forbidden
57
+ - foregone
58
+ - forgiven
59
+ - forgotten
60
+ - forsaken
61
+ - fought
62
+ - found
63
+ - frozen
64
+ - given
65
+ - gone
66
+ - gotten
67
+ - ground
68
+ - grown
69
+ - heard
70
+ - held
71
+ - hidden
72
+ - hit
73
+ - hung
74
+ - hurt
75
+ - kept
76
+ - knelt
77
+ - knit
78
+ - known
79
+ - laid
80
+ - lain
81
+ - leapt
82
+ - learnt
83
+ - led
84
+ - left
85
+ - lent
86
+ - let
87
+ - lighted
88
+ - lost
89
+ - made
90
+ - meant
91
+ - met
92
+ - misspelt
93
+ - mistaken
94
+ - mown
95
+ - overcome
96
+ - overdone
97
+ - overtaken
98
+ - overthrown
99
+ - paid
100
+ - pled
101
+ - proven
102
+ - put
103
+ - quit
104
+ - read
105
+ - rid
106
+ - ridden
107
+ - risen
108
+ - run
109
+ - rung
110
+ - said
111
+ - sat
112
+ - sawn
113
+ - seen
114
+ - sent
115
+ - set
116
+ - sewn
117
+ - shaken
118
+ - shaven
119
+ - shed
120
+ - shod
121
+ - shone
122
+ - shorn
123
+ - shot
124
+ - shown
125
+ - shrunk
126
+ - shut
127
+ - slain
128
+ - slept
129
+ - slid
130
+ - slit
131
+ - slung
132
+ - smitten
133
+ - sold
134
+ - sought
135
+ - sown
136
+ - sped
137
+ - spent
138
+ - spilt
139
+ - spit
140
+ - split
141
+ - spoken
142
+ - spread
143
+ - sprung
144
+ - spun
145
+ - stolen
146
+ - stood
147
+ - stridden
148
+ - striven
149
+ - struck
150
+ - strung
151
+ - stuck
152
+ - stung
153
+ - stunk
154
+ - sung
155
+ - sunk
156
+ - swept
157
+ - swollen
158
+ - sworn
159
+ - swum
160
+ - swung
161
+ - taken
162
+ - taught
163
+ - thought
164
+ - thrived
165
+ - thrown
166
+ - thrust
167
+ - told
168
+ - torn
169
+ - trodden
170
+ - understood
171
+ - upheld
172
+ - upset
173
+ - wed
174
+ - wept
175
+ - withheld
176
+ - withstood
177
+ - woken
178
+ - won
179
+ - worn
180
+ - wound
181
+ - woven
182
+ - written
183
+ - wrung
@@ -0,0 +1,27 @@
1
+ Based on [write-good](https://github.com/btford/write-good).
2
+
3
+ > Naive linter for English prose for developers who can't write good and wanna learn to do other stuff good too.
4
+
5
+ ```
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2014 Brian Ford
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ ```
@@ -0,0 +1,5 @@
1
+ extends: existence
2
+ message: "Don't start a sentence with '%s'."
3
+ level: error
4
+ raw:
5
+ - '(?:[;-]\s)so[\s,]|\bSo[\s,]'
@@ -0,0 +1,6 @@
1
+ extends: existence
2
+ message: "Don't start a sentence with '%s'."
3
+ ignorecase: false
4
+ level: error
5
+ raw:
6
+ - '(?:[;-]\s)There\s(is|are)|\bThere\s(is|are)\b'
@@ -0,0 +1,221 @@
1
+ extends: existence
2
+ message: "'%s' is too wordy."
3
+ ignorecase: true
4
+ level: warning
5
+ tokens:
6
+ - a number of
7
+ - abundance
8
+ - accede to
9
+ - accelerate
10
+ - accentuate
11
+ - accompany
12
+ - accomplish
13
+ - accorded
14
+ - accrue
15
+ - acquiesce
16
+ - acquire
17
+ - additional
18
+ - adjacent to
19
+ - adjustment
20
+ - admissible
21
+ - advantageous
22
+ - adversely impact
23
+ - advise
24
+ - aforementioned
25
+ - aggregate
26
+ - aircraft
27
+ - all of
28
+ - all things considered
29
+ - alleviate
30
+ - allocate
31
+ - along the lines of
32
+ - already existing
33
+ - alternatively
34
+ - amazing
35
+ - ameliorate
36
+ - anticipate
37
+ - apparent
38
+ - appreciable
39
+ - as a matter of fact
40
+ - as a means of
41
+ - as far as I'm concerned
42
+ - as of yet
43
+ - as to
44
+ - as yet
45
+ - ascertain
46
+ - assistance
47
+ - at the present time
48
+ - at this time
49
+ - attain
50
+ - attributable to
51
+ - authorize
52
+ - because of the fact that
53
+ - belated
54
+ - benefit from
55
+ - bestow
56
+ - by means of
57
+ - by virtue of
58
+ - by virtue of the fact that
59
+ - cease
60
+ - close proximity
61
+ - commence
62
+ - comply with
63
+ - concerning
64
+ - consequently
65
+ - consolidate
66
+ - constitutes
67
+ - demonstrate
68
+ - depart
69
+ - designate
70
+ - discontinue
71
+ - due to the fact that
72
+ - each and every
73
+ - economical
74
+ - eliminate
75
+ - elucidate
76
+ - employ
77
+ - endeavor
78
+ - enumerate
79
+ - equitable
80
+ - equivalent
81
+ - evaluate
82
+ - evidenced
83
+ - exclusively
84
+ - expedite
85
+ - expend
86
+ - expiration
87
+ - facilitate
88
+ - factual evidence
89
+ - feasible
90
+ - finalize
91
+ - first and foremost
92
+ - for all intents and purposes
93
+ - for the most part
94
+ - for the purpose of
95
+ - forfeit
96
+ - formulate
97
+ - have a tendency to
98
+ - honest truth
99
+ - however
100
+ - if and when
101
+ - impacted
102
+ - implement
103
+ - in a manner of speaking
104
+ - in a timely manner
105
+ - in a very real sense
106
+ - in accordance with
107
+ - in addition
108
+ - in all likelihood
109
+ - in an effort to
110
+ - in between
111
+ - in excess of
112
+ - in lieu of
113
+ - in light of the fact that
114
+ - in many cases
115
+ - in my opinion
116
+ - in order to
117
+ - in regard to
118
+ - in some instances
119
+ - in terms of
120
+ - in the case of
121
+ - in the event that
122
+ - in the final analysis
123
+ - in the nature of
124
+ - in the near future
125
+ - in the process of
126
+ - inception
127
+ - incumbent upon
128
+ - indicate
129
+ - indication
130
+ - initiate
131
+ - irregardless
132
+ - is applicable to
133
+ - is authorized to
134
+ - is responsible for
135
+ - it is
136
+ - it is essential
137
+ - it seems that
138
+ - it was
139
+ - magnitude
140
+ - maximum
141
+ - methodology
142
+ - minimize
143
+ - minimum
144
+ - modify
145
+ - monitor
146
+ - multiple
147
+ - necessitate
148
+ - nevertheless
149
+ - not certain
150
+ - not many
151
+ - not often
152
+ - not unless
153
+ - not unlike
154
+ - notwithstanding
155
+ - null and void
156
+ - numerous
157
+ - objective
158
+ - obligate
159
+ - obtain
160
+ - on the contrary
161
+ - on the other hand
162
+ - one particular
163
+ - optimum
164
+ - overall
165
+ - owing to the fact that
166
+ - participate
167
+ - particulars
168
+ - pass away
169
+ - pertaining to
170
+ - point in time
171
+ - portion
172
+ - possess
173
+ - preclude
174
+ - previously
175
+ - prior to
176
+ - prioritize
177
+ - procure
178
+ - proficiency
179
+ - provided that
180
+ - purchase
181
+ - put simply
182
+ - readily apparent
183
+ - refer back
184
+ - regarding
185
+ - relocate
186
+ - remainder
187
+ - remuneration
188
+ - requirement
189
+ - reside
190
+ - residence
191
+ - retain
192
+ - satisfy
193
+ - shall
194
+ - should you wish
195
+ - similar to
196
+ - solicit
197
+ - span across
198
+ - strategize
199
+ - subsequent
200
+ - substantial
201
+ - successfully complete
202
+ - sufficient
203
+ - terminate
204
+ - the month of
205
+ - the point I am trying to make
206
+ - therefore
207
+ - time period
208
+ - took advantage of
209
+ - transmit
210
+ - transpire
211
+ - type of
212
+ - until such time as
213
+ - utilization
214
+ - utilize
215
+ - validate
216
+ - various different
217
+ - what I mean to say is
218
+ - whether or not
219
+ - with respect to
220
+ - with the exception of
221
+ - witnessed
@@ -0,0 +1,29 @@
1
+ extends: existence
2
+ message: "'%s' is a weasel word!"
3
+ ignorecase: true
4
+ level: warning
5
+ tokens:
6
+ - clearly
7
+ - completely
8
+ - exceedingly
9
+ - excellent
10
+ - extremely
11
+ - fairly
12
+ - huge
13
+ - interestingly
14
+ - is a number
15
+ - largely
16
+ - mostly
17
+ - obviously
18
+ - quite
19
+ - relatively
20
+ - remarkably
21
+ - several
22
+ - significantly
23
+ - substantially
24
+ - surprisingly
25
+ - tiny
26
+ - usually
27
+ - various
28
+ - vast
29
+ - very
@@ -0,0 +1,4 @@
1
+ {
2
+ "feed": "https://github.com/errata-ai/write-good/releases.atom",
3
+ "vale_version": ">=1.0.0"
4
+ }
@@ -0,0 +1,6 @@
1
+ version: 5.3.13
2
+ session: 680126994a12078ae2a74ee5
3
+ steps:
4
+ - prompt: /try log in
5
+ commands: []
6
+ A
package/vale.ini ADDED
@@ -0,0 +1,18 @@
1
+ StylesPath = styles
2
+
3
+ MinAlertLevel = suggestion
4
+
5
+ Packages = Microsoft, proselint, MDX
6
+
7
+ # Here's were we define the exceptions to use in *all*
8
+ # `BasedOnStyles`.
9
+ Vocab = Docs
10
+
11
+ [*]
12
+
13
+ [formats]
14
+ mdx = md
15
+
16
+ [*.mdx]
17
+ CommentDelimiters = {/*, */}
18
+ BasedOnStyles = Vale, Microsoft, proselint
@@ -1,162 +0,0 @@
1
- ---
2
- title: "Setup & Teardown"
3
- sidebarTitle: "Setup & Teardown"
4
- description: "Learn how to effectively describe and locate elements using TestDriver.ai's visual understanding capabilities."
5
- icon: "hammer"
6
- ---
7
-
8
-
9
- When running tests with **TestDriver.ai** in GitHub Actions, it's important to handle **setup** and **teardown** tasks properly. Setup tasks should be performed **before** the TestDriver.ai action (e.g., creating a new user via an API), and teardown tasks should be performed **after** the TestDriver.ai action, ensuring cleanup happens regardless of the test results.
10
-
11
- This guide explains how to structure your workflow to handle setup and teardown tasks effectively.
12
-
13
- ---
14
-
15
- ## Workflow Overview
16
-
17
- 1. **Setup Tasks**:
18
- - Use a dedicated action **before** the TestDriver.ai action to prepare the environment (e.g., create a test user via an API).
19
- - Pass the created user credentials to the TestDriver.ai action using environment variables.
20
-
21
- 2. **Run Tests**:
22
- - Execute the tests using TestDriver.ai, leveraging the setup data (e.g., the test user).
23
-
24
- 3. **Teardown Tasks**:
25
- - Use a dedicated action **after** the TestDriver.ai action to clean up (e.g., delete the test user).
26
- - Ensure the teardown step runs **no matter the result** of the TestDriver.ai action.
27
-
28
- ---
29
-
30
- ## Example Workflow with Setup and Teardown
31
-
32
- ### Workflow File: `.github/workflows/testdriver-setup-teardown.yml`
33
-
34
- ```yaml
35
- name: TestDriver.ai with Setup and Teardown
36
-
37
- on:
38
- push:
39
- branches:
40
- - main
41
- pull_request:
42
- workflow_dispatch:
43
-
44
- jobs:
45
- test:
46
- name: "TestDriver with Setup and Teardown"
47
- runs-on: ubuntu-latest
48
- steps:
49
- # Step 1: Check out the repository
50
- - name: Check out repository
51
- uses: actions/checkout@v2
52
-
53
- # Step 2: Setup - Create a test user via API
54
- - name: Setup Test User
55
- id: setup-user
56
- run: |
57
- echo "Creating test user via API..."
58
- RESPONSE=$(curl -X POST -H "Content-Type: application/json" -d '{"name": "Test User", "email": "test@example.com", "password": "password123"}' https://api.example.com/users)
59
- echo "USER_ID=$(echo $RESPONSE | jq -r '.id')" >> $GITHUB_ENV
60
- echo "USER_EMAIL=$(echo $RESPONSE | jq -r '.email')" >> $GITHUB_ENV
61
- echo "USER_PASSWORD=password123" >> $GITHUB_ENV
62
- env:
63
- API_KEY: ${{ secrets.API_KEY }}
64
-
65
- # Step 3: Run Tests with TestDriver.ai
66
- - name: Run Tests with TestDriver.ai
67
- uses: testdriverai/action@main
68
- with:
69
- key: ${{ secrets.TESTDRIVER_API_KEY }}
70
- prompt: |
71
- 1. Log in with the test user
72
- 2. Perform actions on the dashboard
73
- prerun: |
74
- echo "Launching browser with test user credentials..."
75
- echo "Email: $USER_EMAIL"
76
- echo "Password: $USER_PASSWORD"
77
- env:
78
- USER_EMAIL: ${{ env.USER_EMAIL }}
79
- USER_PASSWORD: ${{ env.USER_PASSWORD }}
80
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81
- FORCE_COLOR: "3"
82
-
83
- # Step 4: Teardown - Delete the test user
84
- - name: Teardown Test User
85
- if: always()
86
- run: |
87
- echo "Deleting test user via API..."
88
- curl -X DELETE -H "Authorization: Bearer ${{ secrets.API_KEY }}" https://api.example.com/users/$USER_ID
89
- echo "Test user deleted."
90
- env:
91
- USER_ID: ${{ env.USER_ID }}
92
- API_KEY: ${{ secrets.API_KEY }}```
93
-
94
-
95
- ---
96
-
97
- ## Workflow Steps Explained
98
-
99
- ### 1. **Setup Test User**
100
- - **Purpose**: Create a test user via an API before running the tests.
101
- - **How It Works**:
102
- - The `Setup Test User` step sends a `POST` request to the API to create a new user.
103
- - The user ID, email, and password are extracted from the API response and stored as environment variables (`USER_ID`, `USER_EMAIL`, `USER_PASSWORD`).
104
- - **Example Output**:
105
- - `USER_ID`: `12345`
106
- - `USER_EMAIL`: `test@example.com`
107
- - `USER_PASSWORD`: `password123`
108
-
109
- ---
110
-
111
- ### 2. **Run Tests with TestDriver.ai**
112
- - **Purpose**: Execute tests using the TestDriver.ai action.
113
- - **How It Works**:
114
- - The `USER_EMAIL` and `USER_PASSWORD` environment variables are passed to the `prerun` script.
115
- - The test prompts use these credentials to log in and perform actions.
116
-
117
- ---
118
-
119
- ### 3. **Teardown Test User**
120
- - **Purpose**: Delete the test user via an API after the tests are complete.
121
- - **How It Works**:
122
- - The `Teardown Test User` step sends a `DELETE` request to the API to remove the test user.
123
- - The `if: always()` condition ensures this step runs even if the TestDriver.ai action fails.
124
-
125
- ---
126
-
127
- ## Best Practices for Setup and Teardown
128
-
129
- 1. **Use APIs for Setup and Teardown**:
130
- - Use APIs to create and delete test data dynamically, ensuring a clean environment for each test run.
131
-
132
- 2. **Pass Data via Environment Variables**:
133
- - Store setup data (e.g., user credentials) in environment variables and pass them to the TestDriver.ai action.
134
-
135
- 3. **Ensure Teardown Always Runs**:
136
- - Use `if: always()` to ensure teardown tasks are executed regardless of the test results.
137
-
138
- 4. **Log Setup and Teardown Steps**:
139
- - Add `echo` statements to log the progress of setup and teardown tasks for easier debugging.
140
-
141
- 5. **Test Locally**:
142
- - Verify setup and teardown scripts locally before integrating them into the workflow.
143
-
144
- ---
145
-
146
- ## Example Use Cases
147
-
148
- ### 1. **User Management**
149
- - Create a test user during setup.
150
- - Delete the test user during teardown.
151
-
152
- ### 2. **Database Operations**
153
- - Insert test data into a database during setup.
154
- - Remove the test data during teardown.
155
-
156
- ### 3. **Mock Services**
157
- - Start a mock API server during setup.
158
- - Stop the mock server during teardown.
159
-
160
- ---
161
-
162
- By structuring your workflow to handle **setup** before the TestDriver.ai action and **teardown** after it, you can ensure a clean and reliable test environment for every run. This approach also ensures that teardown tasks are executed regardless of the test results, maintaining a consistent state for subsequent runs.
File without changes