From aae2e621775e903f484a8a3d0b9c81188a818172 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Mon, 5 Aug 2024 19:59:40 +0800 Subject: [PATCH] Playwright: removed redundant tests --- test-playwright/00-confirm-test-api.spec.ts | 17 ------ .../01-check-activity-feed.spec.ts | 12 ---- .../02-check-discover-results.spec.ts | 12 ---- .../03-check-noid-messaging.spec.ts | 23 -------- .../04-check-id-generation.spec.ts | 21 ------- test-playwright/10-create-user-00.spec.ts | 17 ------ test-playwright/11-create-user-01.spec.ts | 17 ------ test-playwright/15-check-usage-limits.spec.ts | 28 ---------- .../21-create-project-search.spec.ts | 56 ------------------- 9 files changed, 203 deletions(-) delete mode 100644 test-playwright/00-confirm-test-api.spec.ts delete mode 100644 test-playwright/01-check-activity-feed.spec.ts delete mode 100644 test-playwright/02-check-discover-results.spec.ts delete mode 100644 test-playwright/03-check-noid-messaging.spec.ts delete mode 100644 test-playwright/04-check-id-generation.spec.ts delete mode 100644 test-playwright/10-create-user-00.spec.ts delete mode 100644 test-playwright/11-create-user-01.spec.ts delete mode 100644 test-playwright/15-check-usage-limits.spec.ts delete mode 100644 test-playwright/21-create-project-search.spec.ts diff --git a/test-playwright/00-confirm-test-api.spec.ts b/test-playwright/00-confirm-test-api.spec.ts deleted file mode 100644 index 698d334e5..000000000 --- a/test-playwright/00-confirm-test-api.spec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Confirm usage of test API', async ({ page }, testInfo) => { - // Load account view - await page.goto('./account'); - await page.getByRole('heading', { name: 'Advanced' }).click(); - - // look into the config file: if it starts Time Safari, it might say which server it should set by default - const webServer = testInfo.config.webServer; - const endorserWords = webServer?.command.split(' '); - const ENDORSER_ENV_NAME = 'VITE_DEFAULT_ENDORSER_API_SERVER'; - const endorserTerm = endorserWords?.find(word => word.startsWith(ENDORSER_ENV_NAME + '=')); - const endorserTermInConfig = endorserTerm?.substring(ENDORSER_ENV_NAME.length + 1); - - const endorserServer = endorserTermInConfig || 'https://test-api.endorser.ch'; - await expect(page.getByRole('textbox').nth(1)).toHaveValue(endorserServer); -}); \ No newline at end of file diff --git a/test-playwright/01-check-activity-feed.spec.ts b/test-playwright/01-check-activity-feed.spec.ts deleted file mode 100644 index c0d42340e..000000000 --- a/test-playwright/01-check-activity-feed.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Check activity feed', async ({ page }) => { - // Load app homepage - await page.goto('./'); - - // Check that initial 10 activities have been loaded - await page.locator('ul#listLatestActivity li:nth-child(10)'); - - // Scroll down a bit to trigger loading additional activities - await page.locator('ul#listLatestActivity li:nth-child(50)').scrollIntoViewIfNeeded(); -}); \ No newline at end of file diff --git a/test-playwright/02-check-discover-results.spec.ts b/test-playwright/02-check-discover-results.spec.ts deleted file mode 100644 index fa71f6a83..000000000 --- a/test-playwright/02-check-discover-results.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Check discover results', async ({ page }) => { - // Load Discover view - await page.goto('./discover'); - - // Check that initial 10 projects have been loaded - await page.locator('ul#listDiscoverResults li.border-b:nth-child(10)'); - - // Scroll down a bit to trigger loading additional projects - await page.locator('ul#listDiscoverResults li.border-b:nth-child(20)').scrollIntoViewIfNeeded(); -}); \ No newline at end of file diff --git a/test-playwright/03-check-noid-messaging.spec.ts b/test-playwright/03-check-noid-messaging.spec.ts deleted file mode 100644 index 4e855796c..000000000 --- a/test-playwright/03-check-noid-messaging.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Check no-ID messaging in homepage', async ({ page }) => { - // Load app homepage - await page.goto('./'); - - // Check 'someone must register you' notice - await expect(page.getByText('To share, someone must register you.')).toBeVisible(); -}); - -test('Check no-ID messaging in account', async ({ page }) => { - // Load account view - await page.goto('./account'); - - // Check 'someone must register you' notice - await expect(page.locator('#noticeBeforeShare')).toBeVisible(); - - // Check 'a friend needs to register you' notice - await expect(page.locator('#noticeBeforeAnnounce')).toBeVisible(); - - // Check that there is no ID - await expect(page.locator('#sectionIdentityDetails code.truncate')).toBeEmpty(); -}); \ No newline at end of file diff --git a/test-playwright/04-check-id-generation.spec.ts b/test-playwright/04-check-id-generation.spec.ts deleted file mode 100644 index 446e68668..000000000 --- a/test-playwright/04-check-id-generation.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Check ID generation', async ({ page }) => { - // Load Account view - await page.goto('./account'); - - // Check that ID is empty - await expect(page.locator('#sectionIdentityDetails code.truncate')).toBeEmpty(); - - // Load homepage to trigger ID generation (?) - await page.goto('./'); - - // Wait for activity feed to start loading, as a delay - await expect(page.locator('ul#listLatestActivity li:nth-child(10)')).toBeVisible(); - - // Go back to Account view - await page.goto('./account'); - - // Check that ID is now generated - await expect(page.locator('#sectionIdentityDetails code.truncate')).toContainText('did:ethr:'); -}); \ No newline at end of file diff --git a/test-playwright/10-create-user-00.spec.ts b/test-playwright/10-create-user-00.spec.ts deleted file mode 100644 index 1ffd84103..000000000 --- a/test-playwright/10-create-user-00.spec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Create user 00', async ({ page }) => { - // Create new ID using seed phrase "rigid shrug mobile…" - await page.goto('./start'); - await page.getByText('You have a seed').click(); - await page.getByPlaceholder('Seed Phrase').fill('rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage'); - await page.getByRole('button', { name: 'Import' }).click(); - - // Set name - await page.getByRole('link', { name: 'Set Your Name' }).click(); - await page.getByPlaceholder('Name').fill('User Zero'); - await page.getByRole('button', { name: 'Save Changes' }).click(); - - // Check DID - await expect(page.getByRole('code')).toContainText('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'); -}); \ No newline at end of file diff --git a/test-playwright/11-create-user-01.spec.ts b/test-playwright/11-create-user-01.spec.ts deleted file mode 100644 index 0d85b54b5..000000000 --- a/test-playwright/11-create-user-01.spec.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Create user 01', async ({ page }) => { - // Create new ID using seed phrase "island fever beef…" - await page.goto('./start'); - await page.getByText('You have a seed').click(); - await page.getByPlaceholder('Seed Phrase').fill('island fever beef wine urban aim vacant quit afford total poem flame service calm better adult neither color gaze forum month sister imitate excite'); - await page.getByRole('button', { name: 'Import' }).click(); - - // Set name - await page.getByRole('link', { name: 'Set Your Name' }).click(); - await page.getByPlaceholder('Name').fill('User One'); - await page.getByRole('button', { name: 'Save Changes' }).click(); - - // Check DID - await expect(page.getByRole('code')).toContainText('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39'); -}); \ No newline at end of file diff --git a/test-playwright/15-check-usage-limits.spec.ts b/test-playwright/15-check-usage-limits.spec.ts deleted file mode 100644 index 84d404542..000000000 --- a/test-playwright/15-check-usage-limits.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Check usage limits', async ({ page }) => { - // Check without ID first - await page.goto('./account'); - await expect(page.locator('div.bg-slate-100.rounded-md').filter({ hasText: 'Usage Limits' })).toBeHidden(); - - // Create new ID using seed phrase "island fever beef…" - await page.goto('./start'); - await page.getByText('You have a seed').click(); - await page.getByPlaceholder('Seed Phrase').fill('island fever beef wine urban aim vacant quit afford total poem flame service calm better adult neither color gaze forum month sister imitate excite'); - await page.getByRole('button', { name: 'Import' }).click(); - - // Set name - await page.getByRole('link', { name: 'Set Your Name' }).click(); - await page.getByPlaceholder('Name').fill('User One'); - await page.getByRole('button', { name: 'Save Changes' }).click(); - - // Check DID - await expect(page.getByRole('code')).toContainText('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39'); - - // Verify that "Usage Limits" section is visible - await expect(page.locator('#sectionUsageLimits')).toBeVisible(); - await expect(page.getByText('Your claims counter resets')).toBeVisible(); - await expect(page.getByText('Your registration counter resets')).toBeVisible(); - await expect(page.getByText('Your image counter resets')).toBeVisible(); - await expect(page.getByRole('button', { name: 'Recheck Limits' })).toBeVisible(); -}); \ No newline at end of file diff --git a/test-playwright/21-create-project-search.spec.ts b/test-playwright/21-create-project-search.spec.ts deleted file mode 100644 index cd72333ef..000000000 --- a/test-playwright/21-create-project-search.spec.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('Create new project, then search for it', async ({ page }) => { - // Generate a random string of 16 characters - let randomString = Math.random().toString(36).substring(2, 18); - - // In case the string is shorter than 16 characters, generate more characters until it is 16 characters long - while (randomString.length < 16) { - randomString += Math.random().toString(36).substring(2, 18); - } - const finalRandomString = randomString.substring(0, 16); - - // Standard texts - const standardTitle = "Idea "; - const standardDescription = "Description of Idea "; - - // Combine texts with the random string - const finalTitle = standardTitle + finalRandomString; - const finalDescription = standardDescription + finalRandomString; - - // Create new ID using seed phrase "rigid shrug mobile…" - await page.goto('./start'); - await page.getByText('You have a seed').click(); - await page.getByPlaceholder('Seed Phrase').fill('rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage'); - await page.getByRole('button', { name: 'Import' }).click(); - - // Set name - await page.getByRole('link', { name: 'Set Your Name' }).click(); - await page.getByPlaceholder('Name').fill('User Zero'); - await page.getByRole('button', { name: 'Save Changes' }).click(); - - // Pause for 5 seconds - await page.waitForTimeout(5000); // I have to wait, otherwise the (+) button to add a new project doesn't appear - - // Create new project - await page.goto('./projects'); - await page.getByRole('link', { name: 'Projects', exact: true }).click(); - await page.getByRole('button').click(); - await page.getByPlaceholder('Idea Name').fill(finalTitle); // Add random suffix - await page.getByPlaceholder('Description').fill(finalDescription); - await page.getByPlaceholder('Website').fill('https://example.com'); - await page.getByPlaceholder('Start Date').fill('2025-12-01'); - await page.getByPlaceholder('Start Time').fill('12:00'); - await page.getByRole('button', { name: 'Save Project' }).click(); - - // Check texts - await expect(page.locator('h2')).toContainText(finalTitle); - await expect(page.locator('#Content')).toContainText(finalDescription); - - // Search for project that was just created - await page.goto('./discover'); - await page.waitForTimeout(5000); // Wait for a bit - await page.getByPlaceholder('Search…').fill(finalRandomString); - await page.locator('#QuickSearch button').click(); - await expect(page.locator('ul#listDiscoverResults li.border-b:nth-child(1)')).toContainText(finalRandomString); -}); \ No newline at end of file