diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 000000000..101089e1e --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,33 @@ +name: E2E + +on: + pull_request: + branches: ['**'] + paths-ignore: + - '**/*.md' + - 'static/**/*' + +env: + VITE_STRIPE_PUBLIC_KEY: ${{ vars.VITE_STRIPE_PUBLIC_KEY }} + +jobs: + e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Install dependencies + run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps chromium + - name: E2E Tests + run: npm run e2e + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: playwright-report + path: playwright-report/ + retention-days: 7 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a0490076e..a93dc1709 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,6 @@ jobs: - name: Linter run: npm run lint - name: Unit Tests - run: npm test + run: npm run test - name: Build Console run: npm run build diff --git a/.gitignore b/.gitignore index 27cc4e27e..ec4979cd0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ node_modules .env .env.* !.env.example +test-results/ +playwright-report/ .DS_STORE .cache @@ -145,4 +147,4 @@ dist .stylelintcache # SvelteKit build / generate output -.svelte-kit \ No newline at end of file +.svelte-kit diff --git a/package-lock.json b/package-lock.json index 297059d46..1f4aae1c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "@appwrite/console", "dependencies": { - "@appwrite.io/console": "^0.6.1", + "@appwrite.io/console": "^0.6.2", "@appwrite.io/pink": "0.20.0", "@appwrite.io/pink-icons": "0.20.0", "@popperjs/core": "^2.11.8", @@ -29,7 +29,7 @@ "devDependencies": { "@melt-ui/pp": "^0.1.4", "@melt-ui/svelte": "^0.61.2", - "@playwright/test": "^1.37.1", + "@playwright/test": "^1.44.0", "@sveltejs/adapter-static": "^3.0.1", "@sveltejs/kit": "^2.3.4", "@sveltejs/vite-plugin-svelte": "^3.0.1", @@ -157,13 +157,9 @@ "integrity": "sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==" }, "node_modules/@appwrite.io/console": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-0.6.1.tgz", - "integrity": "sha512-XlyitzDGmuBzJLBtFuZzL9vS4ZgAWzxuvWrILc7LwdNh2oklzhbJ8BTO8/CAxjxOwR6UOLKjXdoQnqOMqR66Yw==", - "dependencies": { - "cross-fetch": "3.1.5", - "isomorphic-form-data": "2.0.0" - } + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-0.6.2.tgz", + "integrity": "sha512-3qYknuFwhvTN2GnPB8G1w5DgxfVorGtfj4uuEaXbTmMUmjA8fHaW5VkJriuUxCi6/TpxDxqV/hhEkdoXL+5H4w==" }, "node_modules/@appwrite.io/pink": { "version": "0.20.0", @@ -1895,12 +1891,12 @@ } }, "node_modules/@playwright/test": { - "version": "1.43.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.1.tgz", - "integrity": "sha512-HgtQzFgNEEo4TE22K/X7sYTYNqEMMTZmFS8kTq6m8hXj+m1D8TgwgIbumHddJa9h4yl4GkKb8/bgAl2+g7eDgA==", + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.44.0.tgz", + "integrity": "sha512-rNX5lbNidamSUorBhB4XZ9SQTjAqfe5M+p37Z8ic0jPFBMo5iCtQz1kRWkEMg+rYOKSlVycpQmpqjSFq7LXOfg==", "dev": true, "dependencies": { - "playwright": "1.43.1" + "playwright": "1.44.0" }, "bin": { "playwright": "cli.js" @@ -3452,7 +3448,8 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true }, "node_modules/available-typed-arrays": { "version": "1.0.7", @@ -3945,6 +3942,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -4002,14 +4000,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dependencies": { - "node-fetch": "2.6.7" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -4223,6 +4213,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, "engines": { "node": ">=0.4.0" } @@ -4954,19 +4945,6 @@ "is-callable": "^1.1.3" } }, - "node_modules/form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -5782,14 +5760,6 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "node_modules/isomorphic-form-data": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-form-data/-/isomorphic-form-data-2.0.0.tgz", - "integrity": "sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==", - "dependencies": { - "form-data": "^2.3.2" - } - }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -7107,6 +7077,7 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, "engines": { "node": ">= 0.6" } @@ -7115,6 +7086,7 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, "dependencies": { "mime-db": "1.52.0" }, @@ -7236,44 +7208,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -7678,12 +7612,12 @@ } }, "node_modules/playwright": { - "version": "1.43.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.1.tgz", - "integrity": "sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA==", + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.44.0.tgz", + "integrity": "sha512-F9b3GUCLQ3Nffrfb6dunPOkE5Mh68tR7zN32L4jCk4FjQamgesGay7/dAAe1WaMEGV04DkdJfcJzjoCKygUaRQ==", "dev": true, "dependencies": { - "playwright-core": "1.43.1" + "playwright-core": "1.44.0" }, "bin": { "playwright": "cli.js" @@ -7696,9 +7630,9 @@ } }, "node_modules/playwright-core": { - "version": "1.43.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.1.tgz", - "integrity": "sha512-EI36Mto2Vrx6VF7rm708qSnesVQKbxEWvPrfA1IPY6HgczBplDx7ENtx+K2n4kJ41sLLkuGfmb0ZLSSXlDhqPg==", + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.44.0.tgz", + "integrity": "sha512-ZTbkNpFfYcGWohvTTl+xewITm7EOuqIqex0c7dNZ+aXsbrLj0qI8XlGKfPpipjm0Wny/4Lt4CJsWJk1stVS5qQ==", "dev": true, "bin": { "playwright-core": "cli.js" diff --git a/package.json b/package.json index d0362023e..7f8ad03b2 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,11 @@ "test": "TZ=EST vitest run", "test:ui": "TZ=EST vitest --ui", "test:watch": "TZ=EST vitest watch", - "e2e": "playwright test tests/e2e" + "e2e": "playwright test tests/e2e", + "e2e:ui": "playwright test tests/e2e --ui" }, "dependencies": { - "@appwrite.io/console": "^0.6.1", + "@appwrite.io/console": "^0.6.2", "@appwrite.io/pink": "0.20.0", "@appwrite.io/pink-icons": "0.20.0", "@popperjs/core": "^2.11.8", @@ -41,7 +42,7 @@ "devDependencies": { "@melt-ui/pp": "^0.1.4", "@melt-ui/svelte": "^0.61.2", - "@playwright/test": "^1.37.1", + "@playwright/test": "^1.44.0", "@sveltejs/adapter-static": "^3.0.1", "@sveltejs/kit": "^2.3.4", "@sveltejs/vite-plugin-svelte": "^3.0.1", diff --git a/playwright.config.ts b/playwright.config.ts index 58a0a3191..d330159b0 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,7 +1,15 @@ import { type PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { + timeout: 120000, + reportSlowTests: null, + reporter: [['html', { open: 'never' }]], webServer: { + timeout: 120000, + env: { + VITE_APPWRITE_ENDPOINT: 'http://console-tests.appwrite.org/v1', + VITE_CONSOLE_MODE: 'cloud' + }, command: 'npm run build && npm run preview', port: 4173 } diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 93119dbbb..744a4e351 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -157,6 +157,7 @@ export enum Submit { AccountAuthenticatorDelete = 'submit_account_authenticator_delete', AccountRecoveryCodesCreate = 'submit_account_recovery_codes_create', AccountRecoveryCodesUpdate = 'submit_account_recovery_codes_update', + AccountDeleteIdentity = 'submit_account_delete_identity', UserCreate = 'submit_user_create', UserDelete = 'submit_user_delete', UserUpdateEmail = 'submit_user_update_email', diff --git a/src/lib/components/billing/emptyCardCloud.svelte b/src/lib/components/billing/emptyCardCloud.svelte new file mode 100644 index 000000000..ff17d1174 --- /dev/null +++ b/src/lib/components/billing/emptyCardCloud.svelte @@ -0,0 +1,37 @@ + + + + +
+
Upgrade to add {service}
+

