cypress-playwright-data-gen 1.0.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.
@@ -0,0 +1,17 @@
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 {};
@@ -0,0 +1,16 @@
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
+ });
@@ -0,0 +1,15 @@
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 {};
@@ -0,0 +1,14 @@
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
+ });
@@ -0,0 +1,26 @@
1
+ export interface User {
2
+ fullName: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ username: string;
6
+ password: string;
7
+ userId: string;
8
+ avatar: string;
9
+ email: string;
10
+ phone: string;
11
+ address: string;
12
+ }
13
+ export interface Card {
14
+ cardNumber: string;
15
+ cvv: string;
16
+ expiry: string;
17
+ }
18
+ declare global {
19
+ namespace Cypress {
20
+ interface Chainable {
21
+ generateUser(): Chainable<User>;
22
+ generateCard(): Chainable<Card>;
23
+ }
24
+ }
25
+ }
26
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // import { faker } from '@faker-js/faker';
3
+ 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
+ /// <reference types="cypress" />
29
+ const faker_1 = require("@faker-js/faker");
30
+ Cypress.Commands.add("generateUser", () => {
31
+ const user = {
32
+ fullName: faker_1.faker.person.fullName(),
33
+ firstName: faker_1.faker.person.firstName(),
34
+ lastName: faker_1.faker.person.lastName(),
35
+ email: faker_1.faker.internet.email(),
36
+ phone: faker_1.faker.phone.number(),
37
+ address: faker_1.faker.location.streetAddress(),
38
+ username: faker_1.faker.internet.username(),
39
+ password: faker_1.faker.internet.password(),
40
+ userId: faker_1.faker.string.uuid(),
41
+ avatar: faker_1.faker.image.avatar(),
42
+ };
43
+ return cy.wrap(user); // ✅ wrap result so it’s Chainable
44
+ });
45
+ Cypress.Commands.add("generateCard", () => {
46
+ const card = {
47
+ cardNumber: faker_1.faker.finance.creditCardNumber(),
48
+ cvv: faker_1.faker.finance.creditCardCVV(),
49
+ expiry: faker_1.faker.date
50
+ .future()
51
+ .toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
52
+ };
53
+ return cy.wrap(card); // ✅ wrap result so TypeScript is happy
54
+ });
@@ -0,0 +1,17 @@
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 {};
@@ -0,0 +1,16 @@
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
+ });
@@ -0,0 +1,8 @@
1
+ export * from "./cypress/commands";
2
+ export * from "./cypress/transaction";
3
+ export * from "./cypress/address";
4
+ export * from "./cypress/institution";
5
+ export * from "./playwright/utils";
6
+ export * from "./playwright/transaction";
7
+ export * from "./playwright/address";
8
+ export * from "./playwright/institution";
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // // main entry point of the plugin
3
+ // import './cypress/commands.js'
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ // // could also export helpers for Node/Playwright use later
20
+ // export * from './utils.js'
21
+ __exportStar(require("./cypress/commands"), exports);
22
+ __exportStar(require("./cypress/transaction"), exports);
23
+ __exportStar(require("./cypress/address"), exports);
24
+ __exportStar(require("./cypress/institution"), exports);
25
+ __exportStar(require("./playwright/utils"), exports);
26
+ __exportStar(require("./playwright/transaction"), exports);
27
+ __exportStar(require("./playwright/address"), exports);
28
+ __exportStar(require("./playwright/institution"), exports);
@@ -0,0 +1,8 @@
1
+ export interface PlaywrightAddress {
2
+ street: string;
3
+ city: string;
4
+ state: string;
5
+ postalCode: string;
6
+ country: string;
7
+ }
8
+ export declare function generateAddress(): PlaywrightAddress;
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,19 @@
1
+ export interface PlaywrightUser {
2
+ fullName: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ username: string;
6
+ password: string;
7
+ userId: string;
8
+ avatar: string;
9
+ email: string;
10
+ phone: string;
11
+ address: string;
12
+ }
13
+ export interface PlaywrightCard {
14
+ cardNumber: string;
15
+ cvv: string;
16
+ expiry: string;
17
+ }
18
+ export declare function generateUser(): PlaywrightUser;
19
+ export declare function generateCard(): PlaywrightCard;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ // import { faker } from '@faker-js/faker';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.generateUser = generateUser;
5
+ exports.generateCard = generateCard;
6
+ // export const generateUser = () => {
7
+ // return {
8
+ // fullName: faker.person.fullName(),
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
+ // };
30
+ const faker_1 = require("@faker-js/faker");
31
+ function generateUser() {
32
+ return {
33
+ fullName: faker_1.faker.person.fullName(),
34
+ firstName: faker_1.faker.person.firstName(),
35
+ lastName: faker_1.faker.person.lastName(),
36
+ email: faker_1.faker.internet.email(),
37
+ phone: faker_1.faker.phone.number(),
38
+ address: faker_1.faker.location.streetAddress(),
39
+ username: faker_1.faker.internet.username(),
40
+ password: faker_1.faker.internet.password(),
41
+ userId: faker_1.faker.string.uuid(),
42
+ avatar: faker_1.faker.image.avatar(),
43
+ };
44
+ }
45
+ function generateCard() {
46
+ return {
47
+ cardNumber: faker_1.faker.finance.creditCardNumber(),
48
+ cvv: faker_1.faker.finance.creditCardCVV(),
49
+ expiry: faker_1.faker.date
50
+ .future()
51
+ .toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
52
+ };
53
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "cypress-playwright-data-gen",
3
+ "version": "1.0.0",
4
+ "description": "A simple Cypress & Playwright plugin for generating realistic test data using Faker.js.",
5
+ "main": "src/index.js",
6
+ "exports": {
7
+ ".": "./dist/index.js",
8
+ "./commands": "./src/cypress/commands.ts"
9
+ },
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "build": "tsc"
13
+ },
14
+ "keywords": [
15
+ "cypress",
16
+ "playwright",
17
+ "test data",
18
+ "qa",
19
+ "faker"
20
+ ],
21
+ "author": "Goodness Okoye",
22
+ "license": "MIT",
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@faker-js/faker": "^10.0.0",
28
+ "cypress": "^15.3.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^24.6.2",
32
+ "typescript": "^5.9.3"
33
+ }
34
+ }
@@ -0,0 +1,35 @@
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
+
@@ -0,0 +1,94 @@
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
+ /// <reference types="cypress" />
32
+ import { faker } from "@faker-js/faker";
33
+
34
+ export interface User {
35
+ fullName:string;
36
+ firstName:string;
37
+ lastName:string;
38
+ username:string;
39
+ password:string;
40
+ userId:string;
41
+ avatar:string;
42
+ email: string;
43
+ phone: string;
44
+ address: string;
45
+ }
46
+
47
+ export interface Card {
48
+ cardNumber: string;
49
+ cvv: string;
50
+ expiry: string;
51
+ }
52
+
53
+ Cypress.Commands.add("generateUser", () => {
54
+ const user: User = {
55
+ fullName: faker.person.fullName(),
56
+ firstName: faker.person.firstName(),
57
+ lastName: faker.person.lastName(),
58
+ email: faker.internet.email(),
59
+ phone: faker.phone.number(),
60
+ address: faker.location.streetAddress(),
61
+ username: faker.internet.username(),
62
+ password: faker.internet.password(),
63
+ userId: faker.string.uuid(),
64
+ avatar: faker.image.avatar(),
65
+ };
66
+ return cy.wrap(user); // ✅ wrap result so it’s Chainable
67
+ });
68
+
69
+ Cypress.Commands.add("generateCard", () => {
70
+ const card: Card = {
71
+ cardNumber: faker.finance.creditCardNumber(),
72
+ cvv: faker.finance.creditCardCVV(),
73
+ expiry: faker.date
74
+ .future()
75
+ .toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
76
+ };
77
+ return cy.wrap(card); // ✅ wrap result so TypeScript is happy
78
+ });
79
+
80
+
81
+
82
+
83
+
84
+
85
+ declare global {
86
+ namespace Cypress {
87
+ interface Chainable {
88
+ generateUser(): Chainable<User>;
89
+ generateCard(): Chainable<Card>;
90
+ }
91
+ }
92
+ }
93
+
94
+ export {}; // keep file a module
@@ -0,0 +1,39 @@
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
@@ -0,0 +1,38 @@
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
package/src/index.ts ADDED
@@ -0,0 +1,19 @@
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
+ export * from "./cypress/commands";
9
+ export * from "./cypress/transaction";
10
+ export * from "./cypress/address";
11
+ export * from "./cypress/institution";
12
+
13
+
14
+ export * from "./playwright/utils";
15
+ export * from "./playwright/transaction";
16
+ export * from "./playwright/address";
17
+ export * from "./playwright/institution";
18
+
19
+
@@ -0,0 +1,25 @@
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
+
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,26 @@
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
+
@@ -0,0 +1,73 @@
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
+ import { faker } from "@faker-js/faker";
30
+
31
+ export interface PlaywrightUser{
32
+ fullName:string;
33
+ firstName:string;
34
+ lastName:string;
35
+ username:string;
36
+ password:string;
37
+ userId:string;
38
+ avatar:string;
39
+ email: string;
40
+ phone: string;
41
+ address: string;
42
+ }
43
+
44
+ export interface PlaywrightCard{
45
+ cardNumber: string;
46
+ cvv: string;
47
+ expiry: string;
48
+ }
49
+
50
+ export function generateUser(): PlaywrightUser {
51
+ return {
52
+ fullName: faker.person.fullName(),
53
+ firstName: faker.person.firstName(),
54
+ lastName: faker.person.lastName(),
55
+ email: faker.internet.email(),
56
+ phone: faker.phone.number(),
57
+ address: faker.location.streetAddress(),
58
+ username: faker.internet.username(),
59
+ password: faker.internet.password(),
60
+ userId: faker.string.uuid(),
61
+ avatar: faker.image.avatar(),
62
+ };
63
+ }
64
+
65
+ export function generateCard(): PlaywrightCard {
66
+ return {
67
+ cardNumber: faker.finance.creditCardNumber(),
68
+ cvv: faker.finance.creditCardCVV(),
69
+ expiry: faker.date
70
+ .future()
71
+ .toLocaleDateString("en-GB", { month: "2-digit", year: "2-digit" }),
72
+ };
73
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "declaration": true,
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "esModuleInterop": true,
9
+ "strict": true
10
+ },
11
+ "include": ["src"]
12
+ }