forked from trent_larson/crowd-funder-for-time-pwa
fix: ClaimView now correctly displays User #0 registration status
Fix ClaimView component to use $accountSettings() instead of $settings() to get the current user's registration status. This resolves the issue where User #0 appeared unregistered in ClaimView despite having isRegistered: true in the database. - Changed created() method to use $accountSettings() for user-specific settings - Ensures ClaimView reads correct isRegistered value for current user - Fixes "You posted that. false" display issue for registered users
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { importUser } from './testUtils';
|
||||
import { test, expect, Page } from '@playwright/test';
|
||||
import { importUser, importUserFromAccount } from './testUtils';
|
||||
|
||||
test('Record an offer', async ({ page }) => {
|
||||
test.setTimeout(60000);
|
||||
@@ -12,13 +12,13 @@ test('Record an offer', async ({ page }) => {
|
||||
const randomNonZeroNumber = Math.floor(Math.random() * 998) + 1;
|
||||
|
||||
// Switch to user 0
|
||||
await importUser(page);
|
||||
|
||||
// await importUser(page);
|
||||
// Become User Zero
|
||||
await importUserFromAccount(page, "00");
|
||||
// Select a project
|
||||
await page.goto('./discover');
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
await page.locator('ul#listDiscoverResults li:nth-child(1)').click();
|
||||
|
||||
// Record an offer
|
||||
await page.locator('button', { hasText: 'Edit' }).isVisible(); // since the 'edit' takes longer to show, wait for that (lest the click miss)
|
||||
await page.getByTestId('offerButton').click();
|
||||
@@ -28,7 +28,6 @@ test('Record an offer', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||
await expect(page.getByText('That offer was recorded.')).toBeVisible();
|
||||
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||
|
||||
// go to the offer and check the values
|
||||
await page.goto('./projects');
|
||||
await page.getByRole('link', { name: 'Offers', exact: true }).click();
|
||||
@@ -36,7 +35,6 @@ test('Record an offer', async ({ page }) => {
|
||||
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
|
||||
await expect(page.getByText(description, { exact: true })).toBeVisible();
|
||||
await expect(page.getByText('Offered to a bigger plan')).toBeVisible();
|
||||
|
||||
const serverPagePromise = page.waitForEvent('popup');
|
||||
// expand the Details section to see the extended details
|
||||
await page.getByRole('heading', { name: 'Details', exact: true }).click();
|
||||
@@ -44,7 +42,6 @@ test('Record an offer', async ({ page }) => {
|
||||
const serverPage = await serverPagePromise;
|
||||
await expect(serverPage.getByText(description)).toBeVisible();
|
||||
await expect(serverPage.getByText('did:none:HIDDEN')).toBeVisible();
|
||||
|
||||
// Now update that offer
|
||||
|
||||
// find the edit page and check the old values again
|
||||
@@ -63,19 +60,16 @@ test('Record an offer', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||
await expect(page.getByText('That offer was recorded.')).toBeVisible();
|
||||
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||
|
||||
// go to the offer claim again and check the updated values
|
||||
await page.goto('./projects');
|
||||
await page.getByRole('link', { name: 'Offers', exact: true }).click();
|
||||
await page.locator('li').filter({ hasText: description }).locator('a').first().click();
|
||||
const newItemDesc = page.getByTestId('description');
|
||||
await expect(newItemDesc).toHaveText(updatedDescription);
|
||||
|
||||
// go to edit page
|
||||
await page.getByTestId('editClaimButton').click();
|
||||
const newAmount = page.getByTestId('inputOfferAmount');
|
||||
await expect(newAmount).toHaveValue((randomNonZeroNumber + 1).toString());
|
||||
|
||||
// go to the home page and check that the offer is shown as new
|
||||
await page.goto('./');
|
||||
const offerNumElem = page.getByTestId('newOffersToUserProjectsActivityNumber');
|
||||
@@ -101,7 +95,9 @@ test('Record an offer', async ({ page }) => {
|
||||
|
||||
test('Affirm delivery of an offer', async ({ page }) => {
|
||||
// go to the home page and check that the offer is shown as new
|
||||
await importUser(page);
|
||||
// await importUser(page);
|
||||
|
||||
await importUserFromAccount(page, "00");
|
||||
await page.goto('./');
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
const offerNumElem = page.getByTestId('newOffersToUserProjectsActivityNumber');
|
||||
@@ -109,13 +105,16 @@ test('Affirm delivery of an offer', async ({ page }) => {
|
||||
|
||||
// click on the number of new offers to go to the list page
|
||||
await offerNumElem.click();
|
||||
|
||||
// get the link that comes after the showOffersToUserProjects and click it
|
||||
await page.getByTestId('showOffersToUserProjects').locator('a').click();
|
||||
|
||||
// get the first item of the list and click on the icon with file-lines
|
||||
const firstItem = page.getByTestId('listRecentOffersToUserProjects').locator('li').first();
|
||||
await expect(firstItem).toBeVisible();
|
||||
await firstItem.locator('svg.fa-file-lines').click();
|
||||
await expect(page.getByText('Verifiable Claim Details', { exact: true })).toBeVisible();
|
||||
|
||||
// click on the 'Affirm Delivery' button
|
||||
await page.getByRole('button', { name: 'Affirm Delivery' }).click();
|
||||
// fill our offer info and submit
|
||||
@@ -125,3 +124,4 @@ test('Affirm delivery of an offer', async ({ page }) => {
|
||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user