Skip to content

Commit

Permalink
Merge pull request #97 from eclipse-mnestix/staging
Browse files Browse the repository at this point in the history
Release 1.4.0
  • Loading branch information
GailMelanie authored Feb 6, 2025
2 parents e13022d + 773d28f commit 1009635
Show file tree
Hide file tree
Showing 110 changed files with 4,326 additions and 3,944 deletions.
1 change: 0 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ APPLICATION_ID_URI: 'api://mnestix-test-web-api/'
LOCK_TIMESERIES_PERIOD_FEATURE_FLAG: true
COMPARISON_FEATURE_FLAG: true
AAS_LIST_FEATURE_FLAG: true
AAS_LIST_V2_FEATURE_FLAG: false
TRANSFER_FEATURE_FLAG: false
AAS_REPO_API_URL: 'http://localhost:5064/repo'
SUBMODEL_REPO_API_URL: 'http://localhost:5064/repo'
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
IMAGE_NAME: mnestix-browser
IMAGE_TAG: latest
# Update the version manually
IMAGE_TAG_VERSION: 1.3.3
IMAGE_TAG_VERSION: 1.4.0
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_PASS: ${{ secrets.DOCKER_API_TOKEN }}

Expand Down Expand Up @@ -80,15 +80,15 @@ jobs:
with:
name: mnestix-browser

- name: Load mnestix-browser image
run: docker load -i mnestix-browser.tar

# image too big to be reused
- name: prepare tests
run: |
docker compose -f compose.yml -f docker-compose/compose.test.yml --profile tests build cypress-test
docker compose -f compose.yml -f docker-compose/compose.test.yml --profile tests pull
- name: Load mnestix-browser image
run: docker load -i mnestix-browser.tar

- name: Run e2e tests
id: test
run: |
Expand All @@ -97,6 +97,8 @@ jobs:
env:
SPLIT: ${{ strategy.job-total }}
SPLIT_INDEX: ${{ strategy.job-index }}
TEST_ADMIN_USER_PASSWORD: ${{ secrets.TEST_ADMIN_USER_PASSWORD }}
TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}

- name: E2E test collect artifact
id: test_artifact
Expand All @@ -105,6 +107,10 @@ jobs:
name: cypress-artifacts-${{ matrix.containers }}
path: cypress-artifacts/

- name: Fail if e2e tests failed
if: ${{ failure() }}
run: exit 1

