Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ 16° ] - Release/v1.0.0 E2E cypress test: update test and documentation #107

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,12 @@
*/


import { defineConfig } from "cypress";

export default defineConfig({
// e2e: {
// setupNodeEvents(on, config) {
// // implement node event listeners here
// },
// },
chromeWebSecurity: false,
// eslint-disable-next-line no-undef
const { defineConfig } = require('cypress')

// eslint-disable-next-line no-undef
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:8080',
setupNodeEvents() {
// implement node event listeners here
},
baseUrl: 'https://materialpass.beta.demo.catena-x.net/',
},
});
})
17 changes: 7 additions & 10 deletions cypress/e2e/sign-in/e2e.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,16 @@
/* eslint-disable no-undef */
describe("e2e test", () => {
before(() => {
cy.visit("http://localhost:8080");
cy.visit("https://materialpass.beta.demo.catena-x.net/");
cy.get(".search").type("CX-test"); // typing company name
cy.get(".CX_Test_Access").click(); // btn click
});
it("Sign in and battery select", () => {
cy.origin("https://centralidp.dev.demo.catena-x.net/auth/realms/CX-Central/", () => {
cy.get('.CX_Test_Access').click(); // btn click

});
cy.origin("https://sharedidp.dev.demo.catena-x.net/auth/", () => {
cy.get('#username').type("company 2 user"); // typing username
cy.get('#password').type("changeme"); // typing password
cy.get('#kc-login').click(); // btn click
})
cy.get('#input-7').type("NCR186850B"); // typing username
cy.get('#username').type("company 2 user"); // typing username
cy.get('#password').type("changeme"); // typing password
cy.get('#kc-login').click(); // btn click
cy.get('#input-4').type("NCR186850B"); // typing battery ID
cy.get('#search-btn').click(); // btn click
cy.wait(30000); // timeout for loading
cy.get('[data-cy="battery-id"]'); // 1. General information first field check
Expand Down
153 changes: 91 additions & 62 deletions docs/admin guide/Admin_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ Latest Revision Mar 30, 2023
5. [Local Keycloak Configuration](#local-keycloak-configuration)
6. [Helm Charts Configuration](#helm-charts-configuration)
7. [Consumer Backend Configuration](#consumer-backend-configuration)
7.1 [Backend Application Configuration](#backend-application-configuration-spring-boot)
7.2 [Spring Boot Logging Configuration](#spring-boot-logging-configuration)
7.1 [Backend Application Configuration](#backend-application-configuration)
7.2 [Spring Boot Configuration](#spring-boot-configuration)

7.3 [Spring Boot Logging Configuration](#spring-boot-logging-configuration)
8. [Postman Collection](#postman-collection)
9. [Secrets Management](#secrets-management)
10. [EDC Provider Configuration](#edc-provider-configuration)
Expand All @@ -46,6 +48,7 @@ Latest Revision Mar 30, 2023
10.3 [Policies Configuration](#policies-configuration)
10.4 [Contract Definition Configuration](#contract-definition-configuration)
10.5 [Digital Twin Registration](#digital-twin-registration)

## Introduction

This guide contains all the available information for an administrator to configure, operate and deploy the Product Passport Application.
Expand All @@ -56,11 +59,12 @@ Here you will find all the guides related with the configuration of the Product

## Getting Started Guide

To start the configuration of the Product Passport Application please follow this getting started guide:
To start the configuration of the Product Passport Application please follow this getting started guide for configuring a local stand-alone enviroment (for all components) and install guide to install the application with frontend and backend:

| Name | Location | Link |
| ---- | -------- | ---- |
| Name | Location | Link |
|-----------------------| -------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Getting Started Guide | GitHub | [https://github.com/eclipse-tractusx/digital-product-pass/tree/main/docs/GETTING-STARTED.md](https://github.com/eclipse-tractusx/digital-product-pass/tree/main/docs/GETTING-STARTED.md) |
| Install Guide | GitHub | [https://github.com/eclipse-tractusx/digital-product-pass/tree/main/INSTALL.md](https://github.com/eclipse-tractusx/digital-product-pass/tree/main/INSTALL.md) |

## Deployment Configuration

Expand Down Expand Up @@ -120,14 +124,20 @@ All the information about the backend services is described in this documentatio
| Consumer Backend Guide | GitHub | [https://github.com/eclipse-tractusx/digital-product-pass/tree/main/consumer-backend/productpass/readme.md](https://github.com/eclipse-tractusx/digital-product-pass/tree/main/consumer-backend/productpass/readme.md) |
| Open API - Swagger | GitHub | [https://materialpass.int.demo.catena-x.net/swagger-ui/index.html](https://materialpass.int.demo.catena-x.net/swagger-ui/index.html) |

### Backend Application Configuration
The configurations of log levels and other variables can be set in the following file:

| Name | Location | Link |
|-----------------------------------| -------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Backend Application Configuration | GitHub | [https://github.com/eclipse-tractusx/digital-product-pass/blob/main/consumer-backend/productpass/src/main/resources/application.yml](https://github.com/eclipse-tractusx/digital-product-pass/blob/main/consumer-backend/productpass/src/main/resources/application.yml) |

### Backend Application Configuration (Spring Boot)
### Spring Boot Configuration

The Consumer Backend is running over a Spring Boot server, therefore a application configuration file was created to set up mandatory parameters like the Keycloak host, and the security constrains for accessing each API and Services:

| Name | Location | Link |
| ---- | -------- | ---- |
| Application Configuration | GitHub | [https://github.com/eclipse-tractusx/digital-product-pass/blob/main/consumer-backend/productpass/src/main/resources/application.yml](https://github.com/eclipse-tractusx/digital-product-pass/blob/main/consumer-backend/productpass/src/main/resources/application.yml) |
| Spring Boot Server Configuration | GitHub | [https://github.com/eclipse-tractusx/digital-product-pass/blob/main/consumer-backend/productpass/src/main/resources/application.yml](https://github.com/eclipse-tractusx/digital-product-pass/blob/main/consumer-backend/productpass/src/main/resources/application.yml) |

All the application utilizes these variables to configure the utilities (tools) and other controllers/services.

Expand Down Expand Up @@ -169,39 +179,41 @@ When configuring your EDC Provider you need to take info consideration the follo

**All variables are written in the following notation: ***{{ VARIABLE_NAME }}*****

All the configurations are in JSON notation and follow the [EDC Configuration from Catena-X](https://github.com/catenax-ng/product-edc) and the [Eclipse Foundation](https://github.com/eclipse-edc/Connector).
All the configurations are in JSON notation and follow the [EDC Configuration from Catena-X](https://github.com/eclipse-tractusx/tractusx-edc) and the [Eclipse Foundation](https://github.com/eclipse-edc/Connector).

### Asset Configuration

When configurating you EDC provider you will be able to set some assets which reference to a certain endpoint.

> **_INFO:_** *All public assets must be registered in a SubModel from a Digital Twin in the [Digital Twin Registry](https://semantics.int.demo.catena-x.net/registry/swagger-ui/index.html).*
> **_INFO:_** *All public assets must be registered in a SubModel from a Digital Twin in the Digital Twin Registry.*

#### **Variables:**

| Name | Description | Example Value |
| ---- | -------- | ---- |
| AssetId | Combination of Digital Twin and Sub Model UUIDs | urn:uuid:32aa72de-297a-4405-9148-13e12744028a-urn:uuid:699f1245-f57e-4d6b-acdb-ab763665554a |
| AssetId | Combination of Digital Twin and Sub Model UUIDs | 32aa72de-297a-4405-9148-13e12744028a-699f1245-f57e-4d6b-acdb-ab763665554a |
| Description | Simple description of the asset | Battery Passport Test Data |
| DataProviderEndpointUrl | URL to the endpoint which stores and serves the data, basically a Database that retrieves plain text/json data for a certain API | [https://materialpass.int.demo.catena-x.net/provider_backend/data](https://materialpass.int.demo.catena-x.net/provider_backend/data) |
| DigitalTwinId | Id from the Digital Twin | urn:uuid:32aa72de-297a-4405-9148-13e12744028a |
| DigitalTwinSubmodelId | Sub Model Id registered in the Digital Twin Registry | urn:uuid:699f1245-f57e-4d6b-acdb-ab763665554a |
| DigitalTwinId | Id from the Digital Twin | 32aa72de-297a-4405-9148-13e12744028a |
| DigitalTwinSubmodelId | Sub Model Id registered in the Digital Twin Registry | 699f1245-f57e-4d6b-acdb-ab763665554a |


#### **Format and Fields:**

```
{
"@context": {},
"asset": {
"@type": "Asset",
"@id": "{{AssetId}}",
"properties": {
"asset:prop:id": "{{AssetId}}",
"asset:prop:description": "{{Description}}"
"description": "{{Description}}"
}
},
"dataAddress": {
"properties": {
"type": "HttpData",
"baseUrl": "{{DataProviderEndpointUrl}}/{{DigitalTwinId}}-{{DigitalTwinSubmodelId}}"
}
"@type": "DataAddress",
"type": "HttpData",
"baseUrl": "{{DataProviderEndpointUrl}}/{{DigitalTwinId}}-{{DigitalTwinSubmodelId}}"
}
}
```
Expand Down Expand Up @@ -229,27 +241,37 @@ Here we specify a simple policy with just the USAGE permission, so we are able t
| Name | Description | Example Value |
| ---- | -------- | ---- |
| PolicyId | UUID that identifies the policy in the EDC Connector | ad8d2c57-cf32-409c-96a8-be59675b6ae5 |
| PermissionType | DID Permission Type | dataspaceconnector:permission |
| PermissionType | DID Permission Type | PolicyDefinitionRequestDto |
| PermissionActionType | Defines the action allowed when the permission is assigned to an asset. In case of the usage policy the value "USE" is necessary | "USE" |


#### **Format and Fields:**

```
{
"id": "{{PolicyId}}",
"@context": {
"odrl": "http://www.w3.org/ns/odrl/2/leftOperand"
},
"@type": "{{PermissionType}}",
"@id": "{{PolicyId}}",
"policy": {
"prohibitions": [],
"obligations": [],
"permissions": [
"@type": "Policy",
"odrl:permission" : [{
"odrl:action": "{{PermissionActionType}}",
"odrl:constraint": {
"odrl:constraint": {
"@type": "LogicalConstradev",
"odrl:or": [
{
"edctype": "{{PermissionType}}",
"action": {
"type": "{{PermissionActionType}}"
},
"constraints": []
"@type": "Contraint",
"odrl:leftOperand": "BusinessPartnerNumber",
"odrl:operator": "EQ",
"odrl:rightOperand": "<some-bpn>"
}
]
]
}
}
}]
}
}
```
Expand All @@ -266,7 +288,7 @@ Contract definitions allow us to expose the assets and link them to a contract p
| Name | Description | Example Value |
| ---- | -------- | ---- |
| ContractDefinitionId | UUID that identifies the policy in the EDC Connector | 76b50bfc-ec19-457f-9911-a283f0d6d0df |
| AssetId | Combination of Digital Twin and Sub Model UUIDs | urn:uuid:32aa72de-297a-4405-9148-13e12744028a-urn:uuid:699f1245-f57e-4d6b-acdb-ab763665554a |
| AssetId | Combination of Digital Twin and Sub Model UUIDs | 32aa72de-297a-4405-9148-13e12744028a-699f1245-f57e-4d6b-acdb-ab763665554a |
| AccessPolicyId | Policy that allows/restricts/enforces asset access constrains | ad8d2c57-cf32-409c-96a8-be59675b6ae5 |
| ContractPolicyId | Policy that allows/restricts/enforces contract constrains | ad8d2c57-cf32-409c-96a8-be59675b6ae5 |

Expand All @@ -277,16 +299,17 @@ Contract definitions allow us to expose the assets and link them to a contract p

```
{
"id": "{{ContractDefinitionId}}",
"criteria": [
{
"operandLeft": "asset:prop:id",
"operator": "=",
"operandRight": "{{AssetId}}"
}
],
"@context": {},
"@id": "{{ContractDefinitionId}}",
"@type": "ContractDefinition",
"accessPolicyId": "{{AccessPolicyId}}",
"contractPolicyId": "{{ContractPolicyId}}"
"contractPolicyId": "{{ContractPolicyId}}",
"assetsSelector" : {
"@type" : "CriterionDto",
"operandLeft": "https://w3id.org/edc/v0.0.1/ns/id",
"operator": "=",
"operandRight": "{{AssetId}}"
}
}
```

Expand All @@ -302,8 +325,8 @@ Once you finish the configuration, to make the endpoint public configure in the

| Name | Description | Example Value |
| ---- | -------- | ---- |
| DigitalTwinId | Manually generated DID that contains a UUID | urn:uuid:32aa72de-297a-4405-9148-13e12744028a |
| DigitalTwinSubmodelId | Sub Model Id registered in the Digital Twin Registry | urn:uuid:699f1245-f57e-4d6b-acdb-ab763665554a |
| DigitalTwinId | Manually generated DID that contains a UUID | 32aa72de-297a-4405-9148-13e12744028a |
| DigitalTwinSubmodelId | Sub Model Id registered in the Digital Twin Registry | 699f1245-f57e-4d6b-acdb-ab763665554a |
| PartInstanceId | Battery passport attribute - part instance Id | X123456789012X12345678901234566 |
| EDCProviderUrl | URL to the endpoint which contains the EDC Provider | [https://materialpass.int.demo.catena-x.net](https://materialpass.int.demo.catena-x.net) |
| BPN | OPTIONAL: The endpoint address can include a BPN number, which shall lead to the EDC Provider, and return the contracts when called from an EDC Consumer | BPNL000000000000 |
Expand All @@ -317,43 +340,49 @@ Once you finish the configuration, to make the endpoint public configure in the

```
{
"description": [],
"globalAssetId": {
"value": [
"{{DigitalTwinId}}"
]
},
"description": [
{
"language": "en",
"text": "Battery Passport shell descriptor"
}
],
"idShort": "Battery_{{PartInstanceId}}",
"identification": "{{DigitalTwinId}}",
"id": "{{DigitalTwinId}}",
"specificAssetIds": [
{
"key": "partInstanceId",
"name": "partInstanceId",
"value": "{{PartInstanceId}}"
}
],
"submodelDescriptors": [
{
"description": [
"endpoints": [
{
"language": "en",
"text": "Battery Passport Submodel"
"interface": "SUBMODEL-1.0RC02",
"protocolInformation": {
"href": "{{EDCProviderUrl}}/{{BPN}}/{{DigitalTwinId}}-{{DigitalTwinSubmodelId}}",
"endpointProtocol": "IDS/ECLIPSE DATASPACE CONNECTOR",
"endpointProtocolVersion": [ "1.1" ],
"subprotocol": "IDS",
"subprotocolBody": ""
}
}
],
"idShort": "{{SubmodelIdShort}}",
"identification": "{{DigitalTwinSubmodelId}}",
"id": "{{DigitalTwinSubmodelId}}",
"semanticId": {
"value": [
"{{BammModelVersionId}}"
"type": "ExternalReference",
"keys": [
{
"type": "Submodel",
"value": "{{BammModelVersionId}}"
}
]
},
"endpoints": [
"description": [
{
"interface": "EDC",
"protocolInformation": {
"endpointAddress": "{{EDCProviderUrl}}/{{BPN}}/{{DigitalTwinId}}-{{DigitalTwinSubmodelId}}/submodel?content=value&extent=WithBLOBValue",
"endpointProtocol": "IDS/ECLIPSE DATASPACE CONNECTOR",
"endpointProtocolVersion": "0.0.1-SNAPSHOT"
}
"language": "en",
"text": "Battery Passport Submodel"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion docs/cypress/CYPRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ This is the documentation for Battery Passport App E2E Cypress test.

## Steps tested

![test](./test2.png)
![test](./test.png)
</br></br>
Binary file modified docs/cypress/GUI-passing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/cypress/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/cypress/test2.png
Binary file not shown.
19 changes: 14 additions & 5 deletions postman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,29 @@

## Getting Started Guide

This technical guide depicts the battery pass end-to-end API calls through the postman REST client.
This technical guide depicts the digital product pass end-to-end API calls through the postman REST client.

### Components in BatteryPass collection:
### Components in Digital Product Pass:
- Provider
- Registry
- Discovery Finder
- BPN Discovery
- EDC Discovery
- Consumer
- CX Registry
- Data transfer
- Backend


### Steps to Proceed
- Setup up [Postman client](https://www.postman.com/downloads)

- Import a [Battery Pass collection](./v3.0.1/Battery-Pass_INT.postman_collection.json)
- Import the [Digital Product Pass](./v3.0.1/Digital-Product-Pass-collection.json)

- Configure the ***clientId*** and ***clientSecret*** environment variables from the variables tab inside root directory.
- Configure the following environment variables from the variables tab inside root directory.

- ***APIKey***
- ***clientId***
- ***clientSecret***
- ***bpnNumber***

For more technical documentation, please refer to the [catenax-at-home-getting-started-guide](https://catenax-ng.github.io/docs/guides/catenax-at-home)
Loading