Branchwell

Jotley / website · jotley.ai / e2e / free-app.spec.ts

1import { test, expect } from '@playwright/test';
2
3const retiredRoutes = [
4 '/signin', '/account', '/account-deleted', '/subscription-check',
5 '/post-auth-redirect', '/mac-app-success',
6];
7
8test.describe('Free app website', () => {
9 test('browsing the site never starts account or billing requests', async ({ page }) => {
10 const retiredRequests: string[] = [];
11 page.on('request', (request) => {
12 if (/supabase|stripe|\/api\/(?:users|subscription|auth)/i.test(request.url())) {
13 retiredRequests.push(request.url());
14 }
15 });
16 for (const route of ['/', '/download', '/support', '/privacy', '/tos']) {
17 await page.goto(route);
18 await expect(page.getByRole('heading').first()).toBeVisible();
19 await expect(page.locator('body')).toContainText(/free and open source|completely free\. open source/i);
20 if (route !== '/download') {
21 await expect(page.locator('body')).toContainText(/no subscriptions/i);
22 await expect(page.locator('body')).toContainText(/no in-app purchases/i);
23 }
24 await expect(page.locator('a[href*="signin"], a[href*="account"], a[href*="subscription"], a[href*="stripe"], a[href*="buymeacoffee"], a[href="/tips"]')).toHaveCount(0);
25 await expect(page.locator('body')).not.toContainText(/buy me a coffee|leave a tip|\$9\.99|paid support/i);
26 await expect(page.getByRole('button', { name: /get essential|get unlimited|sign in/i })).toHaveCount(0);
27 await expect(page.locator('body')).not.toContainText(/upgrade when|billed monthly|billing cycle|subscription-based|Deepgram|OpenAI|Supabase|Stripe|YouTube|web(?:site)?(?: page)? imports|imports from the web|importing content from the web/i);
28 }
29 expect(retiredRequests).toEqual([]);
30 });
31
32 test('FAQ explains open source, no purchases and locked-device transcription', async ({ page }) => {
33 await page.goto('/');
34 await page.getByRole('button', { name: 'Is Jotley free?' }).click();
35 await expect(page.locator('.faq-item.open')).toContainText('completely free');
36 await expect(page.locator('.faq-item.open')).toContainText('No subscriptions, no in-app purchases, no paid upgrades');
37 await expect(page.locator('.faq-item.open')).toContainText('No strings attached.');
38 await page.getByRole('button', { name: 'Does Jotley keep transcribing when my iPhone is locked?' }).click();
39 await expect(page.locator('.faq-item.open')).toContainText('keeps transcribing when your device is locked');
40 await expect(page.locator('.faq-item.open')).toContainText('Private iCloud sync is on by default');
41 });
42
43 test('MIT terms allow using and modifying the app', async ({ page }) => {
44 await page.goto('/tos');
45 await expect(page.getByRole('heading', { name: '9. Source License', exact: true })).toBeVisible();
46 await expect(page.locator('body')).toContainText('MIT license');
47 await expect(page.locator('body')).not.toContainText(/reverse-engineer or decompile|No rights are granted except/);
48 });
49
50 test('Mac installer is available through an explicit download button', async ({ page, request }) => {
51 const manifestResponse = await request.get('/mac-release.json');
52 expect(manifestResponse.ok()).toBeTruthy();
53 const manifest = await manifestResponse.json();
54 await page.goto('/download');
55 const download = page.waitForEvent('download');
56 await page.getByRole('link', { name: 'Download Jotley for Mac', exact: true }).click();
57 expect((await download).suggestedFilename()).toBe(manifest.file);
58 await expect(page.getByRole('link', { name: 'Download Jotley for Mac', exact: true })).toHaveAttribute('href', `/${manifest.file}`);
59 await expect(page).toHaveURL(/\/download$/);
60 });
61
62 for (const route of retiredRoutes) {
63 test(`retired route ${route} returns 404`, async ({ page }) => {
64 const response = await page.goto(route);
65 expect(response?.status()).toBe(404);
66 });
67 }
68
69 test('retired installers are no longer served', async ({ request }) => {
70 for (const path of ['/Jotley-1.0.38-b314.dmg', '/Jotley314-313.delta']) {
71 const response = await request.get(path);
72 expect(response.status()).toBe(404);
73 }
74 });
75
76 test('sitemap contains only public site pages', async ({ request }) => {
77 const response = await request.get('/sitemap.xml');
78 expect(response.ok()).toBeTruthy();
79 const sitemap = await response.text();
80 for (const route of retiredRoutes) expect(sitemap).not.toContain(route);
81 expect(sitemap).toContain('https://jotley.ai/support');
82 expect(sitemap).not.toContain('https://jotley.ai/tips');
83 });
84});