Browse Source

fix error is OfferDialog where assignment to a project was missed, plus some refactors

master
Trent Larson 4 days ago
parent
commit
ecc455939b
  1. 1
      src/App.vue
  2. 3
      src/components/OfferDialog.vue
  3. 34
      src/views/OfferDetailsView.vue
  4. 1
      test-playwright/00-noid-tests.spec.ts
  5. 6
      test-playwright/33-record-gift-x10.spec.ts
  6. 4
      test-playwright/50-record-offer.spec.ts

1
src/App.vue

@ -375,7 +375,6 @@
<script lang="ts">
import axios from "axios";
import { Vue, Component } from "vue-facing-decorator";
import { Router } from "vue-router";
import { DEFAULT_PUSH_SERVER, NotificationIface } from "@/constants/app";
import { retrieveSettingsForActiveAccount } from "@/db/index";

3
src/components/OfferDialog.vue

@ -6,7 +6,7 @@
type="text"
data-testId="inputDescription"
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"
/>
<div class="flex flex-row mt-2">
@ -235,6 +235,7 @@ export default class OfferDialog extends Vue {
description,
amount,
unitCode,
"",
expirationDateInput,
this.recipientDid,
this.projectId,

34
src/views/OfferDetailsView.vue

@ -35,7 +35,7 @@
<textarea
class="block w-full rounded border border-slate-400 mb-2 px-3 py-2"
placeholder="What is offered"
v-model="itemDescription"
v-model="descriptionOfItem"
data-testId="itemDescription"
/>
<div class="flex flex-row justify-center">
@ -74,7 +74,7 @@
<textarea
class="w-full border border-slate-400 px-3 py-2 rounded-r"
placeholder="Prerequisites, other people to include, etc."
v-model="conditionDescription"
v-model="descriptionOfCondition"
/>
</div>
@ -207,14 +207,14 @@ export default class OfferDetailsView extends Vue {
apiServer = "";
amountInput = "0";
conditionDescription = "";
itemDescription = "";
descriptionOfCondition = "";
descriptionOfItem = "";
destinationPathAfter = "";
hideBackButton = false;
message = "";
offeredToProject = false;
offeredToRecipient = false;
offererDid: string | undefined;
hideBackButton = false;
message = "";
offerId = "";
prevCredToEdit?: GenericCredWrapper<OfferVerifiableCredential>;
projectId = "";
@ -255,12 +255,12 @@ export default class OfferDetailsView extends Vue {
this.prevCredToEdit?.claim?.includesObject?.unitCode ||
this.unitCode) as string;
this.conditionDescription =
this.prevCredToEdit?.claim?.description || this.conditionDescription;
this.itemDescription =
this.descriptionOfCondition =
this.prevCredToEdit?.claim?.description || this.descriptionOfCondition;
this.descriptionOfItem =
(this.$route as Router).query["description"] ||
this.prevCredToEdit?.claim?.itemOffered?.description ||
this.itemDescription;
this.descriptionOfItem;
this.destinationPathAfter = (this.$route as Router).query[
"destinationPathAfter"
];
@ -400,7 +400,7 @@ export default class OfferDetailsView extends Vue {
);
return;
}
if (!this.itemDescription && !parseFloat(this.amountInput)) {
if (!this.descriptionOfItem && !parseFloat(this.amountInput)) {
this.$notify(
{
group: "alert",
@ -500,10 +500,10 @@ export default class OfferDetailsView extends Vue {
this.apiServer,
this.prevCredToEdit,
this.activeDid,
this.itemDescription,
this.descriptionOfItem,
parseFloat(this.amountInput),
this.unitCode,
this.conditionDescription,
this.descriptionOfCondition,
this.validThroughDateInput,
recipientDid,
projectId,
@ -513,10 +513,10 @@ export default class OfferDetailsView extends Vue {
this.axios,
this.apiServer,
this.activeDid,
this.itemDescription,
this.descriptionOfItem,
parseFloat(this.amountInput),
this.unitCode,
this.conditionDescription,
this.descriptionOfCondition,
this.validThroughDateInput,
recipientDid,
projectId,
@ -580,10 +580,10 @@ export default class OfferDetailsView extends Vue {
this.prevCredToEdit?.claim as OfferVerifiableCredential,
this.activeDid,
recipientDid,
this.itemDescription,
this.descriptionOfItem,
parseFloat(this.amountInput),
this.unitCode,
this.conditionDescription,
this.descriptionOfCondition,
projectId,
this.validThroughDateInput,
this.prevCredToEdit?.id as string,

1
test-playwright/00-noid-tests.spec.ts

@ -128,6 +128,7 @@ test('Check User 0 can register a random person', async ({ page }) => {
await deleteContact(page, newDid);
// go the activity page for this new person
await page.goto('./did/' + encodeURIComponent(newDid));
// maybe replace by: const popupPromise = page.waitForEvent('popup');
let error;
try {
await page.waitForSelector('div[role="alert"]', { timeout: 2000 });

6
test-playwright/33-record-gift-x10.spec.ts

@ -1,11 +1,11 @@
import { test, expect } from '@playwright/test';
import { importUser, createUniqueStringsArray, createRandomNumbersArray } from './testUtils';
test('Record 10 new gifts', async ({ page }) => {
const giftCount = 10;
test('Record 9 new gifts', async ({ page }) => {
const giftCount = 9; // because 10 has taken us above 30 seconds
// Standard text
const standardTitle = "Gift ";
const standardTitle = 'Gift ';
// Field value arrays
const finalTitles = [];

4
test-playwright/50-record-offer.spec.ts

@ -17,6 +17,7 @@ test('Record an offer', async ({ page }) => {
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();
await page.getByTestId('inputDescription').fill(description);
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 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');
await page.getByRole('link', { name: 'View on the Public Server' }).click();
const serverPage = await serverPagePromise;
@ -49,6 +52,7 @@ test('Record an offer', async ({ page }) => {
await itemDesc.fill(updatedDescription);
await amount.fill(String(randomNonZeroNumber + 1));
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
await page.goto('./projects');

Loading…
Cancel
Save