@anddone/adminportaltestautomation 1.1.0
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/.github/workflows/npm-release.yml +79 -0
- package/.github/workflows/playwright.yml +27 -0
- package/anddone-adminportaltestautomation-1.0.0.tgz +0 -0
- package/anddone-adminportaltestautomation-1.0.3.tgz +0 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/HomePage.d.ts +28 -0
- package/dist/pages/HomePage.d.ts.map +1 -0
- package/dist/pages/HomePage.js +47 -0
- package/dist/pages/HomePage.js.map +1 -0
- package/dist/pages/LoginPage.d.ts +42 -0
- package/dist/pages/LoginPage.d.ts.map +1 -0
- package/dist/pages/LoginPage.js +112 -0
- package/dist/pages/LoginPage.js.map +1 -0
- package/dist/pages/PaymentPage.d.ts +97 -0
- package/dist/pages/PaymentPage.d.ts.map +1 -0
- package/dist/pages/PaymentPage.js +222 -0
- package/dist/pages/PaymentPage.js.map +1 -0
- package/dist/utils/authAPI.d.ts +34 -0
- package/dist/utils/authAPI.d.ts.map +1 -0
- package/dist/utils/authAPI.js +66 -0
- package/dist/utils/authAPI.js.map +1 -0
- package/dist/utils/credentials.d.ts +9 -0
- package/dist/utils/credentials.d.ts.map +1 -0
- package/dist/utils/credentials.js +12 -0
- package/dist/utils/credentials.js.map +1 -0
- package/package.json +26 -0
- package/playwright.config.ts +85 -0
- package/src/index.ts +3 -0
- package/src/pages/HomePage.ts +55 -0
- package/src/pages/LoginPage.ts +131 -0
- package/src/pages/PaymentPage.ts +272 -0
- package/src/utils/authAPI.ts +74 -0
- package/src/utils/credentials.ts +8 -0
- package/tests/login.spec.ts +51 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Release AdminPortalTestAutomation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
release_type:
|
|
7
|
+
description: "Release type (semantic versioning)"
|
|
8
|
+
required: true
|
|
9
|
+
default: patch
|
|
10
|
+
type: choice
|
|
11
|
+
options:
|
|
12
|
+
- patch
|
|
13
|
+
- minor
|
|
14
|
+
- major
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
release:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
# 1. Checkout repo
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
# 2. Setup Node
|
|
27
|
+
- uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: 18
|
|
30
|
+
registry-url: https://registry.npmjs.org/
|
|
31
|
+
|
|
32
|
+
# 3. Install dependencies
|
|
33
|
+
- run: npm ci
|
|
34
|
+
|
|
35
|
+
# 4. Build project
|
|
36
|
+
- run: npm run build
|
|
37
|
+
|
|
38
|
+
# 5. Configure Git for tag commit
|
|
39
|
+
- name: Configure Git
|
|
40
|
+
run: |
|
|
41
|
+
git config user.name "github-actions[bot]"
|
|
42
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
43
|
+
|
|
44
|
+
# 6. Bump version
|
|
45
|
+
- name: Bump version
|
|
46
|
+
run: |
|
|
47
|
+
npm version ${{ inputs.release_type }} -m "chore(release): %s"
|
|
48
|
+
|
|
49
|
+
# 7. Push commit + tag
|
|
50
|
+
- name: Push changes
|
|
51
|
+
run: |
|
|
52
|
+
git push origin master
|
|
53
|
+
git push origin --tags
|
|
54
|
+
|
|
55
|
+
# 8. Publish to npm
|
|
56
|
+
- name: Publish to npm
|
|
57
|
+
run: npm publish --access public
|
|
58
|
+
env:
|
|
59
|
+
NODE_AUTH_TOKEN: ${{ secrets.TestAutomationAuth }}
|
|
60
|
+
|
|
61
|
+
# 9. Slack Success Notification
|
|
62
|
+
- name: Slack Success
|
|
63
|
+
if: success()
|
|
64
|
+
run: |
|
|
65
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
66
|
+
curl -X POST -H 'Content-type: application/json' \
|
|
67
|
+
--data "{
|
|
68
|
+
\"username\": \"AdminPortalTestAutomation\",
|
|
69
|
+
\"text\": \":white_check_mark: npm package published!\n*Version:* $VERSION\n*Notes:*\n• Added fileCommonUtils\n• File handling methods\n• Supports text, XLSX, JSON\"
|
|
70
|
+
}" \
|
|
71
|
+
${{ secrets.SLACK_WEBHOOK_URL }}
|
|
72
|
+
|
|
73
|
+
# 10. Slack Failure Notification
|
|
74
|
+
- name: Slack Failure
|
|
75
|
+
if: failure()
|
|
76
|
+
run: |
|
|
77
|
+
curl -X POST -H 'Content-type: application/json' \
|
|
78
|
+
--data '{"text":":x: npm publish failed. Check GitHub Actions logs."}' \
|
|
79
|
+
${{ secrets.SLACK_WEBHOOK_URL }}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Playwright Tests
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ main, master ]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [ main, master ]
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
timeout-minutes: 60
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-node@v4
|
|
14
|
+
with:
|
|
15
|
+
node-version: lts/*
|
|
16
|
+
- name: Install dependencies
|
|
17
|
+
run: npm ci
|
|
18
|
+
- name: Install Playwright Browsers
|
|
19
|
+
run: npx playwright install --with-deps
|
|
20
|
+
- name: Run Playwright tests
|
|
21
|
+
run: npx playwright test
|
|
22
|
+
- uses: actions/upload-artifact@v4
|
|
23
|
+
if: ${{ !cancelled() }}
|
|
24
|
+
with:
|
|
25
|
+
name: playwright-report
|
|
26
|
+
path: playwright-report/
|
|
27
|
+
retention-days: 30
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./pages/LoginPage"), exports);
|
|
18
|
+
__exportStar(require("./pages/HomePage"), exports);
|
|
19
|
+
__exportStar(require("./pages/PaymentPage"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,sDAAoC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Page, Locator } from '@playwright/test';
|
|
2
|
+
export declare class HomePage {
|
|
3
|
+
readonly page: Page;
|
|
4
|
+
readonly logo: Locator;
|
|
5
|
+
readonly paymentsNavLink: Locator;
|
|
6
|
+
constructor(page: Page);
|
|
7
|
+
/**
|
|
8
|
+
* Verify that the homepage logo is displayed
|
|
9
|
+
*/
|
|
10
|
+
isLogoDisplayed(): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Assert that the logo is visible
|
|
13
|
+
*/
|
|
14
|
+
assertLogoIsVisible(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Wait for the homepage to load
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Wait for payments nav link to be visible and click it
|
|
20
|
+
*/
|
|
21
|
+
clickPaymentsNav(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if payments nav link is visible
|
|
24
|
+
*/
|
|
25
|
+
isPaymentsNavVisible(): Promise<boolean>;
|
|
26
|
+
waitForPageLoad(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=HomePage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAU,MAAM,kBAAkB,CAAC;AAGzD,qBAAa,QAAQ;IACjB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;gBAEtB,IAAI,EAAE,IAAI;IAUtB;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzC;;OAEG;IACG,mBAAmB;IAIzB;;OAEG;IAEH;;OAEG;IACG,gBAAgB;IAKtB;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;IAGxC,eAAe;CAIxB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HomePage = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
class HomePage {
|
|
6
|
+
constructor(page) {
|
|
7
|
+
this.page = page;
|
|
8
|
+
// Logo locator using the provided xpath
|
|
9
|
+
this.logo = page.locator("//img[contains(@src,'logo-new.png') and @alt='homepage']");
|
|
10
|
+
// Payments nav link locator
|
|
11
|
+
this.paymentsNavLink = page.locator("//a[@class='nav-link']//span[contains(text(),'Payments') and @class='transactions']").first();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Verify that the homepage logo is displayed
|
|
15
|
+
*/
|
|
16
|
+
async isLogoDisplayed() {
|
|
17
|
+
return await this.logo.isVisible();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Assert that the logo is visible
|
|
21
|
+
*/
|
|
22
|
+
async assertLogoIsVisible() {
|
|
23
|
+
await (0, test_1.expect)(this.logo).toBeVisible({ timeout: 50000 });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Wait for the homepage to load
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Wait for payments nav link to be visible and click it
|
|
30
|
+
*/
|
|
31
|
+
async clickPaymentsNav() {
|
|
32
|
+
await this.paymentsNavLink.waitFor({ state: 'visible', timeout: 50000 });
|
|
33
|
+
await this.paymentsNavLink.click();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if payments nav link is visible
|
|
37
|
+
*/
|
|
38
|
+
async isPaymentsNavVisible() {
|
|
39
|
+
return await this.paymentsNavLink.isVisible();
|
|
40
|
+
}
|
|
41
|
+
async waitForPageLoad() {
|
|
42
|
+
await this.page.waitForLoadState('networkidle');
|
|
43
|
+
await this.logo.waitFor({ state: 'visible', timeout: 10000 });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.HomePage = HomePage;
|
|
47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EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;CACJ;AAnDD,4BAmDC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Page, Locator } from '@playwright/test';
|
|
2
|
+
export declare class LoginPage {
|
|
3
|
+
readonly page: Page;
|
|
4
|
+
readonly usernameInput: Locator;
|
|
5
|
+
readonly passwordInput: Locator;
|
|
6
|
+
readonly loginButton: Locator;
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly homeUrl: string;
|
|
9
|
+
private authAPI;
|
|
10
|
+
constructor(page: Page);
|
|
11
|
+
/**
|
|
12
|
+
* Navigate to the login page
|
|
13
|
+
*/
|
|
14
|
+
goto(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Perform login action
|
|
17
|
+
* @param username - Username for login
|
|
18
|
+
* @param password - Password for login
|
|
19
|
+
*/
|
|
20
|
+
login(username: string, password: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Complete login flow - navigate and login
|
|
23
|
+
* @param username - Username for login
|
|
24
|
+
* @param password - Password for login
|
|
25
|
+
*/
|
|
26
|
+
performLogin(username: string, password: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Wait for successful navigation after login
|
|
29
|
+
*/
|
|
30
|
+
waitForNavigation(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Check if login was successful by verifying URL change
|
|
33
|
+
*/
|
|
34
|
+
isLoginSuccessful(): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Login via API and inject session into browser
|
|
37
|
+
* @param username - Username for login
|
|
38
|
+
* @param password - Password for login
|
|
39
|
+
*/
|
|
40
|
+
loginViaAPI(username: string, password: string): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=LoginPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginPage.d.ts","sourceRoot":"","sources":["../../src/pages/LoginPage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGjD,qBAAa,SAAS;IAClB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,OAAO,CAAU;gBAEb,IAAI,EAAE,IAAI;IAYtB;;OAEG;IACG,IAAI;IAIV;;;;OAIG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAQ9C;;;;OAIG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAKrD;;OAEG;IACG,iBAAiB;IAKvB;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAO3C;;;;OAIG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAqDvD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginPage = void 0;
|
|
4
|
+
const authAPI_1 = require("../utils/authAPI");
|
|
5
|
+
class LoginPage {
|
|
6
|
+
constructor(page) {
|
|
7
|
+
this.page = page;
|
|
8
|
+
this.url = 'https://admin.qat.anddone.com/#/login';
|
|
9
|
+
this.homeUrl = 'https://admin.qat.anddone.com/#/';
|
|
10
|
+
this.authAPI = new authAPI_1.AuthAPI();
|
|
11
|
+
// Update these selectors based on actual page elements
|
|
12
|
+
this.usernameInput = page.locator('#userName').first();
|
|
13
|
+
this.passwordInput = page.locator('#password').first();
|
|
14
|
+
this.loginButton = page.locator('button[type="submit"]').first();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Navigate to the login page
|
|
18
|
+
*/
|
|
19
|
+
async goto() {
|
|
20
|
+
await this.page.goto(this.url);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Perform login action
|
|
24
|
+
* @param username - Username for login
|
|
25
|
+
* @param password - Password for login
|
|
26
|
+
*/
|
|
27
|
+
async login(username, password) {
|
|
28
|
+
await this.usernameInput.fill(username);
|
|
29
|
+
await this.passwordInput.fill(password);
|
|
30
|
+
await this.loginButton.click();
|
|
31
|
+
// Wait for URL change instead of networkidle
|
|
32
|
+
await this.page.waitForURL(url => !url.toString().includes('/login'), { timeout: 10000 }).catch(() => { });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Complete login flow - navigate and login
|
|
36
|
+
* @param username - Username for login
|
|
37
|
+
* @param password - Password for login
|
|
38
|
+
*/
|
|
39
|
+
async performLogin(username, password) {
|
|
40
|
+
await this.goto();
|
|
41
|
+
await this.login(username, password);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Wait for successful navigation after login
|
|
45
|
+
*/
|
|
46
|
+
async waitForNavigation() {
|
|
47
|
+
//await this.page.waitForLoadState('networkidle');
|
|
48
|
+
await this.page.waitForLoadState('load');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check if login was successful by verifying URL change
|
|
52
|
+
*/
|
|
53
|
+
async isLoginSuccessful() {
|
|
54
|
+
// Wait a bit for navigation
|
|
55
|
+
await this.page.waitForTimeout(2000);
|
|
56
|
+
const currentUrl = this.page.url();
|
|
57
|
+
return !currentUrl.includes('/login');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Login via API and inject session into browser
|
|
61
|
+
* @param username - Username for login
|
|
62
|
+
* @param password - Password for login
|
|
63
|
+
*/
|
|
64
|
+
async loginViaAPI(username, password) {
|
|
65
|
+
// Perform API login
|
|
66
|
+
const loginResponse = await this.authAPI.login(username, password);
|
|
67
|
+
console.log('Login Response Status:', loginResponse.statusCode);
|
|
68
|
+
console.log('Login Response Body:', loginResponse.body);
|
|
69
|
+
// Extract token and session data
|
|
70
|
+
const token = this.authAPI.extractToken(loginResponse.body);
|
|
71
|
+
const sessionData = this.authAPI.extractSessionData(loginResponse.body);
|
|
72
|
+
// Store token in localStorage (adjust based on your app's implementation)
|
|
73
|
+
await this.page.goto(this.homeUrl);
|
|
74
|
+
await this.page.evaluate((data) => {
|
|
75
|
+
// Store token in localStorage - adjust key names based on your app
|
|
76
|
+
if (data.token) {
|
|
77
|
+
localStorage.setItem('token', data.token);
|
|
78
|
+
localStorage.setItem('authToken', data.token);
|
|
79
|
+
localStorage.setItem('accessToken', data.token);
|
|
80
|
+
}
|
|
81
|
+
// Store user data
|
|
82
|
+
if (data.sessionData) {
|
|
83
|
+
localStorage.setItem('user', JSON.stringify(data.sessionData));
|
|
84
|
+
localStorage.setItem('userData', JSON.stringify(data.sessionData));
|
|
85
|
+
}
|
|
86
|
+
// Store in sessionStorage as well
|
|
87
|
+
if (data.token) {
|
|
88
|
+
sessionStorage.setItem('token', data.token);
|
|
89
|
+
sessionStorage.setItem('authToken', data.token);
|
|
90
|
+
}
|
|
91
|
+
}, { token, sessionData });
|
|
92
|
+
// If cookies are needed, add them
|
|
93
|
+
if (loginResponse.cookies && loginResponse.cookies.length > 0) {
|
|
94
|
+
for (const cookie of loginResponse.cookies) {
|
|
95
|
+
const cookieValue = cookie.value.split(';')[0];
|
|
96
|
+
const cookieName = cookieValue.split('=')[0];
|
|
97
|
+
const cookieVal = cookieValue.split('=')[1];
|
|
98
|
+
await this.page.context().addCookies([{
|
|
99
|
+
name: cookieName,
|
|
100
|
+
value: cookieVal,
|
|
101
|
+
domain: 'qat.anddone.com',
|
|
102
|
+
path: '/',
|
|
103
|
+
}]);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Reload the page to apply the session
|
|
107
|
+
await this.page.reload();
|
|
108
|
+
await this.page.waitForLoadState('load');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.LoginPage = LoginPage;
|
|
112
|
+
//# sourceMappingURL=LoginPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginPage.js","sourceRoot":"","sources":["../../src/pages/LoginPage.ts"],"names":[],"mappings":";;;AACA,8CAA2C;AAE3C,MAAa,SAAS;IASlB,YAAY,IAAU;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,uCAAuC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,kCAAkC,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;QAE7B,uDAAuD;QACvD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;QACvD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,KAAK,EAAE,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,QAAgB;QAC1C,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAC/B,6CAA6C;QAC7C,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,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AM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/C,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE5C,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;wBAClC,IAAI,EAAE,UAAU;wBAChB,KAAK,EAAE,SAAS;wBAChB,MAAM,EAAE,iBAAiB;wBACzB,IAAI,EAAE,GAAG;qBACZ,CAAC,CAAC,CAAC;YACR,CAAC;QACL,CAAC;QAED,uCAAuC;QACvC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ;AA/HD,8BA+HC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Page, Locator } from '@playwright/test';
|
|
2
|
+
export declare class PaymentPage {
|
|
3
|
+
readonly page: Page;
|
|
4
|
+
readonly pageTitle: Locator;
|
|
5
|
+
readonly searchTextbox: Locator;
|
|
6
|
+
readonly loaderImage: Locator;
|
|
7
|
+
readonly firstRecordRow: Locator;
|
|
8
|
+
readonly errorImage: Locator;
|
|
9
|
+
readonly paymentDetailsTitle: Locator;
|
|
10
|
+
readonly transactionDetailsLabels: Locator;
|
|
11
|
+
readonly transactionDetailsValues: Locator;
|
|
12
|
+
constructor(page: Page);
|
|
13
|
+
/**
|
|
14
|
+
* Verify that the Payment page title is displayed
|
|
15
|
+
*/
|
|
16
|
+
isPageTitleDisplayed(): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Assert that the Payment page title is visible
|
|
19
|
+
*/
|
|
20
|
+
assertPageTitleIsVisible(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the page title text
|
|
23
|
+
*/
|
|
24
|
+
getPageTitle(): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Assert the page title contains expected text
|
|
27
|
+
*/
|
|
28
|
+
assertPageTitle(expectedText: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Verify that search textbox is displayed
|
|
31
|
+
*/
|
|
32
|
+
isSearchTextboxDisplayed(): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Assert that search textbox is visible
|
|
35
|
+
*/
|
|
36
|
+
assertSearchTextboxIsVisible(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Search for a value in the search textbox
|
|
39
|
+
* @param searchText - Text to search for
|
|
40
|
+
*/
|
|
41
|
+
searchFor(searchText: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Clear the search textbox
|
|
44
|
+
*/
|
|
45
|
+
clearSearch(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Wait for the payment page to load
|
|
48
|
+
*/
|
|
49
|
+
waitForPageLoad(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Validate payment page elements are present
|
|
52
|
+
*/
|
|
53
|
+
validatePaymentPageElements(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Search for merchant by reference and click on the record
|
|
56
|
+
* @param merchantReference - Merchant reference to search for
|
|
57
|
+
*/
|
|
58
|
+
searchAndSelectMerchantByReference(merchantReference: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Wait for loader to disappear
|
|
61
|
+
*/
|
|
62
|
+
waitForLoader(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Check if error image is displayed
|
|
65
|
+
*/
|
|
66
|
+
isErrorImageDisplayed(): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Get the count of records in the table
|
|
69
|
+
*/
|
|
70
|
+
getRecordCount(): Promise<number>;
|
|
71
|
+
waitForLoaderImageToDisappear(): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Verify Payment Details page title and fetch Transaction Details as key-value pairs
|
|
74
|
+
* @returns Map of transaction details with label as key and value as value
|
|
75
|
+
*/
|
|
76
|
+
verifyPaymentDetailsAndGetTransactionDetails(): Promise<Map<string, string>>;
|
|
77
|
+
/**
|
|
78
|
+
* Assert Payment Details title is visible
|
|
79
|
+
*/
|
|
80
|
+
assertPaymentDetailsTitleIsVisible(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Get Transaction Details as an object (alternative to Map)
|
|
83
|
+
* @returns Object with transaction details
|
|
84
|
+
*/
|
|
85
|
+
getTransactionDetailsAsObject(): Promise<Record<string, string>>;
|
|
86
|
+
/**
|
|
87
|
+
* Get specific transaction detail value by label
|
|
88
|
+
* @param label - The label to search for
|
|
89
|
+
* @returns The value associated with the label, or null if not found
|
|
90
|
+
*/
|
|
91
|
+
getTransactionDetailByLabel(label: string): Promise<string | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Print all transaction details to console
|
|
94
|
+
*/
|
|
95
|
+
printTransactionDetails(): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=PaymentPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentPage.d.ts","sourceRoot":"","sources":["../../src/pages/PaymentPage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAU,MAAM,kBAAkB,CAAC;AAEzD,qBAAa,WAAW;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,EAAE,OAAO,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