Skip to content

Commit

Permalink
Release 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoplatform-engineering committed Jul 28, 2021
1 parent 627623b commit cc09170
Show file tree
Hide file tree
Showing 42 changed files with 599 additions and 430 deletions.
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"editor.formatOnSave": true,
"typescript.tsdk": "./node_modules/typescript/lib",
"eslint.validate": [
"javascript",
Expand All @@ -9,5 +8,7 @@
],
"eslint.enable": true,
"sort-imports.on-save": true,
"python.formatting.provider": "black"
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
45 changes: 45 additions & 0 deletions e2e/commonHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,51 @@ export async function e2eCheckMessageDisplays(
await driver.wait(until.stalenessOf(element), wait);
}

/**
* Utility function to check that a given table being displayed
* contains at least one instance of a specified data value
*
* @param {!string} tableId the value of the table "id" attribute to scope
* the xpath operations to the correct table
* @param {!string} tableData expected value of a data value displayed in a table cell
* @param {?number} wait an optional amount of time to use when waiting for
* elements to resolve when locating them.
*/
export async function e2eCheckTableDataPresent(
tableId: string,
tableData: string,
wait: number = commonWaitDefault,
): Promise<void> {
await e2eWaitElementVisible(
By.xpath(
`//div[@id='${tableId}']//table/tbody/tr/td[contains(.,'${tableData}')]`,
),
wait,
);
}

/**
* Utility function to check that a given table being displayed
* DOES NOT contain any instances of a specified data value
*
* @param {!string} tableId the value of the table "id" attribute to scope
* the xpath operations to the correct table
* @param {!string} tableData value to check does NOT exist in any table cells
* @param {?number} wait an optional amount of time to use when waiting for
* elements to resolve when locating them.
*/
export async function e2eCheckTableDataNotPresent(
tableId: string,
tableData: string,
): Promise<void> {
const elements = await driver.findElements(
By.xpath(
`//div[@id='${tableId}']//table/tbody/tr/td[contains(.,'${tableData}')]`,
),
);
expect(elements.length).toBeFalsy();
}

