forked from trent_larson/crowd-funder-for-time-pwa
add tests for gives to & from projects
This commit is contained in:
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Record a give from a project on the project page.
|
||||||
|
- Make unavailable and explain why on confirmation buttons on the project page gives.
|
||||||
|
|
||||||
|
|
||||||
## [0.3.36] - 2024.11.24 - c8d23647d165016f8a8f575e13d32583242e53ac
|
## [0.3.36] - 2024.11.24 - c8d23647d165016f8a8f575e13d32583242e53ac
|
||||||
### Changed
|
### Changed
|
||||||
- More friendly default reminder message
|
- More friendly default reminder message
|
||||||
@@ -26,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [0.3.32] - 2024.11.06 - 9a3fa38a3fd28f977e06f0265fc39e635c9c5ccd
|
## [0.3.32] - 2024.11.06 - 9a3fa38a3fd28f977e06f0265fc39e635c9c5ccd
|
||||||
### Added
|
### Added
|
||||||
- Highlight new offers to user & to user's projects on the front page.
|
- Highlight in green new offers to user & to user's projects on the front page.
|
||||||
|
|
||||||
|
|
||||||
## [0.3.31] - 2024.10.25 - 07c02ab98a09d293dd90d9289a7872e7d681d296
|
## [0.3.31] - 2024.10.25 - 07c02ab98a09d293dd90d9289a7872e7d681d296
|
||||||
|
|||||||
@@ -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: 10000,
|
timeout: 25000, // various tests fail at various times with 20000
|
||||||
|
|
||||||
/* Run your local dev server before starting the tests */
|
/* Run your local dev server before starting the tests */
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
['GiveAction', 'Offer', 'PlanAction'].includes(
|
['GiveAction', 'Offer', 'PlanAction'].includes(
|
||||||
veriClaim.claimType as string,
|
veriClaim.claimType as string,
|
||||||
) && veriClaim.issuer === activeDid
|
) && veriClaim.issuer === activeDid
|
||||||
// a PlanAction agent also could edit one of those, but rather than add more Plan-specific logic to detect the agent
|
// a PlanAction agent also could edit one of those,
|
||||||
|
// but rather than add more Plan-specific logic to detect the agent
|
||||||
// we'll let them click the Project link and edit from there
|
// we'll let them click the Project link and edit from there
|
||||||
"
|
"
|
||||||
@click="onClickEditClaim"
|
@click="onClickEditClaim"
|
||||||
|
|||||||
@@ -300,7 +300,7 @@
|
|||||||
|
|
||||||
<!-- Now, gives TO this project in the middle -->
|
<!-- Now, gives TO this project in the middle -->
|
||||||
<!-- (similar to "FROM" gift display below) -->
|
<!-- (similar to "FROM" gift display below) -->
|
||||||
<div class="bg-slate-100 px-4 py-3 rounded-md">
|
<div class="bg-slate-100 px-4 py-3 rounded-md" data-testId="gives-to">
|
||||||
<div v-if="activeDid && isRegistered">
|
<div v-if="activeDid && isRegistered">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<button
|
<button
|
||||||
@@ -387,7 +387,7 @@
|
|||||||
|
|
||||||
<!-- Finally, gives FROM this project on the right -->
|
<!-- Finally, gives FROM this project on the right -->
|
||||||
<!-- (similar to "TO" gift display above) -->
|
<!-- (similar to "TO" gift display above) -->
|
||||||
<div class="bg-slate-100 px-4 py-3 rounded-md">
|
<div class="bg-slate-100 px-4 py-3 rounded-md" data-testId="gives-from">
|
||||||
<div v-if="activeDid && isRegistered">
|
<div v-if="activeDid && isRegistered">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<button
|
<button
|
||||||
@@ -540,7 +540,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
offersToThis: Array<OfferSummaryRecord> = [];
|
offersToThis: Array<OfferSummaryRecord> = [];
|
||||||
offersHitLimit = false;
|
offersHitLimit = false;
|
||||||
projectId = ""; // handle ID
|
projectId = ""; // handle ID
|
||||||
recentlyCheckedAndUnconfirmableJwts = [];
|
recentlyCheckedAndUnconfirmableJwts: string[] = [];
|
||||||
showDidCopy = false;
|
showDidCopy = false;
|
||||||
startTime = "";
|
startTime = "";
|
||||||
truncatedDesc = "";
|
truncatedDesc = "";
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ test('Record something given', async ({ page }) => {
|
|||||||
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
|
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||||
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
|
|
||||||
// Refresh home view and check gift
|
// Refresh home view and check gift
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ test('Record 9 new gifts', async ({ page }) => {
|
|||||||
await page.getByRole('spinbutton').fill(finalNumbers[i].toString());
|
await page.getByRole('spinbutton').fill(finalNumbers[i].toString());
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||||
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
|
|
||||||
// Refresh home view and check gift
|
// Refresh home view and check gift
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ test('Record item given from image-share', async ({ page }) => {
|
|||||||
await page.getByRole('spinbutton').fill('2');
|
await page.getByRole('spinbutton').fill('2');
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||||
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
|
|
||||||
// Refresh home view and check gift
|
// Refresh home view and check gift
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
|
|||||||
50
test-playwright/37-record-gift-on-project.spec.ts
Normal file
50
test-playwright/37-record-gift-on-project.spec.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { importUser } from './testUtils';
|
||||||
|
|
||||||
|
async function testProjectGive(page: Page, selector: string) {
|
||||||
|
|
||||||
|
// Generate a random string of a few characters
|
||||||
|
const randomString = Math.random().toString(36).substring(2, 6);
|
||||||
|
|
||||||
|
// Generate a random non-zero single-digit number
|
||||||
|
const randomNonZeroNumber = Math.floor(Math.random() * 99) + 1;
|
||||||
|
|
||||||
|
// Standard title prefix
|
||||||
|
const standardTitle = 'Gift ';
|
||||||
|
|
||||||
|
// Combine title prefix with the random string
|
||||||
|
const finalTitle = standardTitle + randomString;
|
||||||
|
|
||||||
|
// find a project and enter a give to it and see that it shows
|
||||||
|
await importUser(page, '00');
|
||||||
|
await page.goto('./discover');
|
||||||
|
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||||
|
|
||||||
|
await page.locator('ul#listDiscoverResults li:first-child a').click()
|
||||||
|
// wait for the project page to load
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
// click the give button, inside the first div
|
||||||
|
await page.getByTestId(selector).locator('div:first-child div button').click();
|
||||||
|
await page.getByPlaceholder('What was given').fill(finalTitle);
|
||||||
|
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
|
||||||
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
|
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||||
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
|
|
||||||
|
// refresh the page
|
||||||
|
await page.reload();
|
||||||
|
// check that the give is in the list
|
||||||
|
await page
|
||||||
|
.getByTestId(selector)
|
||||||
|
.locator('div ul li:first-child')
|
||||||
|
.filter({ hasText: finalTitle })
|
||||||
|
.isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
test('Record a give to a project', async ({ page }) => {
|
||||||
|
await testProjectGive(page, 'gives-to');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Record a give from a project', async ({ page }) => {
|
||||||
|
await testProjectGive(page, 'gives-from');
|
||||||
|
});
|
||||||
@@ -87,6 +87,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
await page.getByRole('button', { name: 'Confirm' }).click();
|
await page.getByRole('button', { name: 'Confirm' }).click();
|
||||||
await page.getByRole('button', { name: 'Yes' }).click();
|
await page.getByRole('button', { name: 'Yes' }).click();
|
||||||
await expect(page.getByText('Confirmation submitted.')).toBeVisible();
|
await expect(page.getByText('Confirmation submitted.')).toBeVisible();
|
||||||
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
|
|
||||||
// Refresh claim page, Confirm button should throw an alert because they already confirmed
|
// Refresh claim page, Confirm button should throw an alert because they already confirmed
|
||||||
await page.reload();
|
await page.reload();
|
||||||
@@ -112,7 +113,7 @@ test('Without being registered, add contacts without registration', async ({ pag
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Add contact, copy details, delete, and import various ways', async ({ page, context }) => {
|
test('Add contact, copy details, delete, and import from paste & from file', async ({ page, context }) => {
|
||||||
await importUser(page, '00');
|
await importUser(page, '00');
|
||||||
|
|
||||||
// Add new contact
|
// Add new contact
|
||||||
@@ -179,7 +180,7 @@ test('Add contact, copy details, delete, and import various ways', async ({ page
|
|||||||
// check that there are more contacts
|
// check that there are more contacts
|
||||||
await expect(page.getByTestId('contactListItem')).toHaveCount(2);
|
await expect(page.getByTestId('contactListItem')).toHaveCount(2);
|
||||||
|
|
||||||
// Import via the file backup-import
|
// Import via the file backup-import, with both new and existing contacts
|
||||||
await page.goto('./account');
|
await page.goto('./account');
|
||||||
await page.getByRole('heading', { name: 'Advanced' }).click();
|
await page.getByRole('heading', { name: 'Advanced' }).click();
|
||||||
const fileSelect = await page.locator('input[type="file"]')
|
const fileSelect = await page.locator('input[type="file"]')
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ test('Record an offer', async ({ page }) => {
|
|||||||
expect(page.getByRole('button', { name: 'Sign & Send' }));
|
expect(page.getByRole('button', { name: 'Sign & Send' }));
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
await expect(page.getByText('That offer was recorded.')).toBeVisible();
|
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
|
// go to the offer and check the values
|
||||||
await page.goto('./projects');
|
await page.goto('./projects');
|
||||||
@@ -57,6 +58,7 @@ test('Record an offer', async ({ page }) => {
|
|||||||
await amount.fill(String(randomNonZeroNumber + 1));
|
await amount.fill(String(randomNonZeroNumber + 1));
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
await expect(page.getByText('That offer was recorded.')).toBeVisible();
|
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
|
// go to the offer claim again and check the updated values
|
||||||
await page.goto('./projects');
|
await page.goto('./projects');
|
||||||
@@ -107,4 +109,5 @@ test('Affirm delivery of an offer', async ({ page }) => {
|
|||||||
await page.getByRole('spinbutton').fill('2');
|
await page.getByRole('spinbutton').fill('2');
|
||||||
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
||||||
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
||||||
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { expect, Page } from '@playwright/test';
|
import { expect, Page } from '@playwright/test';
|
||||||
|
|
||||||
// Import the seed and switch to the user based on the ID.
|
// Import the seed and switch to the user based on the ID.
|
||||||
// '01' -> 111
|
// '01' -> user 111
|
||||||
// otherwise -> 000
|
// otherwise -> user 000
|
||||||
|
// (... which is a weird convention but I haven't taken the time to change it)
|
||||||
export async function importUser(page: Page, id?: string): Promise<string> {
|
export async function importUser(page: Page, id?: string): Promise<string> {
|
||||||
let seedPhrase, userName, did;
|
let seedPhrase, userName, did;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user