mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat: upgrade e2e test for new flow
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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-**');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user