@testspectra/cli 1.0.36 → 1.0.38
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/types/generator.js +1 -54
- package/package.json +1 -1
package/dist/types/generator.js
CHANGED
|
@@ -147,61 +147,8 @@ export class TypeGenerator {
|
|
|
147
147
|
content += `// Managed automatically by TestSpectra Language Service Plugin.\n\n`;
|
|
148
148
|
content += `/// <reference types="@wdio/globals/types" />\n`;
|
|
149
149
|
content += `/// <reference types="@wdio/mocha-framework" />\n`;
|
|
150
|
+
content += `/// <reference types="@testspectra/matchers" />\n`;
|
|
150
151
|
content += `/// <reference path="./fixtures.d.ts" />\n\n`;
|
|
151
|
-
content += `declare namespace WebdriverIO {\n`;
|
|
152
|
-
content += ` export interface InterceptFixtureOptions {\n`;
|
|
153
|
-
content += ` statusCode?: number;\n`;
|
|
154
|
-
content += ` headers?: Record<string, string>;\n`;
|
|
155
|
-
content += ` }\n`;
|
|
156
|
-
content += ` export interface InterceptFixtureObject<TData = unknown> {\n`;
|
|
157
|
-
content += ` statusCode?: number;\n`;
|
|
158
|
-
content += ` body: TData;\n`;
|
|
159
|
-
content += ` headers?: Record<string, string>;\n`;
|
|
160
|
-
content += ` }\n`;
|
|
161
|
-
content += ` export type InterceptInput<TData = unknown> = InterceptFixtureObject<TData> | TData | string;\n`;
|
|
162
|
-
content += ` interface Mock {\n`;
|
|
163
|
-
content += ` respondWith<TData = unknown>(fixture: InterceptInput<TData>, options?: InterceptFixtureOptions): Promise<void>;\n`;
|
|
164
|
-
content += ` }\n`;
|
|
165
|
-
content += ` interface Browser {\n`;
|
|
166
|
-
content += ` intercept<TData = unknown>(path: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', fixture?: InterceptInput<TData>, options?: InterceptFixtureOptions): Promise<Mock>;\n`;
|
|
167
|
-
content += ` shouldHaveUrl(expectedUrl: string): Promise<void>;\n`;
|
|
168
|
-
content += ` shouldContainUrl(expectedUrl: string): Promise<void>;\n`;
|
|
169
|
-
content += ` shouldHaveTitle(expectedTitle: string): Promise<void>;\n`;
|
|
170
|
-
content += ` shouldContainTitle(expectedTitle: string): Promise<void>;\n`;
|
|
171
|
-
content += ` }\n`;
|
|
172
|
-
content += ` interface Element {\n`;
|
|
173
|
-
content += ` shouldBeVisible(): Promise<Element>;\n`;
|
|
174
|
-
content += ` shouldNotBeVisible(): Promise<Element>;\n`;
|
|
175
|
-
content += ` shouldExist(): Promise<Element>;\n`;
|
|
176
|
-
content += ` shouldNotExist(): Promise<Element>;\n`;
|
|
177
|
-
content += ` shouldBeEnabled(): Promise<Element>;\n`;
|
|
178
|
-
content += ` shouldBeDisabled(): Promise<Element>;\n`;
|
|
179
|
-
content += ` shouldBeSelected(): Promise<Element>;\n`;
|
|
180
|
-
content += ` shouldBeChecked(): Promise<Element>;\n`;
|
|
181
|
-
content += ` shouldHaveValue(expectedValue: string): Promise<Element>;\n`;
|
|
182
|
-
content += ` shouldContainValue(expectedValue: string): Promise<Element>;\n`;
|
|
183
|
-
content += ` shouldHaveText(expectedText: string): Promise<Element>;\n`;
|
|
184
|
-
content += ` shouldContainText(expectedText: string): Promise<Element>;\n`;
|
|
185
|
-
content += ` shouldHaveClass(className: string): Promise<Element>;\n`;
|
|
186
|
-
content += ` shouldHaveAttribute(attributeName: string, expectedValue?: string): Promise<Element>;\n`;
|
|
187
|
-
content += ` }\n`;
|
|
188
|
-
content += `}\n\n`;
|
|
189
|
-
content += `interface Promise<T> {\n`;
|
|
190
|
-
content += ` shouldBeVisible(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
191
|
-
content += ` shouldNotBeVisible(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
192
|
-
content += ` shouldExist(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
193
|
-
content += ` shouldNotExist(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
194
|
-
content += ` shouldBeEnabled(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
195
|
-
content += ` shouldBeDisabled(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
196
|
-
content += ` shouldBeSelected(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
197
|
-
content += ` shouldBeChecked(this: Promise<WebdriverIO.Element>): Promise<WebdriverIO.Element>;\n`;
|
|
198
|
-
content += ` shouldHaveValue(this: Promise<WebdriverIO.Element>, expectedValue: string): Promise<WebdriverIO.Element>;\n`;
|
|
199
|
-
content += ` shouldContainValue(this: Promise<WebdriverIO.Element>, expectedValue: string): Promise<WebdriverIO.Element>;\n`;
|
|
200
|
-
content += ` shouldHaveText(this: Promise<WebdriverIO.Element>, expectedText: string): Promise<WebdriverIO.Element>;\n`;
|
|
201
|
-
content += ` shouldContainText(this: Promise<WebdriverIO.Element>, expectedText: string): Promise<WebdriverIO.Element>;\n`;
|
|
202
|
-
content += ` shouldHaveClass(this: Promise<WebdriverIO.Element>, className: string): Promise<WebdriverIO.Element>;\n`;
|
|
203
|
-
content += ` shouldHaveAttribute(this: Promise<WebdriverIO.Element>, attributeName: string, expectedValue?: string): Promise<WebdriverIO.Element>;\n`;
|
|
204
|
-
content += `}\n\n`;
|
|
205
152
|
// 1. Page Objects Global Declarations
|
|
206
153
|
const declaredPOMs = new Set();
|
|
207
154
|
for (const poDir of poDirs) {
|