forked from trent_larson/crowd-funder-for-time-pwa
Fix duplicate export declarations and migrate ContactsView with sub-components
- Remove duplicate NOTIFY_INVITE_MISSING and NOTIFY_INVITE_PROCESSING_ERROR exports - Update InviteOneAcceptView.vue to use correct NOTIFY_INVITE_TRUNCATED_DATA constant - Migrate ContactsView to PlatformServiceMixin and extract into modular sub-components - Resolves TypeScript compilation errors preventing web build
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { deleteContact, generateAndRegisterEthrUser, importUser, importUserAndCloseOnboarding } from './testUtils';
|
||||
import { deleteContact, generateAndRegisterEthrUser, importUser } from './testUtils';
|
||||
|
||||
test('Check activity feed - check that server is running', async ({ page }) => {
|
||||
// Load app homepage
|
||||
@@ -144,97 +144,32 @@ test('Check ID generation', async ({ page }) => {
|
||||
|
||||
|
||||
test('Check setting name & sharing info', async ({ page }) => {
|
||||
// Do NOT import a user; start with a fresh, unregistered user state
|
||||
|
||||
function now() {
|
||||
return new Date().toISOString();
|
||||
}
|
||||
|
||||
// Start by loading the homepage and looking for the onboarding notice and button
|
||||
// Load homepage to trigger ID generation (?)
|
||||
await page.goto('./');
|
||||
|
||||
// Wait for page to fully load and check for overlays
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Loop to close all visible overlays/dialogs before proceeding
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const overlayCount = await page.locator('.dialog-overlay').count();
|
||||
if (overlayCount === 0) break;
|
||||
|
||||
// Try to close the overlay with various known close button texts
|
||||
const closeButtons = [
|
||||
"That's enough help, thanks.",
|
||||
'Close',
|
||||
'Cancel',
|
||||
'Dismiss',
|
||||
'Got it',
|
||||
'OK'
|
||||
];
|
||||
|
||||
let closed = false;
|
||||
for (const buttonText of closeButtons) {
|
||||
const button = page.getByRole('button', { name: buttonText });
|
||||
if (await button.count() > 0) {
|
||||
await button.click();
|
||||
closed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If no text button found, try the close icon (xmark)
|
||||
if (!closed) {
|
||||
const closeIcon = page.locator('.fa-xmark, .fa-times, [aria-label*="close"], [aria-label*="Close"]');
|
||||
if (await closeIcon.count() > 0) {
|
||||
await closeIcon.first().click();
|
||||
closed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!closed) break;
|
||||
|
||||
// Wait a bit for the overlay to close
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
// Check 'someone must register you' notice
|
||||
await expect(page.getByText('someone must register you.')).toBeVisible();
|
||||
|
||||
// Click the "Show them" button
|
||||
await page.getByRole('button', { name: 'Show them' }).click();
|
||||
|
||||
// Wait for the "Set Your Name" dialog to appear
|
||||
await page.getByRole('button', { name: /Show them/}).click();
|
||||
// fill in a name
|
||||
await expect(page.getByText('Set Your Name')).toBeVisible();
|
||||
|
||||
// Fill in the name
|
||||
await page.getByRole('textbox').fill('Test User');
|
||||
|
||||
// Click Save
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
|
||||
// Wait for the choice dialog to appear
|
||||
await expect(page.getByText('We will share some other way')).toBeVisible();
|
||||
|
||||
// Click "We will share some other way"
|
||||
await page.getByRole('button', { name: 'We will share some other way' }).click();
|
||||
|
||||
// Wait up to 10 seconds for the heading
|
||||
await expect(page.getByRole('heading', { name: 'Share Your Contact Info' })).toBeVisible({ timeout: 10000 });
|
||||
|
||||
// Click the Copy to Clipboard button
|
||||
await expect(page.getByRole('button', { name: 'Copy contact information to clipboard' })).toBeVisible({ timeout: 10000 });
|
||||
await page.getByRole('button', { name: 'Copy contact information to clipboard' }).click();
|
||||
|
||||
// Wait for either the notification or navigation to contacts
|
||||
try {
|
||||
await expect(page.getByText('contact info was copied')).toBeVisible({ timeout: 10000 });
|
||||
} catch {
|
||||
await expect(page.getByText('your contacts')).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
await page.getByRole('textbox').fill('Me Test User');
|
||||
await page.locator('button:has-text("Save")').click();
|
||||
await expect(page.getByText('share some other way')).toBeVisible();
|
||||
await page.getByRole('button', { name: /share some other way/ }).click();
|
||||
await expect(page.getByRole('button', { name: 'copy to clipboard' })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'copy to clipboard' }).click();
|
||||
await expect(page.getByText('contact info was copied')).toBeVisible();
|
||||
// dismiss alert and wait for it to go away
|
||||
await page.locator('div[role="alert"] button > svg.fa-xmark').click();
|
||||
await expect(page.getByText('contact info was copied')).toBeHidden();
|
||||
// check that they're on the Contacts screen
|
||||
await expect(page.getByText('your contacts')).toBeVisible();
|
||||
});
|
||||
|
||||
test('Confirm test API setting (may fail if you are running your own Time Safari)', async ({ page }, testInfo) => {
|
||||
// Load account view
|
||||
await page.goto('./account');
|
||||
await page.getByRole('heading', { name: 'Advanced' }).click();
|
||||
await page.getByTestId('advancedSettings').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;
|
||||
@@ -243,24 +178,8 @@ test('Confirm test API setting (may fail if you are running your own Time Safari
|
||||
const endorserTerm = endorserWords?.find(word => word.startsWith(ENDORSER_ENV_NAME + '='));
|
||||
const endorserTermInConfig = endorserTerm?.substring(ENDORSER_ENV_NAME.length + 1);
|
||||
|
||||
const expectedEndorserServer = endorserTermInConfig || 'https://test-api.endorser.ch';
|
||||
|
||||
// Get the actual value from the input field
|
||||
const actualValue = await page.locator('#apiServerInput').inputValue();
|
||||
|
||||
// Check if the field has a value (not empty)
|
||||
if (actualValue) {
|
||||
// If it has a value, check if it matches the expected server (allowing for localhost/127.0.0.1 variations)
|
||||
const normalizedExpected = expectedEndorserServer.replace('localhost', '127.0.0.1');
|
||||
const normalizedActual = actualValue.replace('localhost', '127.0.0.1');
|
||||
|
||||
if (normalizedExpected !== normalizedActual) {
|
||||
throw new Error(`API server mismatch. Expected: "${expectedEndorserServer}" (or localhost equivalent), Got: "${actualValue}"`);
|
||||
}
|
||||
} else {
|
||||
// If the field is empty, that's also acceptable (might be using default)
|
||||
// Field is empty, which is acceptable for default configuration
|
||||
}
|
||||
const endorserServer = endorserTermInConfig || 'https://test-api.endorser.ch';
|
||||
await expect(page.locator('#apiServerInput')).toHaveValue(endorserServer);
|
||||
});
|
||||
|
||||
test('Check User 0 can register a random person', async ({ page }) => {
|
||||
@@ -270,13 +189,7 @@ test('Check User 0 can register a random person', async ({ page }) => {
|
||||
|
||||
await page.goto('./');
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
|
||||
// Click the "Person" button to open the gift recording dialog
|
||||
await page.getByRole('button', { name: 'Person' }).click();
|
||||
|
||||
// In the dialog, click on "Unnamed" to select it as the giver
|
||||
await page.getByRole('heading', { name: 'Unnamed' }).first().click();
|
||||
|
||||
await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click();
|
||||
await page.getByPlaceholder('What was given').fill('Gave me access!');
|
||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user