/**
* Utility function to test form activation on a card followed
* by cancel works.
Expand Down
2 changes: 1 addition & 1 deletion e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const env = {
BASE_URL: 'http://react.webserver:3000',
BROWSER: 'chrome',
BROWSER_SERVER: 'http://localhost:4445/wd/hub',
HEADLESS: true,
HEADLESS: false,
};

const driversToCleanUp: WebDriver[] = [];
Expand Down
22 changes: 15 additions & 7 deletions e2e/credentialIssuance.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { By } from 'selenium-webdriver';
import {
e2eCheckTableDataNotPresent,
e2eCheckTableDataPresent,
e2eExecuteTableRowDropdownAction,
e2eExecuteTableRowRemoveAction,
e2eHoverOverCardInfoIcon,
Expand Down Expand Up @@ -107,8 +109,14 @@ describe('Credential Issuance', function () {
{ name: 'someCredentialValue', value: 'CI-0102 someCredentialValue' },
],
);
// Delete new credential from wallet
// Abort in progress credential request wallet.
// NOTE: In version Cloud Agent 0.500.600 you needed to manually delete in
// progress credentials from both the Holder and Issuer.
// In version 0.700.0 the behaviour changed
// so that if an in-progress request is deleted by the Holder it is
// automatically removed from the Issuer.
await e2eNavigateToRequestedCredentialsCard();
await e2eCheckTableDataPresent('CredentialRequestsList', credentialThread);
await e2eExecuteTableRowDropdownAction(
'CredentialRequestsList',
credentialThread,
Expand All @@ -117,15 +125,15 @@ describe('Credential Issuance', function () {
'Abort',
'Credential request aborted',
);
await e2eCheckTableDataNotPresent(
'CredentialRequestsList',
credentialThread,
);

await e2eNavigateToActiveCredentialRequestsCard();
await e2eExecuteTableRowDropdownAction(
'ActiveCredentialRequestsList',
await e2eCheckTableDataNotPresent(
'CredentialRequestsList',
credentialThread,
'Actions',
'Reject Proposal',
'Reject',
'Credential request aborted',
);
});

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
],
"scripts": {
"copy-acapy-config": "cp -f node_modules/@sudoplatform-labs/sudo-di-cloud-agent/bin/acapy.json ./public/",
"add-acapy-seed": "./utils/add-acapy-seed.sh -c ./public/acapy.json",
"bootstrap": "yarn install && yarn copy-acapy-config",
"start": "react-scripts start",
"lint": "eslint ./src --ext ts",
Expand All @@ -22,7 +23,7 @@
"test:start-browser-server-debug": "./e2e/browser-server.sh start -i selenium/standalone-chrome-debug:3.141.59 -p 4445",
"test:start-browser-server": "./e2e/browser-server.sh start -i selenium/standalone-chrome:3.141.59 -p 4445",
"test:stop-browser-server": "./e2e/browser-server.sh stop",
"test:start-e2e-env": "yarn di-env start -s 7837E638F94B43B5AD22C97354B997F9 && yarn test:update-acapy-address && yarn test:start-browser-server-debug",
"test:start-e2e-env": "yarn di-env start -c $PWD/public/acapy.json && yarn test:update-acapy-address && yarn test:start-browser-server-debug",
"test:stop-e2e-env": "yarn test:stop-browser-server; yarn di-env down",
"test:run-e2e": "rm -rf .e2e_test_success && yarn test:start-e2e-env && yarn test:execute-e2e && touch .e2e_test_success; yarn test:stop-e2e-env",
"test:unit": "yarn react-scripts test",
Expand All @@ -42,7 +43,7 @@
},
"dependencies": {
"@ant-design/icons": "^4.0.5",
"@sudoplatform-labs/sudo-di-cloud-agent": "^0.3.0",
"@sudoplatform-labs/sudo-di-cloud-agent": "^0.4.0",
"antd": "^4.5.4",
"antd-mask-input": "^0.1.13",
"color": "^3.1.2",
Expand Down
5 changes: 3 additions & 2 deletions src/components/Proofs/CompletedProofsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import {
import { CompletedProofsList } from '../../components/Proofs/CompletedProofsList';
import { fetchAllAgentConnectionDetails } from '../../models/ACAPy/Connections';
import { HStack } from '../layout-stacks';
import { PresentProofRecordsGetRoleEnum, PresentProofRecordsGetStateEnum } from '@sudoplatform-labs/sudo-di-cloud-agent';

/**
* Props define the agent role for this card instance
*/
interface Props {
role: 'prover' | 'verifier';
role: PresentProofRecordsGetRoleEnum;
}

