Skip to content

Commit

Permalink
Portal 0.4 related updatesst (#248)
Browse files Browse the repository at this point in the history
* add cache and secret components

* Add login mockup page

* Extract the secret as a separate page

* Extract the secret as a separate page

* Distinguish policy and report display after selecting vac

* Modify nav

* Test data splicing to node server

* Transfer setting, policy, secret POST related request structure to node server

* Increase test force and modify e2e test

* fixed Server-side request forgery

* Missing rate limiting

* test fixed Server-side request forgery

* fixed Server-side request forgery

* cypress fixed

* Add test cases to existing code

* Split settings into harbor vac and cache

* update syntax error

* implements trivy reports

* update trivy report

* fixed report view page

* fixed report view page

* Relevant test code updates
  • Loading branch information
qijianshuai authored Jun 9, 2023
1 parent 2a1c75a commit c0acd4e
Show file tree
Hide file tree
Showing 88 changed files with 4,041 additions and 5,046 deletions.
23 changes: 20 additions & 3 deletions cnsi-portal/cypress/e2e/policy.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,26 @@ describe('Setting Test', () => {
// failing the test
return false
})
cy.intercept('GET', environment.api.goharbor + '/inspectionpolicies', { fixture: 'policy.json' })
cy.intercept('GET', '/proxy/apis/goharbor.goharbor.io/v1alpha1/settings', { fixture: 'settings.json' })
cy.intercept('POST', environment.api.goharbor + '/inspectionpolicies', {
cy.intercept('GET', '/status', {
statusCode: 200,
body: {
msg: 'sussessful!',
},
})
cy.intercept('GET', environment.api.k8sPost + '/policy', { fixture: 'policy.json' })
cy.intercept('GET', environment.api.k8sPost + '/harbor', { fixture: 'settings.json' })
cy.intercept('GET', environment.api.k8sPost + '/namespace', { fixture: 'namespace.json' })
cy.intercept('GET', environment.api.k8sPost + '/apiservice', { fixture: 'apiservices.json' })
cy.intercept('GET', environment.api.k8sPost + '/node', { fixture: 'nodes.json' })
cy.intercept('GET', environment.api.k8sPost + '/secret?namespace=' + 'default', { fixture: 'secrets.json' })
cy.intercept('GET', environment.api.k8sPost + '/harbor', { fixture: 'settings.json' })
cy.intercept('POST', environment.api.k8sPost+ '/secret?namespace=' + 'default', {
statusCode: 201,
body: {
msg: 'created sussessful!',
},
})
cy.intercept('POST', environment.api.k8sPost + '/policy', {
statusCode: 201,
body: {
msg: 'created sussessful!',
Expand Down
50 changes: 39 additions & 11 deletions cnsi-portal/cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,32 @@ describe('Setting Test', () => {
return false
})
cy.intercept('GET', environment.api.goharbor + '/assessmentreports', { fixture: 'tags.json' })
cy.intercept('GET', '/status', {
statusCode: 200,
body: {
msg: 'sussessful!',
},
})
cy.intercept('GET', environment.api.goharbor + '/assessmentreports?limit=10&continue=', { fixture: 'tags.json' })
cy.intercept('GET', '/proxy/api/v1/namespaces', { fixture: 'namespace.json' })
cy.intercept('GET', '/proxy/apis/apiregistration.k8s.io/v1/apiservices', { fixture: 'apiservices.json' })
cy.intercept('GET', '/proxy/api/v1/nodes', { fixture: 'nodes.json' })
cy.intercept('GET', '/proxy/api/v1/namespaces/default/secrets', { fixture: 'secrets.json' })
cy.intercept('GET', '/proxy/apis/goharbor.goharbor.io/v1alpha1/settings', { fixture: 'settings.json' })
cy.intercept('POST', environment.api.k8s + '/namespaces/default/secrets', {
cy.intercept('GET', environment.api.k8sPost + '/namespace', { fixture: 'namespace.json' })
cy.intercept('GET', environment.api.k8sPost + '/apiservice', { fixture: 'apiservices.json' })
cy.intercept('GET', environment.api.k8sPost + '/node', { fixture: 'nodes.json' })
cy.intercept('GET', environment.api.k8sPost + '/secret?namespace=default', { fixture: 'secrets.json' })
cy.intercept('GET', environment.api.k8sPost + '/harbor', { fixture: 'settings.json' })
cy.intercept('POST', environment.api.k8sPost + '/harbor', {
statusCode: 201,
body: {
msg: 'created sussessful!',
},
})
cy.visit('http://127.0.0.1:4004/data-source/harbor')

cy.intercept('POST', environment.api.k8sPost+ '/secret?namespace=default' , {
statusCode: 201,
body: {
msg: 'created sussessful!',
},
})
cy.visit('http://127.0.0.1:4004/setting/secret')
// cy.visit('https://angular.realworld.io/')
})

Expand All @@ -55,21 +68,36 @@ describe('Setting Test', () => {
cy.get('[data-cy=accessKey]').type('admin', {force: true})
cy.get('[data-cy=accessSecret]').type('Harbor12345', {force: true})
cy.get('[data-cy=createSecret]').click()
// create setting
cy.get('[data-cy=cut_setting]').click()

})

it('setting', () => {
cy.visit('http://127.0.0.1:4004/data-source/harbor')
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
cy.wait(1000)
// create setting
cy.get('[data-cy=cut_setting]').click()
// cy.get('[data-cy=cut_setting]').click()
cy.visit('http://127.0.0.1:4004/modify-data-source/create')
})


it('setting create', () => {
cy.visit('http://127.0.0.1:4004/modify-data-source/create')
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
cy.get('[data-cy=first_next]').click()
// cy.get('[data-cy=second_next]').click()
// cy.get('[data-cy=address]').type('https://api.int.app-catalog.vmware.com/catalog-governor/v1/products', {force: true})
// cy.get('[data-cy=secret]').select('harbor')
// cy.get('[data-cy=third_next]').click()
cy.get('[data-cy=submit_setting]').click()

})


Expand Down
1 change: 1 addition & 0 deletions cnsi-portal/express-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"connect-history-api-fallback": "^1.6.0",
"ejs": "^3.1.6",
"express": "^4.17.2",
"express-rate-limit": "^6.7.0",
"http-proxy-middleware": "^2.0.6",
"https": "^1.0.0",
"request": "^2.88.2",
Expand Down
Loading

0 comments on commit c0acd4e

Please sign in to comment.