feat: upgrade e2e test for new flow

This commit is contained in:
Arman
2024-05-22 17:53:39 +02:00
parent ea5ccb876d
commit 04fe869e35
3 changed files with 10 additions and 20 deletions
@@ -75,7 +75,7 @@
}
if ($page.url.searchParams.has('plan')) {
const plan = $page.url.searchParams.get('plan');
if (plan && plan in BillingPlan) {
if (plan && Object.values(BillingPlan).includes(plan as BillingPlan)) {
billingPlan = plan as BillingPlan;
}
}
+5 -6
View File
@@ -1,20 +1,19 @@
import { test } from '@playwright/test';
import { registerUserStep } from '../steps/account';
import { createFreeProject } from '../steps/free-project';
import { enterAddress, enterCreditCard } from '../steps/pro-project';
import { enterCreditCard } from '../steps/pro-project';
test('upgrade - free tier', async ({ page }) => {
await registerUserStep(page);
await createFreeProject(page);
await test.step('upgrade project', async () => {
await page.getByRole('button', { name: 'upgrade' }).click();
await page.getByRole('link', { name: 'upgrade' }).click();
await page.waitForURL('/console/organization-**/change-plan');
await page.locator('input[value="tier-1"]').click();
await page.getByRole('button', { name: 'next' }).click();
await page.getByRole('button', { name: ' Add', exact: true }).click();
await enterCreditCard(page);
await enterAddress(page);
// skip members
await page.getByRole('button', { name: 'next' }).click();
await page.getByRole('button', { name: 'create' }).click();
await page.getByRole('button', { name: 'change plan' }).click();
await page.waitForURL('/console/organization-**');
});
});
+4 -13
View File
@@ -13,15 +13,7 @@ export async function enterCreditCard(page: Page) {
await stripe.locator('id=Field-expiryInput').fill('1250');
await stripe.locator('id=Field-cvcInput').fill('123');
await stripe.locator('id=Field-countryInput').selectOption('DE');
await page.getByRole('button', { name: 'Next' }).click();
}
export async function enterAddress(page: Page) {
await page.locator('id=country').selectOption('US');
await page.locator('id=address').fill('123 Test St');
await page.locator('id=city').fill('Test City');
await page.locator('id=state').fill('Test State');
await page.getByRole('button', { name: 'Next' }).click();
await page.getByRole('button', { name: 'Add', exact: true }).click();
}
export async function createProProject(page: Page): Promise<Metadata> {
@@ -31,12 +23,11 @@ export async function createProProject(page: Page): Promise<Metadata> {
await page.locator('id=name').fill('test org');
await page.locator('id=plan').selectOption('tier-1');
await page.getByRole('button', { name: 'get started' }).click();
await page.waitForURL('/console/create-organization**');
await page.getByRole('button', { name: ' Add', exact: true }).click();
await enterCreditCard(page);
await enterAddress(page);
// skip members
await page.getByRole('button', { name: 'next' }).click();
// start pro trial
await page.getByRole('button', { name: 'create' }).click();
await page.getByRole('button', { name: 'create organization' }).click();
await page.waitForURL('/console/organization-**');
return getOrganizationIdFromUrl(page.url());