Browse Source

fix tests

playwright-pwa-install-test
Trent Larson 1 month ago
parent
commit
7cba232e44
  1. 2
      playwright.config-local.ts
  2. 17
      src/views/ContactsView.vue
  3. 4
      test-playwright/40-add-contact.spec.ts
  4. 4
      test-playwright/testUtils.ts

2
playwright.config-local.ts

@ -74,7 +74,7 @@ export default defineConfig({
/* Configure global timeout; default is 30000 milliseconds */ /* Configure global timeout; default is 30000 milliseconds */
// the image upload will often not succeed at 5 seconds // the image upload will often not succeed at 5 seconds
timeout: 15000, timeout: 20000,
/* Run your local dev server before starting the tests */ /* Run your local dev server before starting the tests */
/** /**

17
src/views/ContactsView.vue

@ -56,7 +56,7 @@
/> />
<button <button
href="" href=""
class="text-md bg-gradient-to-b shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1 py-1 ml-2 rounded-md" class="text-md bg-gradient-to-b shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white ml-2 px-1 py-1 rounded-md"
:style=" :style="
contactsSelected.length > 0 contactsSelected.length > 0
? 'background-image: linear-gradient(to bottom, #3b82f6, #1e40af);' ? 'background-image: linear-gradient(to bottom, #3b82f6, #1e40af);'
@ -226,10 +226,21 @@
</ul> </ul>
<p v-else>There are no contacts.</p> <p v-else>There are no contacts.</p>
<div class="w-full text-left"> <div class="mt-2 w-full text-left">
<input
type="checkbox"
v-if="!showGiveNumbers"
:checked="contactsSelected.length === contacts.length"
@click="
contactsSelected.length === contacts.length
? (contactsSelected = [])
: (contactsSelected = contacts.map((contact) => contact.did))
"
class="align-middle ml-2 h-6 w-6"
/>
<button <button
href="" href=""
class="text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1 py-1 rounded-md" class="text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white ml-2 px-1 py-1 rounded-md"
:style=" :style="
contactsSelected.length > 0 contactsSelected.length > 0
? 'background-image: linear-gradient(to bottom, #3b82f6, #1e40af);' ? 'background-image: linear-gradient(to bottom, #3b82f6, #1e40af);'

4
test-playwright/40-add-contact.spec.ts

@ -39,7 +39,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
await expect(page.locator('li.border-b')).toContainText('User #000'); await expect(page.locator('li.border-b')).toContainText('User #000');
// Rename contact // Rename contact
await page.locator('li.border-b h2 > a[title="See more about this person"]').click(); await page.locator('li.border-b div div > a[title="See more about this person"]').click();
await page.locator('h2 > button[title="Edit"]').click(); await page.locator('h2 > button[title="Edit"]').click();
await expect(page.locator('div.dialog-overlay > div.dialog').filter({ hasText: 'Edit Name' })).toBeVisible(); await expect(page.locator('div.dialog-overlay > div.dialog').filter({ hasText: 'Edit Name' })).toBeVisible();
await page.getByPlaceholder('Name', { exact: true }).fill(contactName); await page.getByPlaceholder('Name', { exact: true }).fill(contactName);
@ -83,4 +83,4 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
// Refresh claim page, Confirm button should be hidden // Refresh claim page, Confirm button should be hidden
await page.reload(); await page.reload();
await expect(page.getByRole('button', { name: 'Confirm' })).toBeHidden(); await expect(page.getByRole('button', { name: 'Confirm' })).toBeHidden();
}); });

4
test-playwright/testUtils.js → test-playwright/testUtils.ts

@ -1,6 +1,6 @@
import { expect } from '@playwright/test'; import { expect, Page } from '@playwright/test';
export async function importUser(page, id) { export async function importUser(page: Page, id?: string): Promise<void> {
let seedPhrase, userName, did; let seedPhrase, userName, did;
// Set seed phrase and DID based on user ID // Set seed phrase and DID based on user ID
Loading…
Cancel
Save