Checkout: minimize registration data
This commit is contained in:
@@ -171,12 +171,20 @@ async function completeRegistrationOrLogin(page: Page, credentials: { email: str
|
||||
await page.fill('input[name="first_name"]', 'Play');
|
||||
await page.fill('input[name="last_name"]', 'Wright');
|
||||
await page.fill('input[name="email"]', credentials.email);
|
||||
await page.fill('input[name="address"]', 'Teststrasse 1, 12345 Berlin');
|
||||
await page.fill('input[name="phone"]', '+49123456789');
|
||||
const addressInput = page.locator('input[name="address"]');
|
||||
if (await addressInput.isVisible()) {
|
||||
await addressInput.fill('Teststrasse 1, 12345 Berlin');
|
||||
}
|
||||
|
||||
const username = credentials.email.split('@')[0]?.replace(/[^a-z0-9]+/gi, '-') ?? `playwright-${Date.now()}`;
|
||||
await page.fill('input[name="username"]', username);
|
||||
const phoneInput = page.locator('input[name="phone"]');
|
||||
if (await phoneInput.isVisible()) {
|
||||
await phoneInput.fill('+49123456789');
|
||||
}
|
||||
|
||||
const usernameInput = page.locator('input[name="username"]');
|
||||
if (await usernameInput.isVisible()) {
|
||||
await usernameInput.fill(credentials.email);
|
||||
}
|
||||
await page.fill('input[name="password"]', credentials.password);
|
||||
await page.fill('input[name="password_confirmation"]', credentials.password);
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ test.describe('Standard package checkout with Paddle completion', () => {
|
||||
const unique = Date.now();
|
||||
const email = `checkout+${unique}@example.test`;
|
||||
const password = 'Password123!';
|
||||
const username = `playwright-${unique}`;
|
||||
|
||||
await page.addInitScript(() => {
|
||||
window.__openedWindows = [];
|
||||
const originalOpen = window.open;
|
||||
@@ -87,9 +85,20 @@ test.describe('Standard package checkout with Paddle completion', () => {
|
||||
await page.fill('input[name="first_name"]', 'Playwright');
|
||||
await page.fill('input[name="last_name"]', 'Tester');
|
||||
await page.fill('input[name="email"]', email);
|
||||
await page.fill('input[name="phone"]', '+49123456789');
|
||||
await page.fill('input[name="address"]', 'Teststr. 1, 12345 Berlin');
|
||||
await page.fill('input[name="username"]', username);
|
||||
const addressInput = page.locator('input[name="address"]');
|
||||
if (await addressInput.isVisible()) {
|
||||
await addressInput.fill('Teststr. 1, 12345 Berlin');
|
||||
}
|
||||
|
||||
const phoneInput = page.locator('input[name="phone"]');
|
||||
if (await phoneInput.isVisible()) {
|
||||
await phoneInput.fill('+49123456789');
|
||||
}
|
||||
|
||||
const usernameInput = page.locator('input[name="username"]');
|
||||
if (await usernameInput.isVisible()) {
|
||||
await usernameInput.fill(email);
|
||||
}
|
||||
await page.fill('input[name="password"]', password);
|
||||
await page.fill('input[name="password_confirmation"]', password);
|
||||
await page.check('input[name="privacy_consent"]');
|
||||
|
||||
Reference in New Issue
Block a user