push-image:
name: Push image to registry
needs: [ 'build-browser-image', 'unit-tests', 'e2e-tests' ]
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/publish-wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish wiki
on:
push:
branches: [ main ]
paths:
- wiki/**
- .github/workflows/publish-wiki.yml
concurrency:
group: publish-wiki
cancel-in-progress: true
permissions:
contents: write
jobs:
publish-wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Andrew-Chen-Wang/github-wiki-action@v4
686 changes: 6 additions & 680 deletions README.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ services:
MNESTIX_BACKEND_API_URL: 'http://mnestix-api:5064'
MNESTIX_BACKEND_API_KEY: ${MNESTIX_BACKEND_API_KEY:-verySecureApiKey}
AAS_LIST_FEATURE_FLAG: "true"
AAS_LIST_V2_FEATURE_FLAG: "false"
TRANSFER_FEATURE_FLAG: "false"
COMPARISON_FEATURE_FLAG: "true"
AUTHENTICATION_FEATURE_FLAG: "false"
Expand All @@ -42,7 +41,7 @@ services:
- mnestix-database:/app/prisma/database

mnestix-api:
image: mnestix/mnestix-api:1.2.5
image: mnestix/mnestix-api:1.3.0
container_name: mnestix-api
profiles: [ "", "backend", "tests" ]
ports:
Expand Down
5 changes: 5 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@ export default defineConfig({
MNESTIX_BACKEND_API_URL: 'http://localhost:5064',
AAS_DISCOVERY_API_URL: 'http://localhost:5064/discovery',
MNESTIX_API_KEY: process.env.MNESTIX_BACKEND_API_KEY,
TEST_ADMIN_USER_LOGIN: process.env.TEST_ADMIN_USER_LOGIN,
TEST_ADMIN_USER_PASSWORD: process.env.TEST_ADMIN_USER_PASSWORD,
TEST_USER_LOGIN: process.env.TEST_USER_LOGIN,
TEST_USER_PASSWORD: process.env.TEST_USER_PASSWORD,
KEYCLOAK_ISSUER: process.env.KEYCLOAK_ISSUER,
},
});
2 changes: 1 addition & 1 deletion cypress/e2e/dnsRedirectTest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Test the DNS Redirect', function () {
cy.postTestAas();
});
it('Visits the "/asset/URLEncodedAssetID" page and gets redirected to the corresponding viewer page', function () {
cy.intercept({ method: 'POST', url: `/en/viewer/*` }).as('redirectedViewer');
cy.intercept({ method: 'POST', url: '/en/viewer/*' }).as('redirectedViewer');
let encodedUrl = encodeURIComponent(testAssetId);

cy.visit('/asset?assetId=' + encodedUrl);
Expand Down
115 changes: 49 additions & 66 deletions cypress/e2e/listAasPageTest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,77 +9,60 @@ describe('Test all Aas List features (Resolution 1920 x 1080)', function () {
cy.setResolution(resolutions[0]);
cy.visit('/list');
});
it('should redirect to aas list when pressing the aas list button on the homepage', function () {
cy.visit('/');
cy.getByTestId('aasList-Button-Home').click();
cy.url().should('contain', '/list');
});
it('should redirect to the viewer page when clicking on an aas list entry', function () {
cy.getByTestId('list-to-detailview-button').first().click();
cy.wait(100);
cy.url().should('contain', '/viewer/');
});
it('should show the selected aas in the comparison list and enable the button', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="selected-https://mnestix.io/aas/listTest1').should('exist');
cy.getByTestId('compare-button').should('not.be.disabled');
});
it('should remove the aas from the comparison list when deselected and disable the button', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="selected-https://mnestix.io/aas/listTest1').should('not.exist');
cy.getByTestId('compare-button').should('be.disabled');
});
it('should disable checkboxes and show a warning when the user tries to select more than 3 aas', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest3"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest4"]')
.findByTestId('list-checkbox')
.parent()
.click();
cy.get('.MuiAlert-root').should('exist');
});
it('should redirect to the comparison page when one aas is selected and button is pressed', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.getByTestId('compare-button').click();
cy.wait(100);
cy.url().should('contain', '/compare');
});
it('should filter the aas list when a product class is selected', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox');

cy.getByTestId('product-class-select').click();
cy.getByTestId('product-class-select-Actuator').click();

it('should load the first list page of the default repository and display the data', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]')
.findByTestId('product-class-chip')
.contains('Actuator');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]').should('not.exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest3"]').should('not.exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest4"]').should('not.exist');
});
it('should update the filtered aas list when another product class is selected', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox');

cy.getByTestId('product-class-select').click();
cy.getByTestId('product-class-select-Control-system').click();
.findByTestId('list-aasId')
.contains('https://mnestix.io/aas/listTest1');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]')
.findByTestId('list-assetId')
.contains('https://mnestix.io/listTest1');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]')
.findByTestId('list-manufacturer-name')
.contains('listTest1 Manufacturer Name');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]')
.findByTestId('list-product-designation')
.contains('listTest1 Product Designation');

cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').should('not.exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]').should('exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest3"]').should('not.exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest4"]').should('not.exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]')
.findByTestId('list-aasId')
.contains('https://mnestix.io/aas/listTest2');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]')
.findByTestId('list-assetId')
.contains('https://mnestix.io/listTest2');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]')
.findByTestId('list-manufacturer-name')
.contains('listTest2 Manufacturer Name');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]')
.findByTestId('list-product-designation')
.contains('listTest2 Product Designation');
});
it('should show the full aas list when the product class is reset', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox');

cy.getByTestId('product-class-select').click();
cy.getByTestId('product-class-select-all').click();

cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').should('exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]').should('exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest3"]').should('exist');
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest4"]').should('exist');
describe('comparison list', function () {
it('should show the selected aas in the comparison list, and comparison button redirects to comparison', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="selected-https://mnestix.io/aas/listTest1').should('exist');
cy.getByTestId('compare-button').should('not.be.disabled');
cy.getByTestId('compare-button').click();
cy.wait(100);
cy.url().should('contain', '/compare');
});
it('should remove the aas from the comparison list when deselected and disable the button', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="selected-https://mnestix.io/aas/listTest1').should('not.exist');
cy.getByTestId('compare-button').should('be.disabled');
});
it('should disable checkboxes and show a warning when the user tries to select more than 3 aas', function () {
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest1"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest2"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest3"]').findByTestId('list-checkbox').click();
cy.get('[data-testid="list-row-https://mnestix.io/aas/listTest4"]')
.findByTestId('list-checkbox')
.parent()
.click();
cy.get('.MuiAlert-root').should('exist');
});
});

after(function () {
Expand Down
78 changes: 78 additions & 0 deletions cypress/e2e/loginKeycloak.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
describe('Login Keycloak user roles', function () {
const adminTestUser = {
login: Cypress.env('TEST_ADMIN_USER_LOGIN'),
password: Cypress.env('TEST_ADMIN_USER_PASSWORD'),
};
const testUser = {
login: Cypress.env('TEST_USER_LOGIN'),
password: Cypress.env('TEST_USER_PASSWORD'),
};

beforeEach(function () {
cy.visit('/');
});
it('should be possible to login', () => {
cy.getByTestId('header-burgermenu').click();
cy.getByTestId('login-button').should('exist');
});

it('should not be able to access templates without login', () => {
cy.visit('/templates');
cy.getByTestId('authentication-prompt-lock').should('exist');
});

it('should show correct admin user login and icon', () => {
cy.keycloakLogin(adminTestUser.login, adminTestUser.password);
cy.getByTestId('header-burgermenu').click();

cy.getByTestId('user-info-box').should('have.text', 'admin@test.com');
cy.getByTestId('admin-icon').should('exist');
cy.getByTestId('login-button').should('be.not.exist');
cy.keycloakLogout();
});

it('should navigate to settings when logged in as admin user', () => {
cy.keycloakLogin(adminTestUser.login, adminTestUser.password);
cy.getByTestId('header-burgermenu').click();

cy.getByTestId('settings-menu-icon').should('exist').click();
cy.getByTestId('settings-route-page').should('exist');
cy.getByTestId('settings-header').should('have.text', 'Settings');

cy.getByTestId('header-burgermenu').click();
cy.keycloakLogout();
});

it('should show correct user login and icon', () => {
cy.keycloakLogin(testUser.login, testUser.password);
cy.getByTestId('header-burgermenu').click();

cy.getByTestId('user-info-box').should('have.text', 'user@test.com');
cy.getByTestId('user-icon').should('exist');
cy.getByTestId('login-button').should('be.not.exist');
cy.keycloakLogout();
});

it('should navigate to template when logged in as a user', () => {
cy.keycloakLogin(testUser.login, testUser.password);

cy.visit('/templates');
cy.getByTestId('templates-route-page').should('exist');
cy.getByTestId('templates-header').should('include.text', 'Templates');

cy.getByTestId('header-burgermenu').click();
cy.keycloakLogout();
});

it('should block settings route when logged in as s user', () => {
cy.keycloakLogin(testUser.login, testUser.password);

cy.visit('/settings');
cy.getByTestId('not-allowed-prompt-lock').should('exist');

cy.getByTestId('header-burgermenu').click();
cy.getByTestId('settings-menu-icon').should('not.exist');

cy.keycloakLogout();
});
});
Loading

0 comments on commit 1009635

Please sign in to comment.