+ Upgrade to a {tierToPlan(BillingPlan.PRO).name} plan to add {service} to your organization +

+ + +
+
+
diff --git a/src/lib/components/billing/index.ts b/src/lib/components/billing/index.ts index 0d7a98daa..cfa72bd54 100644 --- a/src/lib/components/billing/index.ts +++ b/src/lib/components/billing/index.ts @@ -1,2 +1,3 @@ export { default as PaymentBoxes } from './paymentBoxes.svelte'; export { default as CouponInput } from './couponInput.svelte'; +export { default as EmptyCardCloud } from './emptyCardCloud.svelte'; diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index 685b34d63..da5859ab4 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -73,3 +73,4 @@ export { default as RadioBoxes } from './radioBoxes.svelte'; export { default as ModalWrapper } from './modalWrapper.svelte'; export { default as ModalSideCol } from './modalSideCol.svelte'; export { default as ImagePreview } from './imagePreview.svelte'; +export { default as MfaChallengeFormList } from './mfaChallengeFormList.svelte'; diff --git a/src/lib/components/mfaChallengeFormList.svelte b/src/lib/components/mfaChallengeFormList.svelte new file mode 100644 index 000000000..96e77daf2 --- /dev/null +++ b/src/lib/components/mfaChallengeFormList.svelte @@ -0,0 +1,134 @@ + + + + + + {#if challengeType == AuthenticationFactor.Recoverycode} +

+ Enter below one of the recovery codes you received when enabling MFA for this account. +

+ + {:else} + {#if factors.totp && (challengeType == AuthenticationFactor.Totp || challengeType == null)} +

Enter below a 6-digit one-time code generated by your authentication app.

+ {:else if challengeType == AuthenticationFactor.Email} +

A 6-digit verification code was sent to your email, enter it below.

+ {:else if challengeType == AuthenticationFactor.Phone} +

A 6-digit verification code was sent to your phone, enter it below.

+ {/if} + + {/if} + {#if showVerifyButton} + + + + {/if} + {#if enabledFactors.length > 1} + or +
+ {#if factors.totp && challengeType != null && challengeType != AuthenticationFactor.Totp} + + + + {/if} + {#if factors.email && challengeType != AuthenticationFactor.Email} + + + + {/if} + {#if factors.phone && challengeType != AuthenticationFactor.Phone} + + + + {/if} + {#if factors.recoveryCode && challengeType != AuthenticationFactor.Recoverycode} + + + + {/if} +
+ {/if} +
diff --git a/src/lib/components/paginator.svelte b/src/lib/components/paginator.svelte index 36849247a..e40e95103 100644 --- a/src/lib/components/paginator.svelte +++ b/src/lib/components/paginator.svelte @@ -3,6 +3,7 @@ export let items = []; export let limit = 5; + export let hideFooter = false; let offset = 0; @@ -10,9 +11,11 @@ $: paginatedItems = items.slice(offset, offset + limit); - + -
-

Total results: {total}

- -
+{#if !hideFooter} +
+

Total results: {total}

+ +
+{/if} diff --git a/src/lib/components/permissions/row.svelte b/src/lib/components/permissions/row.svelte index ba87e0e38..b8cb07ebd 100644 --- a/src/lib/components/permissions/row.svelte +++ b/src/lib/components/permissions/row.svelte @@ -118,8 +118,8 @@