cypress-playwright-data-gen 1.0.6 → 1.0.8
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/README.md +16 -69
- package/package.json +1 -1
package/README.md
CHANGED
@@ -15,23 +15,14 @@ yarn add cypress-playwright-data-gen
|
|
15
15
|
🧪 Usage In Cypress
|
16
16
|
|
17
17
|
Add the commands in your cypress/support/e2e.js (or commands.js):
|
18
|
-
|
19
18
|
import 'cypress-playwright-data-gen/cypress/commands';
|
20
19
|
|
21
20
|
|
22
21
|
Then you can use the custom commands anywhere in your tests:
|
22
|
+
/** Just an example — OrangeHRM doesn’t have public signup, so let’s imagine we were testing a form or registration flow: **/
|
23
23
|
|
24
|
-
|
25
|
-
beforeEach(() => {
|
26
|
-
cy.visit('https://opensource-demo.orangehrmlive.com/web/index.php/auth/login');
|
27
|
-
});
|
28
|
-
|
29
|
-
|
30
|
-
it('uses generated user data for a signup-style test', () => {
|
24
|
+
it('uses generated user data for a signup-style test', () => {
|
31
25
|
cy.generateUser().then((user) => {
|
32
|
-
/**
|
33
|
-
* Just an example — OrangeHRM doesn’t have public signup, so let’s imagine we were testing a form or registration flow:
|
34
|
-
*/
|
35
26
|
cy.visit('https://example.com/register');
|
36
27
|
cy.get('#firstName').type(user.firstName);
|
37
28
|
cy.get('#lastName').type(user.lastName);
|
@@ -41,6 +32,7 @@ describe('OrangeHRM Demo Login', () => {
|
|
41
32
|
cy.log(`Generated user: ${user.firstName} ${user.lastName}, email: ${user.email}`);
|
42
33
|
});
|
43
34
|
});
|
35
|
+
|
44
36
|
|
45
37
|
it('generates card data for payment-related tests', () => {
|
46
38
|
cy.generateCard().then((card) => {
|
@@ -49,7 +41,6 @@ describe('OrangeHRM Demo Login', () => {
|
|
49
41
|
cy.log(`CVV: ${card.cvv}`);
|
50
42
|
});
|
51
43
|
});
|
52
|
-
});
|
53
44
|
|
54
45
|
|
55
46
|
##############################################################################
|
@@ -65,84 +56,40 @@ Then you can use them anywhere in your Playwright tests:
|
|
65
56
|
import { test, expect } from '@playwright/test';
|
66
57
|
import { generateUser, generateCard } from 'cypress-playwright-data-gen/playwright/utils';
|
67
58
|
|
68
|
-
|
69
|
-
test.beforeEach(async ({ page }) => {
|
70
|
-
await page.goto('https://opensource-demo.orangehrmlive.com/web/index.php/auth/login');
|
71
|
-
});
|
59
|
+
/** Just an example — OrangeHRM doesn’t have public signup, so let’s imagine we were testing a form or registration flow: **/
|
72
60
|
|
73
61
|
test('uses generated user data for a signup-style test', async ({ page }) => {
|
74
62
|
const user = generateUser();
|
75
|
-
|
76
|
-
/**
|
77
|
-
* Just an example — OrangeHRM doesn’t have public signup,
|
78
|
-
* so let’s imagine we were testing a form or registration flow:
|
79
|
-
*/
|
80
63
|
await page.goto('https://example.com/register');
|
81
64
|
await page.fill('#firstName', user.firstName);
|
82
65
|
await page.fill('#lastName', user.lastName);
|
83
66
|
await page.fill('#email', user.email);
|
84
67
|
await page.fill('#password', user.password);
|
85
68
|
await page.click('#submit');
|
86
|
-
|
87
69
|
console.log(`Generated user: ${user.firstName} ${user.lastName}, email: ${user.email}`);
|
88
70
|
});
|
89
71
|
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Just an example
|
75
|
+
*/
|
90
76
|
test('generates card data for payment-related tests', async () => {
|
91
77
|
const card = generateCard();
|
92
78
|
console.log(`Card Number: ${card.number}`);
|
93
79
|
console.log(`Expiry: ${card.expiryMonth}/${card.expiryYear}`);
|
94
80
|
console.log(`CVV: ${card.cvv}`);
|
95
81
|
});
|
96
|
-
});
|
97
82
|
|
98
83
|
|
99
84
|
|
100
85
|
##############################################################################
|
101
86
|
|
102
87
|
|
103
|
-
🧩 Available Generators
|
104
|
-
|
105
|
-
|
106
|
-
fullName
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
userId
|
112
|
-
avatar
|
113
|
-
email
|
114
|
-
phone
|
115
|
-
address
|
116
|
-
|
117
|
-
💳 generateCard()
|
118
|
-
cardNumber
|
119
|
-
cvv
|
120
|
-
expiry
|
121
|
-
|
122
|
-
🏠 generateAddress()
|
123
|
-
street
|
124
|
-
city
|
125
|
-
state
|
126
|
-
postalCode
|
127
|
-
country
|
128
|
-
|
129
|
-
🏦 generateInstitution()
|
130
|
-
institutionId
|
131
|
-
name
|
132
|
-
type
|
133
|
-
country
|
134
|
-
branchCode
|
135
|
-
contactEmail
|
136
|
-
phone
|
137
|
-
|
138
|
-
💰 generateTransaction()
|
139
|
-
amount
|
140
|
-
currency
|
141
|
-
type
|
142
|
-
date
|
143
|
-
merchant
|
144
|
-
transactionId
|
145
|
-
status
|
146
|
-
|
147
|
-
|
148
|
-
|
88
|
+
## 🧩 Available Generators
|
89
|
+
| Generator | Attributes |
|
90
|
+
|------------|-------------|
|
91
|
+
| 👤 **generateUser()** | fullName, firstName, lastName, username, password, userId, avatar, email, phone, address |
|
92
|
+
| 💳 **generateCard()** | cardNumber, cvv, expiry |
|
93
|
+
| 🏠 **generateAddress()** | street, city, state, postalCode, country |
|
94
|
+
| 🏦 **generateInstitution()** | institutionId, name, type, country, branchCode, contactEmail, phone |
|
95
|
+
| 💰 **generateTransaction()** | amount, currency, type, date, merchant, transactionId, status |
|
package/package.json
CHANGED