@wix-pilot/webdriverio-appium 1.0.1 → 1.0.2
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/dist/index.js +39 -5
- package/dist/wdio.conf.d.ts +28 -0
- package/dist/wdio.conf.js +34 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99,31 +99,49 @@ class WebdriverIOAppiumFrameworkDriver {
|
|
|
99
99
|
signature: `$('~accessibilityId')`,
|
|
100
100
|
description: "Locate an element by its accessibility ID (commonly used in Appium).",
|
|
101
101
|
example: `const loginButton = await $('~loginButton'); // Accessibility ID`,
|
|
102
|
+
guidelines: [
|
|
103
|
+
"Always prefer using test IDs when available; if no ID is present, use another stable identifier.",
|
|
104
|
+
],
|
|
102
105
|
},
|
|
103
106
|
{
|
|
104
107
|
signature: `$('android=uiSelector')`,
|
|
105
108
|
description: "Locate an element using an Android UIAutomator selector.",
|
|
106
109
|
example: `const el = await $('android=new UiSelector().text("Login")');`,
|
|
110
|
+
guidelines: [
|
|
111
|
+
"For Android, use UIAutomator selectors to target elements by text, resource-id, or other properties. Ensure selectors are precise to avoid ambiguity.",
|
|
112
|
+
],
|
|
107
113
|
},
|
|
108
114
|
{
|
|
109
115
|
signature: `$('ios=predicateString')`,
|
|
110
116
|
description: "Locate an element using an iOS NSPredicate string.",
|
|
111
117
|
example: `const el = await $('ios=predicate string:type == "XCUIElementTypeButton" AND name == "Login"');`,
|
|
118
|
+
guidelines: [
|
|
119
|
+
"For iOS, use NSPredicate strings to define clear and concise conditions for element identification. Validate the predicate to ensure it uniquely identifies the element.",
|
|
120
|
+
],
|
|
112
121
|
},
|
|
113
122
|
{
|
|
114
123
|
signature: `$$('#elementSelector')`,
|
|
115
124
|
description: "Locate all elements with a given selector",
|
|
116
125
|
example: `const firstSite = await $$('#Site')[index];`,
|
|
126
|
+
guidelines: [
|
|
127
|
+
"Use this to select multiple elements. Make sure your selector targets a specific subset of elements to avoid excessive matches.",
|
|
128
|
+
],
|
|
117
129
|
},
|
|
118
130
|
{
|
|
119
131
|
signature: `$('//*[@text="Login"]')`,
|
|
120
132
|
description: "Locate an element using an XPath expression.",
|
|
121
133
|
example: `const el = await $('//*[@text="Login"]');`,
|
|
134
|
+
guidelines: [
|
|
135
|
+
"Use XPath as a last resort when other selectors are not available, as XPath can be slower and more brittle. Ensure your XPath expression is optimized for performance.",
|
|
136
|
+
],
|
|
122
137
|
},
|
|
123
138
|
{
|
|
124
139
|
signature: `$('#elementId'), $('elementTag'), $('.className')`,
|
|
125
140
|
description: "Web-like selectors (useful if your app is a hybrid or has a web context).",
|
|
126
141
|
example: `const el = await $('.someNativeClass');`,
|
|
142
|
+
guidelines: [
|
|
143
|
+
"Use web-like selectors in hybrid apps or web contexts. Ensure selectors are unique and adhere to best practices for CSS selectors.",
|
|
144
|
+
],
|
|
127
145
|
},
|
|
128
146
|
],
|
|
129
147
|
},
|
|
@@ -136,6 +154,9 @@ class WebdriverIOAppiumFrameworkDriver {
|
|
|
136
154
|
example: `
|
|
137
155
|
await (await $('~loginButton')).waitForEnabled();
|
|
138
156
|
await (await $('~loginButton')).click();`,
|
|
157
|
+
guidelines: [
|
|
158
|
+
"Before clicking on an element make sure it is enabled",
|
|
159
|
+
],
|
|
139
160
|
},
|
|
140
161
|
{
|
|
141
162
|
signature: `.setValue(value: string)`,
|
|
@@ -163,11 +184,6 @@ await (await $('~dragHandle')).touchAction([
|
|
|
163
184
|
]);
|
|
164
185
|
`,
|
|
165
186
|
},
|
|
166
|
-
{
|
|
167
|
-
signature: `.scrollIntoView() (web/hybrid context only)`,
|
|
168
|
-
description: "Scrolls the element into view (if in a web context).",
|
|
169
|
-
example: `await (await $('#someElement')).scrollIntoView();`,
|
|
170
|
-
},
|
|
171
187
|
{
|
|
172
188
|
signature: `.dragAndDrop(target, duration?)`,
|
|
173
189
|
description: "Drags the element to the target location (native or web context).",
|
|
@@ -187,31 +203,49 @@ await (await $('~draggable')).dragAndDrop(
|
|
|
187
203
|
signature: `toBeDisplayed()`,
|
|
188
204
|
description: "Asserts that the element is displayed (visible).",
|
|
189
205
|
example: `await expect(await $('~loginButton')).toBeDisplayed();`,
|
|
206
|
+
guidelines: [
|
|
207
|
+
"Use this matcher to verify that the element is visible to the user.",
|
|
208
|
+
],
|
|
190
209
|
},
|
|
191
210
|
{
|
|
192
211
|
signature: `toExist()`,
|
|
193
212
|
description: "Asserts that the element exists in the DOM/hierarchy.",
|
|
194
213
|
example: `await expect(await $('~usernameInput')).toExist();`,
|
|
214
|
+
guidelines: [
|
|
215
|
+
"Use this matcher to check that the element exists in the DOM or view hierarchy.",
|
|
216
|
+
],
|
|
195
217
|
},
|
|
196
218
|
{
|
|
197
219
|
signature: `toHaveText(text: string)`,
|
|
198
220
|
description: "Asserts that the element's text matches the given string.",
|
|
199
221
|
example: `await expect(await $('~welcomeMessage')).toHaveText('Welcome, user!');`,
|
|
222
|
+
guidelines: [
|
|
223
|
+
"Use this matcher to verify the text content of an element exactly matches the expected value.",
|
|
224
|
+
],
|
|
200
225
|
},
|
|
201
226
|
{
|
|
202
227
|
signature: `toHaveValue(value: string)`,
|
|
203
228
|
description: "Asserts that the element's value matches the given string (for inputs, etc.).",
|
|
204
229
|
example: `await expect(await $('~usernameInput')).toHaveValue('myusername');`,
|
|
230
|
+
guidelines: [
|
|
231
|
+
"Use this matcher for form elements to verify that the input value is correct.",
|
|
232
|
+
],
|
|
205
233
|
},
|
|
206
234
|
{
|
|
207
235
|
signature: `toBeEnabled() / toBeDisabled()`,
|
|
208
236
|
description: "Asserts that an element is enabled/disabled (if applicable).",
|
|
209
237
|
example: `await expect(await $('~submitButton')).toBeEnabled();`,
|
|
238
|
+
guidelines: [
|
|
239
|
+
"Use these matchers to assert that an element is enabled or disabled as required by the test scenario.",
|
|
240
|
+
],
|
|
210
241
|
},
|
|
211
242
|
{
|
|
212
243
|
signature: `not`,
|
|
213
244
|
description: "Negates the expectation.",
|
|
214
245
|
example: `await expect(await $('~spinner')).not.toBeDisplayed();`,
|
|
246
|
+
guidelines: [
|
|
247
|
+
"Use this matcher to invert the condition of any expectation, ensuring the element does not meet the specified criteria.",
|
|
248
|
+
],
|
|
215
249
|
},
|
|
216
250
|
],
|
|
217
251
|
},
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const config: {
|
|
2
|
+
runner: string;
|
|
3
|
+
specs: string[];
|
|
4
|
+
maxInstances: number;
|
|
5
|
+
capabilities: {
|
|
6
|
+
platformName: string;
|
|
7
|
+
deviceName: string;
|
|
8
|
+
automationName: string;
|
|
9
|
+
app: string;
|
|
10
|
+
}[];
|
|
11
|
+
logLevel: string;
|
|
12
|
+
bail: number;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
waitforTimeout: number;
|
|
15
|
+
connectionRetryTimeout: number;
|
|
16
|
+
connectionRetryCount: number;
|
|
17
|
+
services: string[];
|
|
18
|
+
appium: {
|
|
19
|
+
command: string;
|
|
20
|
+
};
|
|
21
|
+
framework: string;
|
|
22
|
+
reporters: string[];
|
|
23
|
+
mochaOpts: {
|
|
24
|
+
ui: string;
|
|
25
|
+
timeout: number;
|
|
26
|
+
};
|
|
27
|
+
before: () => void;
|
|
28
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
// wdio.conf.ts
|
|
5
|
+
exports.config = {
|
|
6
|
+
runner: 'local',
|
|
7
|
+
specs: ['./examples/**/*.test.ts'],
|
|
8
|
+
maxInstances: 1,
|
|
9
|
+
capabilities: [{
|
|
10
|
+
platformName: 'iOS',
|
|
11
|
+
deviceName: 'iPhone 14',
|
|
12
|
+
automationName: 'XCUITest',
|
|
13
|
+
app: './Users/tzviels/Library/Developer/Xcode/DerivedData/ExampleApp-ccggovixskkojadmtpriqiridvii/Build/Products/Debug-iphonesimulator/ExampleApp.app',
|
|
14
|
+
}],
|
|
15
|
+
logLevel: 'info',
|
|
16
|
+
bail: 0,
|
|
17
|
+
baseUrl: 'http://localhost',
|
|
18
|
+
waitforTimeout: 10000,
|
|
19
|
+
connectionRetryTimeout: 90000,
|
|
20
|
+
connectionRetryCount: 3,
|
|
21
|
+
services: ['appium'],
|
|
22
|
+
appium: {
|
|
23
|
+
command: 'appium',
|
|
24
|
+
},
|
|
25
|
+
framework: 'mocha',
|
|
26
|
+
reporters: ['spec'],
|
|
27
|
+
mochaOpts: {
|
|
28
|
+
ui: 'bdd',
|
|
29
|
+
timeout: 60000,
|
|
30
|
+
},
|
|
31
|
+
before: function () {
|
|
32
|
+
global.driver = browser;
|
|
33
|
+
},
|
|
34
|
+
};
|