/**
Expand Down Expand Up @@ -68,7 +69,7 @@ export const CompletedProofsCard: React.FC<Props> = (props) => {
cloudAgentAPIs,
{
role: role,
states: ['verified', 'presentation_acked'],
states: [ PresentProofRecordsGetStateEnum.Verified, PresentProofRecordsGetStateEnum.PresentationAcked ],
},
);
const connections = await fetchAllAgentConnectionDetails(cloudAgentAPIs);
Expand Down
24 changes: 14 additions & 10 deletions src/containers/App/App.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import {
TrustpingApi,
SchemaApi,
CredentialDefinitionApi,
IssueCredentialApi,
RevocationApi,
CredentialsApi,
PresentProofApi,
IssueCredentialV10Api,
IssueCredentialV20Api,
PresentProofV10Api,
PresentProofV20Api,
} from '@sudoplatform-labs/sudo-di-cloud-agent';

const mockEnvironment: EnvironmentInfo = {
Expand Down Expand Up @@ -76,17 +78,19 @@ describe('containers/App', () => {
environment: mockEnvironment,
featureFlags: [FeatureFlags.FeatureFlag.EXAMPLE_FEATURE],
cloudAgentAPIs: {
wallet: expect.any(WalletApi),
ledger: expect.any(LedgerApi),
introductions: expect.any(IntroductionApi),
connections: expect.any(ConnectionApi),
ping: expect.any(TrustpingApi),
defineSchemas: expect.any(SchemaApi),
credentials: expect.any(CredentialsApi),
defineCredentials: expect.any(CredentialDefinitionApi),
issueCredentials: expect.any(IssueCredentialApi),
defineSchemas: expect.any(SchemaApi),
introductions: expect.any(IntroductionApi),
ledger: expect.any(LedgerApi),
ping: expect.any(TrustpingApi),
revocations: expect.any(RevocationApi),
credentials: expect.any(CredentialsApi),
proofs: expect.any(PresentProofApi),
wallet: expect.any(WalletApi),
issueV10Credentials: expect.any(IssueCredentialV10Api),
issueV20Credentials: expect.any(IssueCredentialV20Api),
presentV10Proofs: expect.any(PresentProofV10Api),
presentV20Proofs: expect.any(PresentProofV20Api),
},
});
});
Expand Down
22 changes: 13 additions & 9 deletions src/containers/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ import { AppContext, CloudAgentAPI } from './AppContext';
import { GlobalStyle } from './global-style';
import { getRoot } from './routes';
import {
WalletApi,
LedgerApi,
ConnectionApi,
CredentialDefinitionApi,
Configuration,
CredentialsApi,
CredentialDefinitionApi,
IntroductionApi,
IssueCredentialApi,
IssueCredentialV10Api,
IssueCredentialV20Api,
LedgerApi,
PresentProofV10Api,
PresentProofV20Api,
RevocationApi,
SchemaApi,
PresentProofApi,
TrustpingApi,
RevocationApi,
Configuration,
WalletApi,
} from '@sudoplatform-labs/sudo-di-cloud-agent';

const Container = styled.div`
Expand Down Expand Up @@ -77,10 +79,12 @@ export const App: React.FC = () => {
ping: new TrustpingApi(cloudAgentConfiguration),
defineSchemas: new SchemaApi(cloudAgentConfiguration),
defineCredentials: new CredentialDefinitionApi(cloudAgentConfiguration),
issueCredentials: new IssueCredentialApi(cloudAgentConfiguration),
issueV10Credentials: new IssueCredentialV10Api(cloudAgentConfiguration),
issueV20Credentials: new IssueCredentialV20Api(cloudAgentConfiguration),
revocations: new RevocationApi(cloudAgentConfiguration),
credentials: new CredentialsApi(cloudAgentConfiguration),
proofs: new PresentProofApi(cloudAgentConfiguration),
presentV10Proofs: new PresentProofV10Api(cloudAgentConfiguration),
presentV20Proofs: new PresentProofV20Api(cloudAgentConfiguration),
httpOptionOverrides: {
httpPostOptionOverrides: {
headers: { 'Content-Type': 'application/json' },
Expand Down
12 changes: 8 additions & 4 deletions src/containers/App/AppContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import {
CredentialDefinitionApi,
CredentialsApi,
IntroductionApi,
IssueCredentialApi,
SchemaApi,
PresentProofApi,
TrustpingApi,
RevocationApi,
IssueCredentialV10Api,
IssueCredentialV20Api,
PresentProofV10Api,
PresentProofV20Api,
} from '@sudoplatform-labs/sudo-di-cloud-agent';

// The Cloud Agent SDK exports each API as a class which
Expand All @@ -26,10 +28,12 @@ export type CloudAgentAPI = {
ping: TrustpingApi;
defineSchemas: SchemaApi;
defineCredentials: CredentialDefinitionApi;
issueCredentials: IssueCredentialApi;
issueV10Credentials: IssueCredentialV10Api;
issueV20Credentials: IssueCredentialV20Api;
revocations: RevocationApi;
credentials: CredentialsApi;
proofs: PresentProofApi;
presentV10Proofs: PresentProofV10Api;
presentV20Proofs: PresentProofV20Api;
httpOptionOverrides: {
// Different Swagger SDK generators insert different HTTP
// headers so we override ones that cause issues
Expand Down
Loading

0 comments on commit cc09170

Please sign in to comment.