Skip to content

Commit

Permalink
add test on asset creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Oct 27, 2023
1 parent a413111 commit d54960a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'

- run: |
npm install
npm run cy
- run: npm install

- run: npm run cy

- name: Print docker logs
if: failure()
Expand Down
3 changes: 2 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:18080',
supportFile: false
supportFile: false,
experimentalStudio: true
},
env: {
consumerUrl: 'http//localhost:18080',
Expand Down
25 changes: 22 additions & 3 deletions cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
describe('end-to-end', () => {
it('should be accessible', () => {
const consumerUrl = Cypress.env('consumerUrl')
const providerUrl = Cypress.env('providerUrl')
const uuid = () => Cypress._.random(0, 1e6)
const consumerUrl = Cypress.env('consumerUrl')
const providerUrl = Cypress.env('providerUrl')

it('should be accessible', () => {
cy.visit(consumerUrl);

cy.visit(providerUrl);
})

it('should create an asset and view it on provider side', function() {
cy.visit(providerUrl);

const id = uuid()
const name = `asset-${id}`

cy.get('[href="/my-assets"]').as('assets-menu-item').click();
cy.get('.container').contains('Create asset').as('open-new-asset-dialog').click();
cy.get('#mat-input-1').as('asset-id-field').clear();
cy.get('@asset-id-field').type(id);
cy.get('#mat-input-2').as('asset-name-field').clear('ra');
cy.get('@asset-name-field').type(name);
cy.get('.mat-dialog-actions > :nth-child(1) > .mat-button-wrapper').as('confirm-create-asset').click();
cy.get('#mat-input-0').as('asset-filter').clear().type(name);

cy.get('[fxLayout="row wrap"]').as('assets-list').find('mat-card').should('have.length', 1)
});
})
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class AssetViewerComponent implements OnInit {
switchMap(() => {
const assets$ = this.assetService.requestAssets();
return !!this.searchText
? assets$.pipe(map(assets => assets.filter(asset => asset.name.includes(this.searchText))))
? assets$.pipe(map(assets => assets.filter(asset => asset.properties.optionalValue<string>('edc', 'name')?.includes(this.searchText))))
: assets$;
}));
}
Expand Down

0 comments on commit d54960a

Please sign in to comment.