diff --git a/cypress/e2e/13_depositToWorkspace.cy.ts b/cypress/e2e/13_depositToWorkspace.cy.ts index 5d827b38..2c8bedbd 100644 --- a/cypress/e2e/13_depositToWorkspace.cy.ts +++ b/cypress/e2e/13_depositToWorkspace.cy.ts @@ -41,7 +41,7 @@ describe('It desposits to a workspace ', () => { cy.contains('Successfully Deposited'); cy.get('body').click(0, 0); - cy.contains(`${budgetAmount.toLocaleString()} SATS`); + cy.contains(`${budgetAmount.toLocaleString()} SATS`).should('exists', { timeout: 2000 }); }); // logout diff --git a/cypress/e2e/18_withdrawWorkspaceBudget.cy.ts b/cypress/e2e/18_withdrawWorkspaceBudget.cy.ts index 313aa763..a6dd23b4 100644 --- a/cypress/e2e/18_withdrawWorkspaceBudget.cy.ts +++ b/cypress/e2e/18_withdrawWorkspaceBudget.cy.ts @@ -58,7 +58,7 @@ describe('It Withdraws from Workspace budget', () => { cy.get('body').click(0, 0); cy.wait(1000); - cy.contains(currentAmount.toLocaleString()); + cy.contains(currentAmount.toLocaleString()).should('exist', { timeout: 2000 }); cy.wait(500); // logout diff --git a/cypress/e2e/29_paymentHistory.cy.ts b/cypress/e2e/29_paymentHistory.cy.ts index 9e312054..d9d93822 100644 --- a/cypress/e2e/29_paymentHistory.cy.ts +++ b/cypress/e2e/29_paymentHistory.cy.ts @@ -1,7 +1,7 @@ import { formatSat } from '../../src/helpers/helpers-extended'; describe('It Lists all payments in history', () => { - it('It adds budget, withdraw budget, pay bounties and see all the payments in history', async () => { + it('It adds budget, withdraw budget, pay bounties and see all the payments in history', () => { const activeUser = 'alice'; cy.login(activeUser); cy.wait(1000); @@ -9,7 +9,7 @@ describe('It Lists all payments in history', () => { // create workspace const workSpace = { loggedInAs: activeUser, - name: 'Deduct Budget Pay3', + name: 'Payment Flow', description: 'We are testing out our workspace', website: 'https://community.sphinx.chat', github: 'https://github.com/stakwork/sphinx-tribes-frontend' @@ -18,7 +18,8 @@ describe('It Lists all payments in history', () => { cy.create_workspace(workSpace); cy.wait(1000); - cy.contains('Manage').click(); + cy.contains(workSpace.name).contains('Manage').click(); + cy.wait(1000); const depositAmount = 10000; const withdrawAmount = 2000; @@ -63,10 +64,12 @@ describe('It Lists all payments in history', () => { cy.get('body').click(0, 0); cy.wait(1000); - cy.contains(afterWithdrawAmount.toLocaleString()); + cy.contains(afterWithdrawAmount.toLocaleString()).should('exist', { timeout: 2000 }); cy.wait(500); }); + cy.wait(1000); + // create and pay bounty const bounty: Cypress.Bounty = { title: 'My History Bounty', @@ -126,13 +129,7 @@ describe('It Lists all payments in history', () => { cy.get('body').click(0, 0); cy.wait(1000); - // cy.contains(finalPaymentAmount.toLocaleString()).should('exist'); - cy.get('[data-testid="current-balance-amount"]') - .invoke('text') - .then((text) => { - expect(text).equal(finalPaymentAmount.toLocaleString()); - }); - cy.wait(1000); + cy.contains(finalPaymentAmount.toLocaleString()).should('exist', { timeout: 2000 }); cy.logout(activeUser); }); diff --git a/src/people/widgetViews/WorkspaceDetails.tsx b/src/people/widgetViews/WorkspaceDetails.tsx index c0cb3301..f3edf3a5 100644 --- a/src/people/widgetViews/WorkspaceDetails.tsx +++ b/src/people/widgetViews/WorkspaceDetails.tsx @@ -229,7 +229,7 @@ const WorkspaceDetails = (props: { const onSubmitUser = async (body: any) => { setIsLoading(true); - body.org_uuid = uuid; + body.workspace_uuid = uuid; const res = await main.addWorkspaceUser(body); if (res.status === 200) { @@ -265,7 +265,7 @@ const WorkspaceDetails = (props: { .filter((r: any) => r.status) .map((role: any) => ({ owner_pubkey: user?.owner_pubkey, - org_uuid: uuid, + workspace_uuid: uuid, role: role.name })); diff --git a/src/store/__test__/main.spec.ts b/src/store/__test__/main.spec.ts index 732fe382..defb4e84 100644 --- a/src/store/__test__/main.spec.ts +++ b/src/store/__test__/main.spec.ts @@ -250,7 +250,7 @@ describe('Main store', () => { const workspaceUser = { owner_pubkey: user.owner_pubkey || '', - org_uuid: mockApiResponseData[2] + workspace_uuid: mockApiResponseData[2] }; const expectedHeaders = { diff --git a/src/store/main.ts b/src/store/main.ts index da2dc49a..2551db26 100644 --- a/src/store/main.ts +++ b/src/store/main.ts @@ -2403,11 +2403,14 @@ export class MainStore { } } - @action async addWorkspaceUser(body: { owner_pubkey: string; org_uuid: string }): Promise { + @action async addWorkspaceUser(body: { + owner_pubkey: string; + workspace_uuid: string; + }): Promise { try { if (!uiStore.meInfo) return null; const info = uiStore.meInfo; - const r: any = await fetch(`${TribesURL}/workspaces/users/${body.org_uuid}`, { + const r: any = await fetch(`${TribesURL}/workspaces/users/${body.workspace_uuid}`, { method: 'POST', mode: 'cors', body: JSON.stringify({ @@ -2754,11 +2757,11 @@ export class MainStore { } } - async workspaceInvoiceCount(org_uuid: string): Promise { + async workspaceInvoiceCount(workspace_uuid: string): Promise { try { if (!uiStore.meInfo) return 0; const info = uiStore.meInfo; - const r: any = await fetch(`${TribesURL}/workspaces/invoices/count/${org_uuid}`, { + const r: any = await fetch(`${TribesURL}/workspaces/invoices/count/${workspace_uuid}`, { method: 'GET', mode: 'cors', headers: {