@testspectra/cli 1.0.7 → 1.0.10
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/commands/init.js +58 -398
- package/dist/commands/run.js +18 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +8 -1
- package/templates/default/actions/applyDiscount/mobile.action.ts +6 -0
- package/templates/default/actions/applyDiscount/web.action.ts +6 -0
- package/templates/default/actions/verifyOtp/mobile.action.ts +6 -0
- package/templates/default/actions/verifyOtp/web.action.ts +6 -0
- package/templates/default/fixtures/couponCode.json +1 -0
- package/templates/default/fixtures/searchQuery.json +1 -0
- package/templates/default/fixtures/userData.json +1 -0
- package/templates/default/global-hooks/before.web.hook.ts +4 -0
- package/templates/default/package.json +18 -0
- package/templates/default/page-objects/LoginPage/mobile.ts +32 -0
- package/templates/default/page-objects/LoginPage/web.ts +32 -0
- package/templates/default/page-objects/ProductPage/mobile.ts +39 -0
- package/templates/default/page-objects/ProductPage/web.ts +38 -0
- package/templates/default/page-objects/SettingsPage/common.ts +26 -0
- package/templates/default/spectra.config.ts +61 -0
- package/templates/default/steps/loginUser/mobile.step.ts +4 -0
- package/templates/default/steps/loginUser/web.step.ts +4 -0
- package/templates/default/steps/searchProduct/mobile.step.ts +5 -0
- package/templates/default/steps/searchProduct/web.step.ts +5 -0
- package/templates/default/suites/Auth/TC-AUTH-01/android.test.ts +6 -0
- package/templates/default/suites/Auth/TC-AUTH-01/ios.test.ts +6 -0
- package/templates/default/suites/Auth/TC-AUTH-01/web.test.ts +13 -0
- package/templates/default/suites/Auth/TC-AUTH-02/android.test.ts +5 -0
- package/templates/default/suites/Auth/TC-AUTH-02/web.test.ts +5 -0
- package/templates/default/suites/Auth/hooks/before.android.hook.ts +3 -0
- package/templates/default/suites/Auth/hooks/before.ios.hook.ts +3 -0
- package/templates/default/suites/Auth/hooks/before.web.hook.ts +3 -0
- package/templates/default/suites/Product/TC-PROD-01/mobile.test.ts +8 -0
- package/templates/default/suites/Product/TC-PROD-01/web.test.ts +8 -0
- package/templates/default/suites/Product/TC-PROD-02/mobile.test.ts +6 -0
- package/templates/default/suites/Product/TC-PROD-02/web.test.ts +6 -0
- package/templates/default/suites/Product/hooks/before.web.hook.ts +3 -0
- package/templates/default/suites/Settings/TC-SET-01/common.test.ts +8 -0
- package/templates/default/tsconfig.android.json +39 -0
- package/templates/default/tsconfig.ios.json +39 -0
- package/templates/default/tsconfig.json +20 -0
- package/templates/default/tsconfig.web.json +45 -0
- package/CLI_IMPLEMENTATION_PLAN.md +0 -369
- package/src/commands/devices.ts +0 -41
- package/src/commands/doctor.ts +0 -57
- package/src/commands/init.ts +0 -470
- package/src/commands/run.ts +0 -102
- package/src/config/loader.ts +0 -82
- package/src/config/schema.ts +0 -489
- package/src/index.ts +0 -56
- package/src/plugin.ts +0 -81
- package/src/runner/bridge.ts +0 -146
- package/src/runner/reporter.ts +0 -64
- package/src/step/index.ts +0 -6
- package/src/step/matchers.ts +0 -131
- package/src/step/proto.ts +0 -163
- package/src/step/runner/collection.ts +0 -73
- package/src/step/runner/single.ts +0 -166
- package/src/step/spectra.ts +0 -185
- package/src/step/types.ts +0 -113
- package/src/types/generator.ts +0 -240
- package/src/types/webdriverio.d.ts +0 -46
- package/testspectra-cli-1.0.5.tgz +0 -0
- package/testspectra-cli-1.0.6.tgz +0 -0
- package/testspectra-cli-1.0.7.tgz +0 -0
- package/tsconfig.json +0 -17
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default class LoginPage {
|
|
2
|
+
static get usernameInput(): ChainablePromiseElement {
|
|
3
|
+
return $('#username');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static get passwordInput(): ChainablePromiseElement {
|
|
7
|
+
return $('#password');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static get rememberMeCheckbox(): ChainablePromiseElement {
|
|
11
|
+
return $('#remember-me');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get submitButton(): ChainablePromiseElement {
|
|
15
|
+
return $('button[type="submit"]');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static get flashAlert(): ChainablePromiseElement {
|
|
19
|
+
return $('#flash');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static async open() {
|
|
23
|
+
await Spectra.navigate('/login');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static async login(username: string, pass: string) {
|
|
27
|
+
await Spectra.waitForElement(this.usernameInput);
|
|
28
|
+
await Spectra.type(this.usernameInput, username, { clearFirst: true });
|
|
29
|
+
await Spectra.type(this.passwordInput, pass, { clearFirst: true });
|
|
30
|
+
await Spectra.click(this.submitButton);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default class ProductPage {
|
|
2
|
+
static get searchInput(): ChainablePromiseElement {
|
|
3
|
+
return $('~search_input');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static get categorySelect(): ChainablePromiseElement {
|
|
7
|
+
return $('~category_picker');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static get productList(): ChainablePromiseElement {
|
|
11
|
+
return $('~product_list');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get firstProductCard(): ChainablePromiseElement {
|
|
15
|
+
return $('~product_item_0');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static get addToCartButton(): ChainablePromiseElement {
|
|
19
|
+
return $('~btn_add_to_cart');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static get cartBadge(): ChainablePromiseElement {
|
|
23
|
+
return $('~cart_badge');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static async open() {
|
|
27
|
+
// Mobile in-app navigation to products tab
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static async filterByCategory(category: string) {
|
|
31
|
+
await Spectra.click(this.categorySelect);
|
|
32
|
+
await Spectra.click(`~option_${category}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static async addFirstProductToCart() {
|
|
36
|
+
await Spectra.swipe({ direction: "down", distance: 400 });
|
|
37
|
+
await Spectra.click(this.addToCartButton);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default class ProductPage {
|
|
2
|
+
static get searchInput(): ChainablePromiseElement {
|
|
3
|
+
return $('#search-input');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static get categorySelect(): ChainablePromiseElement {
|
|
7
|
+
return $('#category-select');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static get productList(): ChainablePromiseElement {
|
|
11
|
+
return $('#product-grid');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get firstProductCard(): ChainablePromiseElement {
|
|
15
|
+
return $('.product-card');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static get addToCartButton(): ChainablePromiseElement {
|
|
19
|
+
return $('#add-to-cart');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static get cartBadge(): ChainablePromiseElement {
|
|
23
|
+
return $('#cart-count');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static async open() {
|
|
27
|
+
await Spectra.navigate('/products');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static async filterByCategory(category: string) {
|
|
31
|
+
await Spectra.select(this.categorySelect, category);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static async addFirstProductToCart() {
|
|
35
|
+
await Spectra.scroll({ selector: this.firstProductCard });
|
|
36
|
+
await Spectra.click(this.addToCartButton);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default class SettingsPage {
|
|
2
|
+
static get darkModeToggle(): ChainablePromiseElement {
|
|
3
|
+
return $('[data-testid="dark-mode-toggle"]');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
static get languageDropdown(): ChainablePromiseElement {
|
|
7
|
+
return $('[data-testid="language-select"]');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static get saveButton(): ChainablePromiseElement {
|
|
11
|
+
return $('[data-testid="save-settings"]');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get statusMessage(): ChainablePromiseElement {
|
|
15
|
+
return $('[data-testid="status-message"]');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static async open() {
|
|
19
|
+
await Spectra.navigate('/settings');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static async toggleDarkMode() {
|
|
23
|
+
await Spectra.click(this.darkModeToggle);
|
|
24
|
+
await Spectra.click(this.saveButton);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defineConfig } from "@testspectra/cli";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
webConfig: {
|
|
5
|
+
baseUrl: "https://the-internet.herokuapp.com",
|
|
6
|
+
maxConcurrentSessions: "1",
|
|
7
|
+
headlessMode: true,
|
|
8
|
+
implicitWait: "5000",
|
|
9
|
+
pageLoadTimeout: "30000",
|
|
10
|
+
scriptTimeout: "30000",
|
|
11
|
+
parallelizationMode: "testcase",
|
|
12
|
+
},
|
|
13
|
+
browsers: [
|
|
14
|
+
{
|
|
15
|
+
id: "chrome-desktop",
|
|
16
|
+
type: "chrome",
|
|
17
|
+
mobileEmulation: false,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
androidConfig: {
|
|
21
|
+
appiumServer: "http://127.0.0.1:4723",
|
|
22
|
+
platformName: "Android",
|
|
23
|
+
platformVersion: "13",
|
|
24
|
+
deviceName: "emulator-5554",
|
|
25
|
+
automationName: "UiAutomator2",
|
|
26
|
+
appPackage: "",
|
|
27
|
+
appActivity: "",
|
|
28
|
+
autoGrantPermissions: true,
|
|
29
|
+
noReset: false,
|
|
30
|
+
implicitWait: "10000",
|
|
31
|
+
parallelizationMode: "suite",
|
|
32
|
+
},
|
|
33
|
+
iosConfig: {
|
|
34
|
+
appiumServer: "http://127.0.0.1:4723",
|
|
35
|
+
platformName: "iOS",
|
|
36
|
+
platformVersion: "16.0",
|
|
37
|
+
deviceName: "iPhone 14",
|
|
38
|
+
automationName: "XCUITest",
|
|
39
|
+
bundleId: "",
|
|
40
|
+
udid: "auto",
|
|
41
|
+
xcodeOrgId: "",
|
|
42
|
+
xcodeSigningId: "iPhone Developer",
|
|
43
|
+
autoAcceptAlerts: true,
|
|
44
|
+
noReset: false,
|
|
45
|
+
implicitWait: "10000",
|
|
46
|
+
parallelizationMode: "suite",
|
|
47
|
+
},
|
|
48
|
+
loadConfig: {
|
|
49
|
+
virtualUsers: "10",
|
|
50
|
+
duration: "1m",
|
|
51
|
+
},
|
|
52
|
+
loadStages: [],
|
|
53
|
+
thresholds: [],
|
|
54
|
+
executionConfig: {
|
|
55
|
+
networkMonitoringEnabled: true,
|
|
56
|
+
fastResponseTime: "200",
|
|
57
|
+
normalResponseTime: "1000",
|
|
58
|
+
monitoredDomains: [],
|
|
59
|
+
environmentVariables: [],
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
it("should authenticate user and verify flash message across specific platforms", async () => {
|
|
2
|
+
await browser.intercept("/api/status", "GET", Fixture.userData);
|
|
3
|
+
|
|
4
|
+
// 1. Navigation via Page Object
|
|
5
|
+
await LoginPage.open();
|
|
6
|
+
|
|
7
|
+
// 2. High-level business flow via Shared Step & Page Object
|
|
8
|
+
await Step.loginUser("tomsmith", "SuperSecretPassword!");
|
|
9
|
+
|
|
10
|
+
// 3. Direct callable assertion on Page Object element
|
|
11
|
+
await LoginPage.flashAlert.shouldBeVisible();
|
|
12
|
+
await LoginPage.flashAlert.shouldContainText("You logged into a secure area!");
|
|
13
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
it("should filter products by category and add to cart on Mobile (Android & iOS)", async () => {
|
|
2
|
+
await ProductPage.open();
|
|
3
|
+
await ProductPage.filterByCategory("Electronics");
|
|
4
|
+
await ProductPage.addFirstProductToCart();
|
|
5
|
+
|
|
6
|
+
await ProductPage.cartBadge.shouldBeVisible();
|
|
7
|
+
await ProductPage.cartBadge.shouldHaveText("1");
|
|
8
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
it("should filter products by category and add to cart on Web", async () => {
|
|
2
|
+
await ProductPage.open();
|
|
3
|
+
await ProductPage.filterByCategory("Electronics");
|
|
4
|
+
await ProductPage.addFirstProductToCart();
|
|
5
|
+
|
|
6
|
+
await ProductPage.cartBadge.shouldBeVisible();
|
|
7
|
+
await ProductPage.cartBadge.shouldHaveText("1");
|
|
8
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
it("should toggle dark mode setting across all platforms (Common)", async () => {
|
|
2
|
+
await SettingsPage.open();
|
|
3
|
+
await SettingsPage.darkModeToggle.shouldBeVisible();
|
|
4
|
+
await SettingsPage.toggleDarkMode();
|
|
5
|
+
|
|
6
|
+
await SettingsPage.statusMessage.shouldBeVisible();
|
|
7
|
+
await SettingsPage.statusMessage.shouldContainText("Settings saved");
|
|
8
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"]
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
".testspectra/types/android.d.ts",
|
|
14
|
+
".testspectra/types/fixtures.d.ts",
|
|
15
|
+
"page-objects/**/*.ts",
|
|
16
|
+
"steps/**/*.ts",
|
|
17
|
+
"actions/**/*.ts",
|
|
18
|
+
"global-hooks/**/*.ts",
|
|
19
|
+
"suites/**/hooks/**/*.ts",
|
|
20
|
+
"suites/**/*.ts",
|
|
21
|
+
"spectra.config.ts"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist",
|
|
26
|
+
"page-objects/**/web.ts",
|
|
27
|
+
"page-objects/**/ios.ts",
|
|
28
|
+
"steps/**/web.step.ts",
|
|
29
|
+
"steps/**/ios.step.ts",
|
|
30
|
+
"actions/**/web.action.ts",
|
|
31
|
+
"actions/**/ios.action.ts",
|
|
32
|
+
"global-hooks/**/web.hook.ts",
|
|
33
|
+
"global-hooks/**/ios.hook.ts",
|
|
34
|
+
"suites/**/hooks/**/web.hook.ts",
|
|
35
|
+
"suites/**/hooks/**/ios.hook.ts",
|
|
36
|
+
"suites/**/web.test.ts",
|
|
37
|
+
"suites/**/ios.test.ts"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"]
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
".testspectra/types/ios.d.ts",
|
|
14
|
+
".testspectra/types/fixtures.d.ts",
|
|
15
|
+
"page-objects/**/*.ts",
|
|
16
|
+
"steps/**/*.ts",
|
|
17
|
+
"actions/**/*.ts",
|
|
18
|
+
"global-hooks/**/*.ts",
|
|
19
|
+
"suites/**/hooks/**/*.ts",
|
|
20
|
+
"suites/**/*.ts",
|
|
21
|
+
"spectra.config.ts"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist",
|
|
26
|
+
"page-objects/**/web.ts",
|
|
27
|
+
"page-objects/**/android.ts",
|
|
28
|
+
"steps/**/web.step.ts",
|
|
29
|
+
"steps/**/android.step.ts",
|
|
30
|
+
"actions/**/web.action.ts",
|
|
31
|
+
"actions/**/android.action.ts",
|
|
32
|
+
"global-hooks/**/web.hook.ts",
|
|
33
|
+
"global-hooks/**/android.hook.ts",
|
|
34
|
+
"suites/**/hooks/**/web.hook.ts",
|
|
35
|
+
"suites/**/hooks/**/android.hook.ts",
|
|
36
|
+
"suites/**/web.test.ts",
|
|
37
|
+
"suites/**/android.test.ts"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"],
|
|
7
|
+
"plugins": [
|
|
8
|
+
{ "name": "@testspectra/cli" }
|
|
9
|
+
],
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"noEmit": true
|
|
13
|
+
},
|
|
14
|
+
"files": [],
|
|
15
|
+
"references": [
|
|
16
|
+
{ "path": "./tsconfig.web.json" },
|
|
17
|
+
{ "path": "./tsconfig.android.json" },
|
|
18
|
+
{ "path": "./tsconfig.ios.json" }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework"]
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
".testspectra/types/web.d.ts",
|
|
14
|
+
".testspectra/types/fixtures.d.ts",
|
|
15
|
+
"page-objects/**/*.ts",
|
|
16
|
+
"steps/**/*.ts",
|
|
17
|
+
"actions/**/*.ts",
|
|
18
|
+
"global-hooks/**/*.ts",
|
|
19
|
+
"suites/**/hooks/**/*.ts",
|
|
20
|
+
"suites/**/*.ts",
|
|
21
|
+
"spectra.config.ts"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist",
|
|
26
|
+
"page-objects/**/android.ts",
|
|
27
|
+
"page-objects/**/ios.ts",
|
|
28
|
+
"page-objects/**/mobile.ts",
|
|
29
|
+
"steps/**/android.step.ts",
|
|
30
|
+
"steps/**/ios.step.ts",
|
|
31
|
+
"steps/**/mobile.step.ts",
|
|
32
|
+
"actions/**/android.action.ts",
|
|
33
|
+
"actions/**/ios.action.ts",
|
|
34
|
+
"actions/**/mobile.action.ts",
|
|
35
|
+
"global-hooks/**/android.hook.ts",
|
|
36
|
+
"global-hooks/**/ios.hook.ts",
|
|
37
|
+
"global-hooks/**/mobile.hook.ts",
|
|
38
|
+
"suites/**/hooks/**/android.hook.ts",
|
|
39
|
+
"suites/**/hooks/**/ios.hook.ts",
|
|
40
|
+
"suites/**/hooks/**/mobile.hook.ts",
|
|
41
|
+
"suites/**/android.test.ts",
|
|
42
|
+
"suites/**/ios.test.ts",
|
|
43
|
+
"suites/**/mobile.test.ts"
|
|
44
|
+
]
|
|
45
|
+
}
|