cypress-playwright-data-gen 1.0.6 → 1.0.7
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 +6 -26
- 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:
|
23
22
|
|
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', () => {
|
23
|
+
it('uses generated user data for a signup-style test', () => {
|
31
24
|
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
|
-
*/
|
25
|
+
/** Just an example — OrangeHRM doesn’t have public signup, so let’s imagine we were testing a form or registration flow: **/
|
35
26
|
cy.visit('https://example.com/register');
|
36
27
|
cy.get('#firstName').type(user.firstName);
|
37
28
|
cy.get('#lastName').type(user.lastName);
|
@@ -49,7 +40,6 @@ describe('OrangeHRM Demo Login', () => {
|
|
49
40
|
cy.log(`CVV: ${card.cvv}`);
|
50
41
|
});
|
51
42
|
});
|
52
|
-
});
|
53
43
|
|
54
44
|
|
55
45
|
##############################################################################
|
@@ -61,39 +51,29 @@ import { generateUser, generateCard, generateAddress, generateTransaction, gener
|
|
61
51
|
|
62
52
|
|
63
53
|
Then you can use them anywhere in your Playwright tests:
|
64
|
-
|
65
54
|
import { test, expect } from '@playwright/test';
|
66
55
|
import { generateUser, generateCard } from 'cypress-playwright-data-gen/playwright/utils';
|
67
|
-
|
68
|
-
test.describe('OrangeHRM Demo Login', () => {
|
69
|
-
test.beforeEach(async ({ page }) => {
|
70
|
-
await page.goto('https://opensource-demo.orangehrmlive.com/web/index.php/auth/login');
|
71
|
-
});
|
72
|
-
|
56
|
+
/** Just an example — OrangeHRM doesn’t have public signup, so let’s imagine we were testing a form or registration flow: **/
|
73
57
|
test('uses generated user data for a signup-style test', async ({ page }) => {
|
74
58
|
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
59
|
await page.goto('https://example.com/register');
|
81
60
|
await page.fill('#firstName', user.firstName);
|
82
61
|
await page.fill('#lastName', user.lastName);
|
83
62
|
await page.fill('#email', user.email);
|
84
63
|
await page.fill('#password', user.password);
|
85
64
|
await page.click('#submit');
|
86
|
-
|
87
65
|
console.log(`Generated user: ${user.firstName} ${user.lastName}, email: ${user.email}`);
|
88
66
|
});
|
89
67
|
|
68
|
+
/**
|
69
|
+
* Just an example
|
70
|
+
*/
|
90
71
|
test('generates card data for payment-related tests', async () => {
|
91
72
|
const card = generateCard();
|
92
73
|
console.log(`Card Number: ${card.number}`);
|
93
74
|
console.log(`Expiry: ${card.expiryMonth}/${card.expiryYear}`);
|
94
75
|
console.log(`CVV: ${card.cvv}`);
|
95
76
|
});
|
96
|
-
});
|
97
77
|
|
98
78
|
|
99
79
|
|
package/package.json
CHANGED