forked from trent_larson/crowd-funder-for-time-pwa
fix error is OfferDialog where assignment to a project was missed, plus some refactors
This commit is contained in:
@@ -375,7 +375,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Vue, Component } from "vue-facing-decorator";
|
import { Vue, Component } from "vue-facing-decorator";
|
||||||
import { Router } from "vue-router";
|
|
||||||
|
|
||||||
import { DEFAULT_PUSH_SERVER, NotificationIface } from "@/constants/app";
|
import { DEFAULT_PUSH_SERVER, NotificationIface } from "@/constants/app";
|
||||||
import { retrieveSettingsForActiveAccount } from "@/db/index";
|
import { retrieveSettingsForActiveAccount } from "@/db/index";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
data-testId="inputDescription"
|
data-testId="inputDescription"
|
||||||
class="block w-full rounded border border-slate-400 mb-2 px-3 py-2"
|
class="block w-full rounded border border-slate-400 mb-2 px-3 py-2"
|
||||||
placeholder="Description, prerequisites, terms, etc."
|
placeholder="Description of what is offered"
|
||||||
v-model="description"
|
v-model="description"
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-row mt-2">
|
<div class="flex flex-row mt-2">
|
||||||
@@ -235,6 +235,7 @@ export default class OfferDialog extends Vue {
|
|||||||
description,
|
description,
|
||||||
amount,
|
amount,
|
||||||
unitCode,
|
unitCode,
|
||||||
|
"",
|
||||||
expirationDateInput,
|
expirationDateInput,
|
||||||
this.recipientDid,
|
this.recipientDid,
|
||||||
this.projectId,
|
this.projectId,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<textarea
|
<textarea
|
||||||
class="block w-full rounded border border-slate-400 mb-2 px-3 py-2"
|
class="block w-full rounded border border-slate-400 mb-2 px-3 py-2"
|
||||||
placeholder="What is offered"
|
placeholder="What is offered"
|
||||||
v-model="itemDescription"
|
v-model="descriptionOfItem"
|
||||||
data-testId="itemDescription"
|
data-testId="itemDescription"
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-row justify-center">
|
<div class="flex flex-row justify-center">
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
<textarea
|
<textarea
|
||||||
class="w-full border border-slate-400 px-3 py-2 rounded-r"
|
class="w-full border border-slate-400 px-3 py-2 rounded-r"
|
||||||
placeholder="Prerequisites, other people to include, etc."
|
placeholder="Prerequisites, other people to include, etc."
|
||||||
v-model="conditionDescription"
|
v-model="descriptionOfCondition"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -207,14 +207,14 @@ export default class OfferDetailsView extends Vue {
|
|||||||
apiServer = "";
|
apiServer = "";
|
||||||
|
|
||||||
amountInput = "0";
|
amountInput = "0";
|
||||||
conditionDescription = "";
|
descriptionOfCondition = "";
|
||||||
itemDescription = "";
|
descriptionOfItem = "";
|
||||||
destinationPathAfter = "";
|
destinationPathAfter = "";
|
||||||
|
hideBackButton = false;
|
||||||
|
message = "";
|
||||||
offeredToProject = false;
|
offeredToProject = false;
|
||||||
offeredToRecipient = false;
|
offeredToRecipient = false;
|
||||||
offererDid: string | undefined;
|
offererDid: string | undefined;
|
||||||
hideBackButton = false;
|
|
||||||
message = "";
|
|
||||||
offerId = "";
|
offerId = "";
|
||||||
prevCredToEdit?: GenericCredWrapper<OfferVerifiableCredential>;
|
prevCredToEdit?: GenericCredWrapper<OfferVerifiableCredential>;
|
||||||
projectId = "";
|
projectId = "";
|
||||||
@@ -255,12 +255,12 @@ export default class OfferDetailsView extends Vue {
|
|||||||
this.prevCredToEdit?.claim?.includesObject?.unitCode ||
|
this.prevCredToEdit?.claim?.includesObject?.unitCode ||
|
||||||
this.unitCode) as string;
|
this.unitCode) as string;
|
||||||
|
|
||||||
this.conditionDescription =
|
this.descriptionOfCondition =
|
||||||
this.prevCredToEdit?.claim?.description || this.conditionDescription;
|
this.prevCredToEdit?.claim?.description || this.descriptionOfCondition;
|
||||||
this.itemDescription =
|
this.descriptionOfItem =
|
||||||
(this.$route as Router).query["description"] ||
|
(this.$route as Router).query["description"] ||
|
||||||
this.prevCredToEdit?.claim?.itemOffered?.description ||
|
this.prevCredToEdit?.claim?.itemOffered?.description ||
|
||||||
this.itemDescription;
|
this.descriptionOfItem;
|
||||||
this.destinationPathAfter = (this.$route as Router).query[
|
this.destinationPathAfter = (this.$route as Router).query[
|
||||||
"destinationPathAfter"
|
"destinationPathAfter"
|
||||||
];
|
];
|
||||||
@@ -400,7 +400,7 @@ export default class OfferDetailsView extends Vue {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.itemDescription && !parseFloat(this.amountInput)) {
|
if (!this.descriptionOfItem && !parseFloat(this.amountInput)) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
@@ -500,10 +500,10 @@ export default class OfferDetailsView extends Vue {
|
|||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.prevCredToEdit,
|
this.prevCredToEdit,
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
this.itemDescription,
|
this.descriptionOfItem,
|
||||||
parseFloat(this.amountInput),
|
parseFloat(this.amountInput),
|
||||||
this.unitCode,
|
this.unitCode,
|
||||||
this.conditionDescription,
|
this.descriptionOfCondition,
|
||||||
this.validThroughDateInput,
|
this.validThroughDateInput,
|
||||||
recipientDid,
|
recipientDid,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -513,10 +513,10 @@ export default class OfferDetailsView extends Vue {
|
|||||||
this.axios,
|
this.axios,
|
||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
this.itemDescription,
|
this.descriptionOfItem,
|
||||||
parseFloat(this.amountInput),
|
parseFloat(this.amountInput),
|
||||||
this.unitCode,
|
this.unitCode,
|
||||||
this.conditionDescription,
|
this.descriptionOfCondition,
|
||||||
this.validThroughDateInput,
|
this.validThroughDateInput,
|
||||||
recipientDid,
|
recipientDid,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -580,10 +580,10 @@ export default class OfferDetailsView extends Vue {
|
|||||||
this.prevCredToEdit?.claim as OfferVerifiableCredential,
|
this.prevCredToEdit?.claim as OfferVerifiableCredential,
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
recipientDid,
|
recipientDid,
|
||||||
this.itemDescription,
|
this.descriptionOfItem,
|
||||||
parseFloat(this.amountInput),
|
parseFloat(this.amountInput),
|
||||||
this.unitCode,
|
this.unitCode,
|
||||||
this.conditionDescription,
|
this.descriptionOfCondition,
|
||||||
projectId,
|
projectId,
|
||||||
this.validThroughDateInput,
|
this.validThroughDateInput,
|
||||||
this.prevCredToEdit?.id as string,
|
this.prevCredToEdit?.id as string,
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ test('Check User 0 can register a random person', async ({ page }) => {
|
|||||||
await deleteContact(page, newDid);
|
await deleteContact(page, newDid);
|
||||||
// go the activity page for this new person
|
// go the activity page for this new person
|
||||||
await page.goto('./did/' + encodeURIComponent(newDid));
|
await page.goto('./did/' + encodeURIComponent(newDid));
|
||||||
|
// maybe replace by: const popupPromise = page.waitForEvent('popup');
|
||||||
let error;
|
let error;
|
||||||
try {
|
try {
|
||||||
await page.waitForSelector('div[role="alert"]', { timeout: 2000 });
|
await page.waitForSelector('div[role="alert"]', { timeout: 2000 });
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import { importUser, createUniqueStringsArray, createRandomNumbersArray } from './testUtils';
|
import { importUser, createUniqueStringsArray, createRandomNumbersArray } from './testUtils';
|
||||||
|
|
||||||
test('Record 10 new gifts', async ({ page }) => {
|
test('Record 9 new gifts', async ({ page }) => {
|
||||||
const giftCount = 10;
|
const giftCount = 9; // because 10 has taken us above 30 seconds
|
||||||
|
|
||||||
// Standard text
|
// Standard text
|
||||||
const standardTitle = "Gift ";
|
const standardTitle = 'Gift ';
|
||||||
|
|
||||||
// Field value arrays
|
// Field value arrays
|
||||||
const finalTitles = [];
|
const finalTitles = [];
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ test('Record an offer', async ({ page }) => {
|
|||||||
await page.locator('ul#listDiscoverResults li:nth-child(1)').click();
|
await page.locator('ul#listDiscoverResults li:nth-child(1)').click();
|
||||||
|
|
||||||
// Record an offer
|
// 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();
|
await page.getByTestId('offerButton').click();
|
||||||
await page.getByTestId('inputDescription').fill(description);
|
await page.getByTestId('inputDescription').fill(description);
|
||||||
await page.getByTestId('inputOfferAmount').fill(randomNonZeroNumber.toString());
|
await page.getByTestId('inputOfferAmount').fill(randomNonZeroNumber.toString());
|
||||||
@@ -28,6 +29,8 @@ test('Record an offer', async ({ page }) => {
|
|||||||
await page.locator('li').filter({ hasText: description }).locator('a').first().click();
|
await page.locator('li').filter({ hasText: description }).locator('a').first().click();
|
||||||
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
|
||||||
await expect(page.getByText(description, { exact: true })).toBeVisible();
|
await expect(page.getByText(description, { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByText('Offered to a bigger plan')).toBeVisible();
|
||||||
|
|
||||||
const serverPagePromise = page.waitForEvent('popup');
|
const serverPagePromise = page.waitForEvent('popup');
|
||||||
await page.getByRole('link', { name: 'View on the Public Server' }).click();
|
await page.getByRole('link', { name: 'View on the Public Server' }).click();
|
||||||
const serverPage = await serverPagePromise;
|
const serverPage = await serverPagePromise;
|
||||||
@@ -49,6 +52,7 @@ test('Record an offer', async ({ page }) => {
|
|||||||
await itemDesc.fill(updatedDescription);
|
await itemDesc.fill(updatedDescription);
|
||||||
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();
|
||||||
|
|
||||||
// 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');
|
||||||
|
|||||||
Reference in New Issue
Block a user