cypress-playwright-data-gen 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/cypress/commands.d.ts +28 -0
- package/dist/cypress/commands.js +35 -26
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -10
- package/dist/playwright/utils.d.ts +28 -0
- package/dist/playwright/utils.js +34 -25
- package/package.json +2 -3
- package/src/cypress/commands.ts +76 -32
- package/src/index.ts +0 -15
- package/src/playwright/utils.ts +65 -28
- package/dist/cypress/Institution.d.ts +0 -17
- package/dist/cypress/Institution.js +0 -16
- package/dist/cypress/address.d.ts +0 -15
- package/dist/cypress/address.js +0 -14
- package/dist/cypress/transaction.d.ts +0 -17
- package/dist/cypress/transaction.js +0 -16
- package/dist/playwright/address.d.ts +0 -8
- package/dist/playwright/address.js +0 -13
- package/dist/playwright/institution.d.ts +0 -10
- package/dist/playwright/institution.js +0 -15
- package/dist/playwright/transaction.d.ts +0 -10
- package/dist/playwright/transaction.js +0 -15
- package/src/cypress/address.ts +0 -35
- package/src/cypress/institution.ts +0 -39
- package/src/cypress/transaction.ts +0 -38
- package/src/playwright/address.ts +0 -25
- package/src/playwright/institution.ts +0 -27
- package/src/playwright/transaction.ts +0 -26
@@ -15,11 +15,39 @@ export interface Card {
|
|
15
15
|
cvv: string;
|
16
16
|
expiry: string;
|
17
17
|
}
|
18
|
+
export interface Address {
|
19
|
+
street: string;
|
20
|
+
city: string;
|
21
|
+
state: string;
|
22
|
+
postalCode: string;
|
23
|
+
country: string;
|
24
|
+
}
|
25
|
+
export interface Institution {
|
26
|
+
institutionId: string;
|
27
|
+
name: string;
|
28
|
+
type: "Bank" | "FinTech" | "Credit Union";
|
29
|
+
country: string;
|
30
|
+
branchCode: number;
|
31
|
+
contactEmail: string;
|
32
|
+
phone: string;
|
33
|
+
}
|
34
|
+
export interface Transaction {
|
35
|
+
amount: number;
|
36
|
+
currency: string;
|
37
|
+
type: "credit" | "debit";
|
38
|
+
date: Date;
|
39
|
+
merchant: string;
|
40
|
+
transactionId: string;
|
41
|
+
status: "successful" | "failed" | "pending";
|
42
|
+
}
|
18
43
|
declare global {
|
19
44
|
namespace Cypress {
|
20
45
|
interface Chainable {
|
21
46
|
generateUser(): Chainable<User>;
|
22
47
|
generateCard(): Chainable<Card>;
|
48
|
+
generateAddress(): Chainable<Address>;
|
49
|
+
generateTransaction(): Chainable<Transaction>;
|
50
|
+
generateInstitution(): Chainable<Institution>;
|
23
51
|
}
|
24
52
|
}
|
25
53
|
}
|
package/dist/cypress/commands.js
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
// import { faker } from '@faker-js/faker';
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
// Cypress.Commands.add('generateUser', () => {
|
5
|
-
// return {
|
6
|
-
// fullName: faker.person.fullName(),
|
7
|
-
// firstName: faker.person.firstName(),
|
8
|
-
// lastName: faker.person.lastName(),
|
9
|
-
// email: faker.internet.email(),
|
10
|
-
// phone: faker.phone.number(),
|
11
|
-
// address: faker.location.streetAddress(),
|
12
|
-
// username: faker.internet.username(),
|
13
|
-
// password: faker.internet.password(),
|
14
|
-
// userId: faker.string.uuid(),
|
15
|
-
// avatar: faker.image.avatar(),
|
16
|
-
// };
|
17
|
-
// });
|
18
|
-
// Cypress.Commands.add('generateCard', () => {
|
19
|
-
// return {
|
20
|
-
// cardNumber: faker.finance.creditCardNumber(),
|
21
|
-
// cvv: faker.finance.creditCardCVV(),
|
22
|
-
// expiry: faker.date.future().toLocaleDateString('en-GB', {
|
23
|
-
// month: '2-digit',
|
24
|
-
// year: '2-digit',
|
25
|
-
// }),
|
26
|
-
// };
|
27
|
-
// });
|
28
3
|
/// <reference types="cypress" />
|
29
4
|
const faker_1 = require("@faker-js/faker");
|
30
5
|
Cypress.Commands.add("generateUser", () => {
|
@@ -50,5 +25,39 @@ Cypress.Commands.add("generateCard", () => {
|
|
50
25
|
.future()
|
51
26
|
.toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
|
52
27
|
};
|
53
|
-
return cy.wrap(card);
|
28
|
+
return cy.wrap(card);
|
29
|
+
});
|
30
|
+
Cypress.Commands.add("generateAddress", () => {
|
31
|
+
const address = {
|
32
|
+
street: faker_1.faker.location.streetAddress(),
|
33
|
+
city: faker_1.faker.location.city(),
|
34
|
+
state: faker_1.faker.location.state(),
|
35
|
+
postalCode: faker_1.faker.location.zipCode(),
|
36
|
+
country: faker_1.faker.location.country(),
|
37
|
+
};
|
38
|
+
return cy.wrap(address);
|
39
|
+
});
|
40
|
+
Cypress.Commands.add('generateInstitution', () => {
|
41
|
+
const transaction = {
|
42
|
+
institutionId: faker_1.faker.string.uuid(),
|
43
|
+
name: faker_1.faker.company.name(),
|
44
|
+
type: faker_1.faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
45
|
+
country: faker_1.faker.location.country(),
|
46
|
+
branchCode: faker_1.faker.number.int({ min: 100, max: 999 }),
|
47
|
+
contactEmail: faker_1.faker.internet.email(),
|
48
|
+
phone: faker_1.faker.phone.number(),
|
49
|
+
};
|
50
|
+
return cy.wrap(transaction);
|
51
|
+
});
|
52
|
+
Cypress.Commands.add('generateTransaction', () => {
|
53
|
+
const transaction = {
|
54
|
+
amount: parseFloat(faker_1.faker.finance.amount()), // converts string to number
|
55
|
+
currency: faker_1.faker.finance.currencyCode(),
|
56
|
+
type: faker_1.faker.helpers.arrayElement(["credit", "debit"]),
|
57
|
+
date: faker_1.faker.date.recent(),
|
58
|
+
merchant: faker_1.faker.company.name(),
|
59
|
+
transactionId: faker_1.faker.string.uuid(),
|
60
|
+
status: faker_1.faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
61
|
+
};
|
62
|
+
return cy.wrap(transaction);
|
54
63
|
});
|
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,2 @@
|
|
1
1
|
export * from "./cypress/commands";
|
2
|
-
export * from "./cypress/transaction";
|
3
|
-
export * from "./cypress/address";
|
4
|
-
export * from "./cypress/institution";
|
5
2
|
export * from "./playwright/utils";
|
6
|
-
export * from "./playwright/transaction";
|
7
|
-
export * from "./playwright/address";
|
8
|
-
export * from "./playwright/institution";
|
package/dist/index.js
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
// // main entry point of the plugin
|
3
|
-
// import './cypress/commands.js'
|
4
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
5
3
|
if (k2 === undefined) k2 = k;
|
6
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
@@ -16,13 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
17
15
|
};
|
18
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
19
|
-
// // could also export helpers for Node/Playwright use later
|
20
|
-
// export * from './utils.js'
|
21
17
|
__exportStar(require("./cypress/commands"), exports);
|
22
|
-
__exportStar(require("./cypress/transaction"), exports);
|
23
|
-
__exportStar(require("./cypress/address"), exports);
|
24
|
-
__exportStar(require("./cypress/institution"), exports);
|
25
18
|
__exportStar(require("./playwright/utils"), exports);
|
26
|
-
__exportStar(require("./playwright/transaction"), exports);
|
27
|
-
__exportStar(require("./playwright/address"), exports);
|
28
|
-
__exportStar(require("./playwright/institution"), exports);
|
@@ -15,5 +15,33 @@ export interface PlaywrightCard {
|
|
15
15
|
cvv: string;
|
16
16
|
expiry: string;
|
17
17
|
}
|
18
|
+
export interface PlaywrightAddress {
|
19
|
+
street: string;
|
20
|
+
city: string;
|
21
|
+
state: string;
|
22
|
+
postalCode: string;
|
23
|
+
country: string;
|
24
|
+
}
|
25
|
+
export interface PlaywrightInstitution {
|
26
|
+
institutionId: string;
|
27
|
+
name: string;
|
28
|
+
type: "Bank" | "FinTech" | "Credit Union";
|
29
|
+
country: string;
|
30
|
+
branchCode: number;
|
31
|
+
contactEmail: string;
|
32
|
+
phone: string;
|
33
|
+
}
|
34
|
+
export interface PlaywrightTransaction {
|
35
|
+
amount: number;
|
36
|
+
currency: string;
|
37
|
+
type: "credit" | "debit";
|
38
|
+
date: Date;
|
39
|
+
merchant: string;
|
40
|
+
transactionId: string;
|
41
|
+
status: "successful" | "failed" | "pending";
|
42
|
+
}
|
18
43
|
export declare function generateUser(): PlaywrightUser;
|
19
44
|
export declare function generateCard(): PlaywrightCard;
|
45
|
+
export declare function generateAddress(): PlaywrightAddress;
|
46
|
+
export declare function generateInstitution(): PlaywrightInstitution;
|
47
|
+
export declare function generateTransaction(): PlaywrightTransaction;
|
package/dist/playwright/utils.js
CHANGED
@@ -1,32 +1,10 @@
|
|
1
1
|
"use strict";
|
2
|
-
// import { faker } from '@faker-js/faker';
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
3
|
exports.generateUser = generateUser;
|
5
4
|
exports.generateCard = generateCard;
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
// firstName: faker.person.firstName(),
|
10
|
-
// lastName: faker.person.lastName(),
|
11
|
-
// email: faker.internet.email(),
|
12
|
-
// phone: faker.phone.number(),
|
13
|
-
// address: faker.location.streetAddress(),
|
14
|
-
// username: faker.internet.username(),
|
15
|
-
// password: faker.internet.password(),
|
16
|
-
// userId: faker.string.uuid(),
|
17
|
-
// avatar: faker.image.avatar(),
|
18
|
-
// };
|
19
|
-
// };
|
20
|
-
// export const generateCard = () => {
|
21
|
-
// return {
|
22
|
-
// cardNumber: faker.finance.creditCardNumber(),
|
23
|
-
// cvv: faker.finance.creditCardCVV(),
|
24
|
-
// expiry: faker.date.future().toLocaleDateString('en-GB', {
|
25
|
-
// month: '2-digit',
|
26
|
-
// year: '2-digit',
|
27
|
-
// }),
|
28
|
-
// };
|
29
|
-
// };
|
5
|
+
exports.generateAddress = generateAddress;
|
6
|
+
exports.generateInstitution = generateInstitution;
|
7
|
+
exports.generateTransaction = generateTransaction;
|
30
8
|
const faker_1 = require("@faker-js/faker");
|
31
9
|
function generateUser() {
|
32
10
|
return {
|
@@ -51,3 +29,34 @@ function generateCard() {
|
|
51
29
|
.toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
|
52
30
|
};
|
53
31
|
}
|
32
|
+
function generateAddress() {
|
33
|
+
return {
|
34
|
+
street: faker_1.faker.location.streetAddress(),
|
35
|
+
city: faker_1.faker.location.city(),
|
36
|
+
state: faker_1.faker.location.state(),
|
37
|
+
postalCode: faker_1.faker.location.zipCode(),
|
38
|
+
country: faker_1.faker.location.country(),
|
39
|
+
};
|
40
|
+
}
|
41
|
+
function generateInstitution() {
|
42
|
+
return {
|
43
|
+
institutionId: faker_1.faker.string.uuid(),
|
44
|
+
name: faker_1.faker.company.name(),
|
45
|
+
type: faker_1.faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
46
|
+
country: faker_1.faker.location.country(),
|
47
|
+
branchCode: faker_1.faker.number.int({ min: 100, max: 999 }),
|
48
|
+
contactEmail: faker_1.faker.internet.email(),
|
49
|
+
phone: faker_1.faker.phone.number(),
|
50
|
+
};
|
51
|
+
}
|
52
|
+
function generateTransaction() {
|
53
|
+
return {
|
54
|
+
amount: parseFloat(faker_1.faker.finance.amount()), // converts string to number
|
55
|
+
currency: faker_1.faker.finance.currencyCode(),
|
56
|
+
type: faker_1.faker.helpers.arrayElement(["credit", "debit"]),
|
57
|
+
date: faker_1.faker.date.recent(),
|
58
|
+
merchant: faker_1.faker.company.name(),
|
59
|
+
transactionId: faker_1.faker.string.uuid(),
|
60
|
+
status: faker_1.faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
61
|
+
};
|
62
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress-playwright-data-gen",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "A simple Cypress & Playwright plugin for generating realistic test data using Faker.js.",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"exports": {
|
@@ -34,8 +34,7 @@
|
|
34
34
|
"access": "public"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@faker-js/faker": "^10.0.0"
|
38
|
-
"cypress": "^15.3.0"
|
37
|
+
"@faker-js/faker": "^10.0.0"
|
39
38
|
},
|
40
39
|
"devDependencies": {
|
41
40
|
"@types/node": "^24.6.2",
|
package/src/cypress/commands.ts
CHANGED
@@ -1,33 +1,3 @@
|
|
1
|
-
// import { faker } from '@faker-js/faker';
|
2
|
-
|
3
|
-
// Cypress.Commands.add('generateUser', () => {
|
4
|
-
// return {
|
5
|
-
// fullName: faker.person.fullName(),
|
6
|
-
// firstName: faker.person.firstName(),
|
7
|
-
// lastName: faker.person.lastName(),
|
8
|
-
// email: faker.internet.email(),
|
9
|
-
// phone: faker.phone.number(),
|
10
|
-
// address: faker.location.streetAddress(),
|
11
|
-
// username: faker.internet.username(),
|
12
|
-
// password: faker.internet.password(),
|
13
|
-
// userId: faker.string.uuid(),
|
14
|
-
// avatar: faker.image.avatar(),
|
15
|
-
|
16
|
-
// };
|
17
|
-
// });
|
18
|
-
|
19
|
-
// Cypress.Commands.add('generateCard', () => {
|
20
|
-
// return {
|
21
|
-
// cardNumber: faker.finance.creditCardNumber(),
|
22
|
-
// cvv: faker.finance.creditCardCVV(),
|
23
|
-
// expiry: faker.date.future().toLocaleDateString('en-GB', {
|
24
|
-
// month: '2-digit',
|
25
|
-
// year: '2-digit',
|
26
|
-
// }),
|
27
|
-
// };
|
28
|
-
// });
|
29
|
-
|
30
|
-
|
31
1
|
/// <reference types="cypress" />
|
32
2
|
import { faker } from "@faker-js/faker";
|
33
3
|
|
@@ -50,6 +20,35 @@ export interface Card {
|
|
50
20
|
expiry: string;
|
51
21
|
}
|
52
22
|
|
23
|
+
export interface Address {
|
24
|
+
street: string;
|
25
|
+
city: string;
|
26
|
+
state: string;
|
27
|
+
postalCode: string;
|
28
|
+
country: string;
|
29
|
+
}
|
30
|
+
|
31
|
+
export interface Institution {
|
32
|
+
institutionId: string;
|
33
|
+
name: string;
|
34
|
+
type: "Bank" | "FinTech" | "Credit Union";
|
35
|
+
country: string;
|
36
|
+
branchCode: number;
|
37
|
+
contactEmail: string;
|
38
|
+
phone: string;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
export interface Transaction {
|
43
|
+
amount: number;
|
44
|
+
currency: string;
|
45
|
+
type: "credit" | "debit"; // restricted to known transaction types
|
46
|
+
date: Date; // proper date object
|
47
|
+
merchant: string;
|
48
|
+
transactionId: string;
|
49
|
+
status: "successful" | "failed" | "pending"; //allowed values
|
50
|
+
}
|
51
|
+
|
53
52
|
Cypress.Commands.add("generateUser", () => {
|
54
53
|
const user: User = {
|
55
54
|
fullName: faker.person.fullName(),
|
@@ -74,10 +73,49 @@ Cypress.Commands.add("generateCard", () => {
|
|
74
73
|
.future()
|
75
74
|
.toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
|
76
75
|
};
|
77
|
-
return cy.wrap(card);
|
76
|
+
return cy.wrap(card);
|
78
77
|
});
|
79
78
|
|
80
79
|
|
80
|
+
Cypress.Commands.add("generateAddress", ()=>{
|
81
|
+
const address: Address = {
|
82
|
+
street: faker.location.streetAddress(),
|
83
|
+
city: faker.location.city(),
|
84
|
+
state: faker.location.state(),
|
85
|
+
postalCode: faker.location.zipCode(),
|
86
|
+
country: faker.location.country(),
|
87
|
+
}
|
88
|
+
return cy.wrap(address);
|
89
|
+
|
90
|
+
});
|
91
|
+
|
92
|
+
|
93
|
+
Cypress.Commands.add('generateInstitution', ()=>{
|
94
|
+
const transaction: Institution = {
|
95
|
+
institutionId: faker.string.uuid(),
|
96
|
+
name: faker.company.name(),
|
97
|
+
type: faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
98
|
+
country: faker.location.country(),
|
99
|
+
branchCode: faker.number.int({ min: 100, max: 999 }),
|
100
|
+
contactEmail: faker.internet.email(),
|
101
|
+
phone: faker.phone.number(),
|
102
|
+
}
|
103
|
+
return cy.wrap(transaction);
|
104
|
+
|
105
|
+
})
|
106
|
+
|
107
|
+
Cypress.Commands.add('generateTransaction', ()=>{
|
108
|
+
const transaction: Transaction = {
|
109
|
+
amount: parseFloat(faker.finance.amount()), // converts string to number
|
110
|
+
currency: faker.finance.currencyCode(),
|
111
|
+
type: faker.helpers.arrayElement(["credit", "debit"]),
|
112
|
+
date: faker.date.recent(),
|
113
|
+
merchant: faker.company.name(),
|
114
|
+
transactionId: faker.string.uuid(),
|
115
|
+
status: faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
116
|
+
}
|
117
|
+
return cy.wrap(transaction);
|
118
|
+
})
|
81
119
|
|
82
120
|
|
83
121
|
|
@@ -87,8 +125,14 @@ declare global {
|
|
87
125
|
interface Chainable {
|
88
126
|
generateUser(): Chainable<User>;
|
89
127
|
generateCard(): Chainable<Card>;
|
128
|
+
generateAddress(): Chainable<Address>;
|
129
|
+
generateTransaction(): Chainable<Transaction>;
|
130
|
+
generateInstitution(): Chainable<Institution>;
|
131
|
+
|
132
|
+
|
133
|
+
|
90
134
|
}
|
91
135
|
}
|
92
136
|
}
|
93
137
|
|
94
|
-
export {};
|
138
|
+
export {};
|
package/src/index.ts
CHANGED
@@ -1,19 +1,4 @@
|
|
1
|
-
// // main entry point of the plugin
|
2
|
-
// import './cypress/commands.js'
|
3
|
-
|
4
|
-
// // could also export helpers for Node/Playwright use later
|
5
|
-
// export * from './utils.js'
|
6
|
-
|
7
|
-
|
8
1
|
export * from "./cypress/commands";
|
9
|
-
export * from "./cypress/transaction";
|
10
|
-
export * from "./cypress/address";
|
11
|
-
export * from "./cypress/institution";
|
12
|
-
|
13
|
-
|
14
2
|
export * from "./playwright/utils";
|
15
|
-
export * from "./playwright/transaction";
|
16
|
-
export * from "./playwright/address";
|
17
|
-
export * from "./playwright/institution";
|
18
3
|
|
19
4
|
|
package/src/playwright/utils.ts
CHANGED
@@ -1,31 +1,3 @@
|
|
1
|
-
// import { faker } from '@faker-js/faker';
|
2
|
-
|
3
|
-
// export const generateUser = () => {
|
4
|
-
// return {
|
5
|
-
// fullName: faker.person.fullName(),
|
6
|
-
// firstName: faker.person.firstName(),
|
7
|
-
// lastName: faker.person.lastName(),
|
8
|
-
// email: faker.internet.email(),
|
9
|
-
// phone: faker.phone.number(),
|
10
|
-
// address: faker.location.streetAddress(),
|
11
|
-
// username: faker.internet.username(),
|
12
|
-
// password: faker.internet.password(),
|
13
|
-
// userId: faker.string.uuid(),
|
14
|
-
// avatar: faker.image.avatar(),
|
15
|
-
// };
|
16
|
-
// };
|
17
|
-
|
18
|
-
// export const generateCard = () => {
|
19
|
-
// return {
|
20
|
-
// cardNumber: faker.finance.creditCardNumber(),
|
21
|
-
// cvv: faker.finance.creditCardCVV(),
|
22
|
-
// expiry: faker.date.future().toLocaleDateString('en-GB', {
|
23
|
-
// month: '2-digit',
|
24
|
-
// year: '2-digit',
|
25
|
-
// }),
|
26
|
-
// };
|
27
|
-
// };
|
28
|
-
|
29
1
|
import { faker } from "@faker-js/faker";
|
30
2
|
|
31
3
|
export interface PlaywrightUser{
|
@@ -47,6 +19,34 @@ export interface PlaywrightCard{
|
|
47
19
|
expiry: string;
|
48
20
|
}
|
49
21
|
|
22
|
+
export interface PlaywrightAddress {
|
23
|
+
street: string;
|
24
|
+
city: string;
|
25
|
+
state: string;
|
26
|
+
postalCode: string;
|
27
|
+
country: string;
|
28
|
+
}
|
29
|
+
export interface PlaywrightInstitution {
|
30
|
+
institutionId: string;
|
31
|
+
name: string;
|
32
|
+
type: "Bank" | "FinTech" | "Credit Union";
|
33
|
+
country: string;
|
34
|
+
branchCode: number;
|
35
|
+
contactEmail: string;
|
36
|
+
phone: string;
|
37
|
+
}
|
38
|
+
|
39
|
+
export interface PlaywrightTransaction {
|
40
|
+
amount: number;
|
41
|
+
currency: string;
|
42
|
+
type: "credit" | "debit"; // restricted to known transaction types
|
43
|
+
date: Date;
|
44
|
+
merchant: string;
|
45
|
+
transactionId: string;
|
46
|
+
status: "successful" | "failed" | "pending"; // allowed values
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
50
|
export function generateUser(): PlaywrightUser {
|
51
51
|
return {
|
52
52
|
fullName: faker.person.fullName(),
|
@@ -71,3 +71,40 @@ export function generateCard(): PlaywrightCard {
|
|
71
71
|
.toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
|
72
72
|
};
|
73
73
|
}
|
74
|
+
|
75
|
+
export function generateAddress (): PlaywrightAddress {
|
76
|
+
return {
|
77
|
+
street: faker.location.streetAddress(),
|
78
|
+
city: faker.location.city(),
|
79
|
+
state: faker.location.state(),
|
80
|
+
postalCode: faker.location.zipCode(),
|
81
|
+
country: faker.location.country(),
|
82
|
+
}
|
83
|
+
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
export function generateInstitution(): PlaywrightInstitution {
|
88
|
+
return{
|
89
|
+
institutionId: faker.string.uuid(),
|
90
|
+
name: faker.company.name(),
|
91
|
+
type: faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
92
|
+
country: faker.location.country(),
|
93
|
+
branchCode: faker.number.int({ min: 100, max: 999 }),
|
94
|
+
contactEmail: faker.internet.email(),
|
95
|
+
phone: faker.phone.number(),
|
96
|
+
}
|
97
|
+
|
98
|
+
}
|
99
|
+
|
100
|
+
export function generateTransaction(): PlaywrightTransaction {
|
101
|
+
return{
|
102
|
+
amount: parseFloat(faker.finance.amount()), // converts string to number
|
103
|
+
currency: faker.finance.currencyCode(),
|
104
|
+
type: faker.helpers.arrayElement(["credit", "debit"]),
|
105
|
+
date: faker.date.recent(),
|
106
|
+
merchant: faker.company.name(),
|
107
|
+
transactionId: faker.string.uuid(),
|
108
|
+
status: faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
109
|
+
}
|
110
|
+
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
export interface Institution {
|
2
|
-
institutionId: string;
|
3
|
-
name: string;
|
4
|
-
type: "Bank" | "FinTech" | "Credit Union";
|
5
|
-
country: string;
|
6
|
-
branchCode: number;
|
7
|
-
contactEmail: string;
|
8
|
-
phone: string;
|
9
|
-
}
|
10
|
-
declare global {
|
11
|
-
namespace Cypress {
|
12
|
-
interface Chainable {
|
13
|
-
generateInstitution(): Chainable<Institution>;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
export {};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
/// <reference types="cypress" />
|
4
|
-
const faker_1 = require("@faker-js/faker");
|
5
|
-
Cypress.Commands.add('generateInstitution', () => {
|
6
|
-
const transaction = {
|
7
|
-
institutionId: faker_1.faker.string.uuid(),
|
8
|
-
name: faker_1.faker.company.name(),
|
9
|
-
type: faker_1.faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
10
|
-
country: faker_1.faker.location.country(),
|
11
|
-
branchCode: faker_1.faker.number.int({ min: 100, max: 999 }),
|
12
|
-
contactEmail: faker_1.faker.internet.email(),
|
13
|
-
phone: faker_1.faker.phone.number(),
|
14
|
-
};
|
15
|
-
return cy.wrap(transaction); // ✅ wrap result so TypeScript is happy
|
16
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
export interface Address {
|
2
|
-
street: string;
|
3
|
-
city: string;
|
4
|
-
state: string;
|
5
|
-
postalCode: string;
|
6
|
-
country: string;
|
7
|
-
}
|
8
|
-
declare global {
|
9
|
-
namespace Cypress {
|
10
|
-
interface Chainable {
|
11
|
-
generateAddress(): Chainable<Address>;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
}
|
15
|
-
export {};
|
package/dist/cypress/address.js
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
/// <reference types="cypress" />
|
4
|
-
const faker_1 = require("@faker-js/faker");
|
5
|
-
Cypress.Commands.add("generateAddress", () => {
|
6
|
-
const address = {
|
7
|
-
street: faker_1.faker.location.streetAddress(),
|
8
|
-
city: faker_1.faker.location.city(),
|
9
|
-
state: faker_1.faker.location.state(),
|
10
|
-
postalCode: faker_1.faker.location.zipCode(),
|
11
|
-
country: faker_1.faker.location.country(),
|
12
|
-
};
|
13
|
-
return cy.wrap(address); // ✅ wrap result so it’s Chainable
|
14
|
-
});
|
@@ -1,17 +0,0 @@
|
|
1
|
-
export interface Transaction {
|
2
|
-
amount: number;
|
3
|
-
currency: string;
|
4
|
-
type: "credit" | "debit";
|
5
|
-
date: Date;
|
6
|
-
merchant: string;
|
7
|
-
transactionId: string;
|
8
|
-
status: "successful" | "failed" | "pending";
|
9
|
-
}
|
10
|
-
declare global {
|
11
|
-
namespace Cypress {
|
12
|
-
interface Chainable {
|
13
|
-
generateTransaction(): Chainable<Transaction>;
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
export {};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
/// <reference types="cypress" />
|
4
|
-
const faker_1 = require("@faker-js/faker");
|
5
|
-
Cypress.Commands.add('generateTransaction', () => {
|
6
|
-
const transaction = {
|
7
|
-
amount: parseFloat(faker_1.faker.finance.amount()), // converts string to number
|
8
|
-
currency: faker_1.faker.finance.currencyCode(),
|
9
|
-
type: faker_1.faker.helpers.arrayElement(["credit", "debit"]),
|
10
|
-
date: faker_1.faker.date.recent(),
|
11
|
-
merchant: faker_1.faker.company.name(),
|
12
|
-
transactionId: faker_1.faker.string.uuid(),
|
13
|
-
status: faker_1.faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
14
|
-
};
|
15
|
-
return cy.wrap(transaction); // ✅ wrap result so TypeScript is happy
|
16
|
-
});
|
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.generateAddress = generateAddress;
|
4
|
-
const faker_1 = require("@faker-js/faker");
|
5
|
-
function generateAddress() {
|
6
|
-
return {
|
7
|
-
street: faker_1.faker.location.streetAddress(),
|
8
|
-
city: faker_1.faker.location.city(),
|
9
|
-
state: faker_1.faker.location.state(),
|
10
|
-
postalCode: faker_1.faker.location.zipCode(),
|
11
|
-
country: faker_1.faker.location.country(),
|
12
|
-
};
|
13
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
export interface PlaywrightInstitution {
|
2
|
-
institutionId: string;
|
3
|
-
name: string;
|
4
|
-
type: "Bank" | "FinTech" | "Credit Union";
|
5
|
-
country: string;
|
6
|
-
branchCode: number;
|
7
|
-
contactEmail: string;
|
8
|
-
phone: string;
|
9
|
-
}
|
10
|
-
export declare function generateInstitution(): PlaywrightInstitution;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.generateInstitution = generateInstitution;
|
4
|
-
const faker_1 = require("@faker-js/faker");
|
5
|
-
function generateInstitution() {
|
6
|
-
return {
|
7
|
-
institutionId: faker_1.faker.string.uuid(),
|
8
|
-
name: faker_1.faker.company.name(),
|
9
|
-
type: faker_1.faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
10
|
-
country: faker_1.faker.location.country(),
|
11
|
-
branchCode: faker_1.faker.number.int({ min: 100, max: 999 }),
|
12
|
-
contactEmail: faker_1.faker.internet.email(),
|
13
|
-
phone: faker_1.faker.phone.number(),
|
14
|
-
};
|
15
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
export interface PlaywrightTransaction {
|
2
|
-
amount: number;
|
3
|
-
currency: string;
|
4
|
-
type: "credit" | "debit";
|
5
|
-
date: Date;
|
6
|
-
merchant: string;
|
7
|
-
transactionId: string;
|
8
|
-
status: "successful" | "failed" | "pending";
|
9
|
-
}
|
10
|
-
export declare function generateTransaction(): PlaywrightTransaction;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.generateTransaction = generateTransaction;
|
4
|
-
const faker_1 = require("@faker-js/faker");
|
5
|
-
function generateTransaction() {
|
6
|
-
return {
|
7
|
-
amount: parseFloat(faker_1.faker.finance.amount()), // converts string to number
|
8
|
-
currency: faker_1.faker.finance.currencyCode(),
|
9
|
-
type: faker_1.faker.helpers.arrayElement(["credit", "debit"]),
|
10
|
-
date: faker_1.faker.date.recent(),
|
11
|
-
merchant: faker_1.faker.company.name(),
|
12
|
-
transactionId: faker_1.faker.string.uuid(),
|
13
|
-
status: faker_1.faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
14
|
-
};
|
15
|
-
}
|
package/src/cypress/address.ts
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
/// <reference types="cypress" />
|
2
|
-
import { faker } from "@faker-js/faker";
|
3
|
-
|
4
|
-
export interface Address {
|
5
|
-
street: string;
|
6
|
-
city: string;
|
7
|
-
state: string;
|
8
|
-
postalCode: string;
|
9
|
-
country: string;
|
10
|
-
}
|
11
|
-
|
12
|
-
Cypress.Commands.add("generateAddress", ()=>{
|
13
|
-
const address: Address = {
|
14
|
-
street: faker.location.streetAddress(),
|
15
|
-
city: faker.location.city(),
|
16
|
-
state: faker.location.state(),
|
17
|
-
postalCode: faker.location.zipCode(),
|
18
|
-
country: faker.location.country(),
|
19
|
-
}
|
20
|
-
return cy.wrap(address); // ✅ wrap result so it’s Chainable
|
21
|
-
|
22
|
-
});
|
23
|
-
|
24
|
-
declare global {
|
25
|
-
namespace Cypress {
|
26
|
-
interface Chainable {
|
27
|
-
generateAddress(): Chainable<Address>;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
export {}; // keep file a module
|
33
|
-
|
34
|
-
|
35
|
-
|
@@ -1,39 +0,0 @@
|
|
1
|
-
|
2
|
-
/// <reference types="cypress" />
|
3
|
-
import { faker } from "@faker-js/faker";
|
4
|
-
|
5
|
-
export interface Institution {
|
6
|
-
institutionId: string;
|
7
|
-
name: string;
|
8
|
-
type: "Bank" | "FinTech" | "Credit Union";
|
9
|
-
country: string;
|
10
|
-
branchCode: number;
|
11
|
-
contactEmail: string;
|
12
|
-
phone: string;
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Cypress.Commands.add('generateInstitution', ()=>{
|
18
|
-
const transaction: Institution = {
|
19
|
-
institutionId: faker.string.uuid(),
|
20
|
-
name: faker.company.name(),
|
21
|
-
type: faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
22
|
-
country: faker.location.country(),
|
23
|
-
branchCode: faker.number.int({ min: 100, max: 999 }),
|
24
|
-
contactEmail: faker.internet.email(),
|
25
|
-
phone: faker.phone.number(),
|
26
|
-
}
|
27
|
-
return cy.wrap(transaction); // ✅ wrap result so TypeScript is happy
|
28
|
-
|
29
|
-
})
|
30
|
-
|
31
|
-
declare global {
|
32
|
-
namespace Cypress {
|
33
|
-
interface Chainable {
|
34
|
-
generateInstitution(): Chainable<Institution>;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
export {}; // keep file a module
|
@@ -1,38 +0,0 @@
|
|
1
|
-
|
2
|
-
/// <reference types="cypress" />
|
3
|
-
import { faker } from "@faker-js/faker";
|
4
|
-
|
5
|
-
export interface Transaction {
|
6
|
-
amount: number; // should be numeric for sums or comparisons
|
7
|
-
currency: string;
|
8
|
-
type: "credit" | "debit"; // restricts to known transaction types
|
9
|
-
date: Date; // proper date object for manipulation
|
10
|
-
merchant: string;
|
11
|
-
transactionId: string;
|
12
|
-
status: "successful" | "failed" | "pending"; // clear allowed values
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
Cypress.Commands.add('generateTransaction', ()=>{
|
17
|
-
const transaction: Transaction = {
|
18
|
-
amount: parseFloat(faker.finance.amount()), // converts string to number
|
19
|
-
currency: faker.finance.currencyCode(),
|
20
|
-
type: faker.helpers.arrayElement(["credit", "debit"]),
|
21
|
-
date: faker.date.recent(),
|
22
|
-
merchant: faker.company.name(),
|
23
|
-
transactionId: faker.string.uuid(),
|
24
|
-
status: faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
25
|
-
}
|
26
|
-
return cy.wrap(transaction); // ✅ wrap result so TypeScript is happy
|
27
|
-
|
28
|
-
})
|
29
|
-
|
30
|
-
declare global {
|
31
|
-
namespace Cypress {
|
32
|
-
interface Chainable {
|
33
|
-
generateTransaction(): Chainable<Transaction>;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
export {}; // keep file a module
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { faker } from "@faker-js/faker";
|
2
|
-
|
3
|
-
export interface PlaywrightAddress {
|
4
|
-
street: string;
|
5
|
-
city: string;
|
6
|
-
state: string;
|
7
|
-
postalCode: string;
|
8
|
-
country: string;
|
9
|
-
}
|
10
|
-
|
11
|
-
export function generateAddress (): PlaywrightAddress {
|
12
|
-
return {
|
13
|
-
street: faker.location.streetAddress(),
|
14
|
-
city: faker.location.city(),
|
15
|
-
state: faker.location.state(),
|
16
|
-
postalCode: faker.location.zipCode(),
|
17
|
-
country: faker.location.country(),
|
18
|
-
}
|
19
|
-
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
import { faker } from "@faker-js/faker";
|
3
|
-
|
4
|
-
export interface PlaywrightInstitution {
|
5
|
-
institutionId: string;
|
6
|
-
name: string;
|
7
|
-
type: "Bank" | "FinTech" | "Credit Union";
|
8
|
-
country: string;
|
9
|
-
branchCode: number;
|
10
|
-
contactEmail: string;
|
11
|
-
phone: string;
|
12
|
-
}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
export function generateInstitution(): PlaywrightInstitution {
|
17
|
-
return{
|
18
|
-
institutionId: faker.string.uuid(),
|
19
|
-
name: faker.company.name(),
|
20
|
-
type: faker.helpers.arrayElement(["Bank", "FinTech", "Credit Union"]),
|
21
|
-
country: faker.location.country(),
|
22
|
-
branchCode: faker.number.int({ min: 100, max: 999 }),
|
23
|
-
contactEmail: faker.internet.email(),
|
24
|
-
phone: faker.phone.number(),
|
25
|
-
}
|
26
|
-
|
27
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
import { faker } from "@faker-js/faker";
|
3
|
-
|
4
|
-
export interface PlaywrightTransaction {
|
5
|
-
amount: number; // should be numeric for sums or comparisons
|
6
|
-
currency: string;
|
7
|
-
type: "credit" | "debit"; // restricts to known transaction types
|
8
|
-
date: Date; // proper date object for manipulation
|
9
|
-
merchant: string;
|
10
|
-
transactionId: string;
|
11
|
-
status: "successful" | "failed" | "pending"; // clear allowed values
|
12
|
-
}
|
13
|
-
|
14
|
-
|
15
|
-
export function generateTransaction(): PlaywrightTransaction {
|
16
|
-
return{
|
17
|
-
amount: parseFloat(faker.finance.amount()), // converts string to number
|
18
|
-
currency: faker.finance.currencyCode(),
|
19
|
-
type: faker.helpers.arrayElement(["credit", "debit"]),
|
20
|
-
date: faker.date.recent(),
|
21
|
-
merchant: faker.company.name(),
|
22
|
-
transactionId: faker.string.uuid(),
|
23
|
-
status: faker.helpers.arrayElement(["successful", "failed", "pending"]),
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|