From 7b075a77d305346999b24eb6a8a8e541522aa07b Mon Sep 17 00:00:00 2001 From: Chaitali Mane <71449322+chaitali-mane@users.noreply.github.com> Date: Tue, 11 Jan 2022 13:10:32 +0530 Subject: [PATCH] Updated Infra Proxy cypress tests for web UI key (#6511) * Updated cypress tests for web ui key Signed-off-by: Chaitali Mane * Key in uppercase Signed-off-by: Chaitali Mane * Update for minor Signed-off-by: Chaitali Mane * removed unused lines Signed-off-by: Chaitali Mane * removed error unit tests Signed-off-by: Chaitali Mane * removed iam lint error Signed-off-by: Chaitali Mane * Adding Cypress env variable for WebUI key Signed-off-by: Kallol Roy * Updated variable Signed-off-by: Chaitali Mane * removed replace Signed-off-by: Chaitali Mane * Adding variable Signed-off-by: Chaitali Mane * minor change Signed-off-by: Chaitali Mane * removed hard coded values Signed-off-by: Chaitali Mane * Removed hard coded values Signed-off-by: Chaitali Mane * Updated variables Signed-off-by: Chaitali Mane Co-authored-by: Kallol Roy --- .expeditor/verify_private.pipeline.yml | 3 + .../chef-server-details.component.spec.ts | 1 - .../client-details.component.spec.ts | 1 - .../clients/clients.component.spec.ts | 2 - ...ook-dependencies-details.component.spec.ts | 1 - .../cookbook-dependencies.component.spec.ts | 1 - .../cookbook-details.component.spec.ts | 1 - .../cookbooks/cookbooks.component.spec.ts | 2 - .../data-bags-list.component.spec.ts | 3 - .../environments.component.spec.ts | 3 - ...ncluded-policies-details.component.spec.ts | 1 - .../infra-node-details.component.spec.ts | 2 +- .../infra-nodes/infra-nodes.component.spec.ts | 1 - .../infra-role-details.component.spec.ts | 1 - .../infra-roles/infra-roles.component.spec.ts | 1 - .../org-details/org-details.component.spec.ts | 1 - .../org-edit/org-edit.component.spec.ts | 1 - .../policy-file-details.component.spec.ts | 1 - .../policy-files.component.spec.ts | 1 - .../reset-admin-key.component.spec.ts | 2 - .../update-web-uikey-slider.component.spec.ts | 146 ------------------ .../roles/list/roles-list.component.spec.ts | 1 - .../api/iam/infra_editor_actions.spec.ts | 6 +- .../api/iam/infra_viewer_actions.spec.ts | 2 +- .../chef-organization-details.spec.ts | 23 ++- .../infra-proxy/chef-server-details.spec.ts | 30 ++-- .../ui/infra-proxy/chef-servers.spec.ts | 10 +- .../ui/infra-proxy/infra-databags.spec.ts | 14 +- .../ui/infra-proxy/infra-node-details.spec.ts | 24 +-- .../ui/infra-proxy/infra-node-list.spec.ts | 14 +- .../infra-policy-file-details.spec.ts | 24 +-- .../infra-policy-file-list.spec.ts | 14 +- .../infra-policy-group-details.spec.ts | 14 +- .../infra-policy-groups-list.spec.ts | 14 +- .../ui/infra-proxy/infra-role-details.spec.ts | 41 +++-- .../ui/infra-proxy/infra-roles.spec.ts | 41 ++--- .../update-web-uikey-slider.spec.ts | 17 +- integration/run_test | 1 + scripts/get_secrets.sh | 2 + 39 files changed, 162 insertions(+), 306 deletions(-) delete mode 100644 components/automate-ui/src/app/modules/infra-proxy/update-web-uikey-slider/update-web-uikey-slider.component.spec.ts diff --git a/.expeditor/verify_private.pipeline.yml b/.expeditor/verify_private.pipeline.yml index 5c2634b5487..f7673982b37 100644 --- a/.expeditor/verify_private.pipeline.yml +++ b/.expeditor/verify_private.pipeline.yml @@ -494,6 +494,9 @@ steps: CYPRESS_AUTOMATE_INFRA_ADMIN_KEY: path: secret/a2/testing/infra_admin_key field: data + CYPRESS_AUTOMATE_INFRA_WEBUI_KEY: + path: secret/a2/testing/infra_webui_key + field: data executor: linux: privileged: true diff --git a/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.spec.ts index 6480430f8fb..3b2fa75e36a 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.spec.ts @@ -38,7 +38,6 @@ describe('ChefServerDetailsComponent', () => { MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), MockComponent({ selector: 'chef-heading' }), - MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-option' }), MockComponent({ selector: 'chef-page-header' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/client-details/client-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/client-details/client-details.component.spec.ts index 383e05cd27a..16087411020 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/client-details/client-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/client-details/client-details.component.spec.ts @@ -15,7 +15,6 @@ describe('ClientDetailsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), MockComponent({ selector: 'chef-button', inputs: ['disabled', 'routerLink'] }), MockComponent({ selector: 'mat-select' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/clients/clients.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/clients/clients.component.spec.ts index bb00098df1c..be357b5786e 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/clients/clients.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/clients/clients.component.spec.ts @@ -24,8 +24,6 @@ describe('ClientsComponent', () => { MockComponent({ selector: 'a', inputs: ['routerLink'] }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), - MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-page-header' }), MockComponent({ selector: 'chef-subheading' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies-details/cookbook-dependencies-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies-details/cookbook-dependencies-details.component.spec.ts index e2aaee1ab88..0e6060f372b 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies-details/cookbook-dependencies-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies-details/cookbook-dependencies-details.component.spec.ts @@ -22,7 +22,6 @@ describe('CookbookDependenciesDetailsComponent', () => { MockComponent({ selector: 'chef-td' }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'mat-select' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies/cookbook-dependencies.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies/cookbook-dependencies.component.spec.ts index d6c0722f88e..73062ec2e3a 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies/cookbook-dependencies.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/cookbook-dependencies/cookbook-dependencies.component.spec.ts @@ -38,7 +38,6 @@ describe('CookbookDependenciesComponent', () => { MockComponent({ selector: 'chef-th' }), MockComponent({ selector: 'chef-td' }), MockComponent({ selector: 'a', inputs: ['routerLink'] }), - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), CookbookDependenciesComponent ], providers: [ diff --git a/components/automate-ui/src/app/modules/infra-proxy/cookbook-details/cookbook-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/cookbook-details/cookbook-details.component.spec.ts index cb182603297..2a9a59da8d2 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/cookbook-details/cookbook-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/cookbook-details/cookbook-details.component.spec.ts @@ -32,7 +32,6 @@ const declarations: any[] = [ MockComponent({ selector: 'chef-subheading' }), MockComponent({ selector: 'chef-toolbar' }), MockComponent({ selector: 'a', inputs: ['routerLink'] }), - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), MockComponent({ selector: 'chef-snippet', inputs: ['code'] }), CookbookDetailsComponent ]; diff --git a/components/automate-ui/src/app/modules/infra-proxy/cookbooks/cookbooks.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/cookbooks/cookbooks.component.spec.ts index 0c4a5d1ba67..bfc75fe7b4d 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/cookbooks/cookbooks.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/cookbooks/cookbooks.component.spec.ts @@ -21,8 +21,6 @@ describe('CookbooksComponent', () => { MockComponent({ selector: 'a', inputs: ['routerLink'] }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), - MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-page-header' }), MockComponent({ selector: 'chef-subheading' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/data-bags-list/data-bags-list.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/data-bags-list/data-bags-list.component.spec.ts index ec5b0f1184f..9f009564586 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/data-bags-list/data-bags-list.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/data-bags-list/data-bags-list.component.spec.ts @@ -27,8 +27,6 @@ describe('DataBagsListComponent', () => { outputs: ['close', 'deleteClicked'] }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), - MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-page-header' }), MockComponent({ selector: 'chef-subheading' }), @@ -39,7 +37,6 @@ describe('DataBagsListComponent', () => { MockComponent({ selector: 'chef-tr' }), MockComponent({ selector: 'chef-th' }), MockComponent({ selector: 'chef-td' }), - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), MockComponent({ selector: 'mat-select' }), MockComponent({ selector: 'mat-option' }), DataBagsListComponent diff --git a/components/automate-ui/src/app/modules/infra-proxy/environments/environments.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/environments/environments.component.spec.ts index 104b4bf8fa2..023850d274d 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/environments/environments.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/environments/environments.component.spec.ts @@ -30,8 +30,6 @@ describe('EnvironmentsComponent', () => { MockComponent({ selector: 'chef-td' }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), - MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'mat-select' }), MockComponent({ selector: 'mat-option' }), @@ -45,7 +43,6 @@ describe('EnvironmentsComponent', () => { MockComponent({ selector: 'chef-th' }), MockComponent({ selector: 'chef-td' }), MockComponent({ selector: 'a', inputs: ['routerLink'] }), - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), EnvironmentsComponent ], providers: [ diff --git a/components/automate-ui/src/app/modules/infra-proxy/included-policies-details/included-policies-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/included-policies-details/included-policies-details.component.spec.ts index e8f7a2f7568..b5234b41515 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/included-policies-details/included-policies-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/included-policies-details/included-policies-details.component.spec.ts @@ -24,7 +24,6 @@ describe('IncludedPoliciesDetailsComponent', () => { MockComponent({ selector: 'chef-td' }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'mat-select' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/infra-node-details/infra-node-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/infra-node-details/infra-node-details.component.spec.ts index 50711f99a9c..956206bc272 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/infra-node-details/infra-node-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/infra-node-details/infra-node-details.component.spec.ts @@ -53,7 +53,7 @@ describe('InfraNodeDetailsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), + MockComponent({ selector: 'input' }), MockComponent({ selector: 'chef-button', inputs: ['disabled', 'routerLink'] }), MockComponent({ selector: 'mat-select' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/infra-nodes/infra-nodes.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/infra-nodes/infra-nodes.component.spec.ts index e7f511de019..e12973e10fd 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/infra-nodes/infra-nodes.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/infra-nodes/infra-nodes.component.spec.ts @@ -21,7 +21,6 @@ describe('InfraNodesComponent', () => { TestBed.configureTestingModule({ declarations: [ MockComponent({ selector: 'a', inputs: ['routerLink'] }), - MockComponent({ selector: 'chef-heading' }), MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-page-header' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/infra-role-details/infra-role-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/infra-role-details/infra-role-details.component.spec.ts index 1d93ff8263e..8c3015b667e 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/infra-role-details/infra-role-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/infra-role-details/infra-role-details.component.spec.ts @@ -56,7 +56,6 @@ describe('InfraRoleDetailsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), MockComponent({ selector: 'chef-button', inputs: ['disabled', 'routerLink'] }), MockComponent({ selector: 'mat-select' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/infra-roles/infra-roles.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/infra-roles/infra-roles.component.spec.ts index 2036f917447..8d3e2da335a 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/infra-roles/infra-roles.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/infra-roles/infra-roles.component.spec.ts @@ -26,7 +26,6 @@ describe('InfraRolesComponent', () => { MockComponent({ selector: 'app-delete-infra-object-modal', inputs: ['visible', 'objectNoun', 'objectAction', 'custom', 'objectName'], outputs: ['close', 'deleteClicked'] }), - MockComponent({ selector: 'chef-heading' }), MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-page-header' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/org-details/org-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/org-details/org-details.component.spec.ts index dd22e37c7a8..dd14f0e2b0e 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/org-details/org-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/org-details/org-details.component.spec.ts @@ -37,7 +37,6 @@ describe('OrgDetailsComponent', () => { MockComponent({ selector: 'chef-tr' }), MockComponent({ selector: 'chef-th' }), MockComponent({ selector: 'chef-td' }), - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), MockComponent({ selector: 'mat-select' }), MockComponent({ selector: 'mat-option' }), OrgDetailsComponent diff --git a/components/automate-ui/src/app/modules/infra-proxy/org-edit/org-edit.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/org-edit/org-edit.component.spec.ts index 2521cb9a346..a3611c6388f 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/org-edit/org-edit.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/org-edit/org-edit.component.spec.ts @@ -18,7 +18,6 @@ describe('OrgEditComponent', () => { MockComponent({ selector: 'chef-button', inputs: ['disabled'] }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-page-header' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/policy-file-details/policy-file-details.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/policy-file-details/policy-file-details.component.spec.ts index bf74560e1fa..5499e3d3d70 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/policy-file-details/policy-file-details.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/policy-file-details/policy-file-details.component.spec.ts @@ -47,7 +47,6 @@ describe('PolicyFileDetailsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [ - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), MockComponent({ selector: 'chef-button', inputs: ['disabled', 'routerLink'] }), MockComponent({ selector: 'mat-select' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/policy-files/policy-files.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/policy-files/policy-files.component.spec.ts index 5652c43297c..252b2750efd 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/policy-files/policy-files.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/policy-files/policy-files.component.spec.ts @@ -25,7 +25,6 @@ describe('PolicyFilesComponent', () => { MockComponent({ selector: 'chef-td' }), MockComponent({ selector: 'chef-error' }), MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-heading' }), MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'mat-select' }), diff --git a/components/automate-ui/src/app/modules/infra-proxy/reset-admin-key/reset-admin-key.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/reset-admin-key/reset-admin-key.component.spec.ts index 67aed3c0305..0646261988b 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/reset-admin-key/reset-admin-key.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/reset-admin-key/reset-admin-key.component.spec.ts @@ -16,14 +16,12 @@ describe('ResetAdminKeyComponent', () => { declarations: [ MockComponent({ selector: 'a', inputs: ['routerLink'] }), MockComponent({ selector: 'chef-button', inputs: ['disabled'] }), - MockComponent({ selector: 'chef-heading' }), MockComponent({ selector: 'chef-form-field' }), MockComponent({ selector: 'chef-icon' }), MockComponent({ selector: 'chef-loading-spinner' }), MockComponent({ selector: 'chef-page-header' }), MockComponent({ selector: 'chef-subheading' }), MockComponent({ selector: 'chef-toolbar' }), - MockComponent({ selector: 'input', inputs: ['resetOrigin'] }), ResetAdminKeyComponent ], providers: [ diff --git a/components/automate-ui/src/app/modules/infra-proxy/update-web-uikey-slider/update-web-uikey-slider.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/update-web-uikey-slider/update-web-uikey-slider.component.spec.ts deleted file mode 100644 index 308e17d7e15..00000000000 --- a/components/automate-ui/src/app/modules/infra-proxy/update-web-uikey-slider/update-web-uikey-slider.component.spec.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MockComponent } from 'ng2-mock-component'; -import { ReactiveFormsModule, FormBuilder, Validators, FormGroup } from '@angular/forms'; -import { UpdateWebUIKeySliderComponent } from './update-web-uikey-slider.component'; -import { StoreModule, Store } from '@ngrx/store'; -import { NgrxStateAtom, ngrxReducers, runtimeChecks } from 'app/ngrx.reducers'; -import { HttpClient, HttpHandler } from '@angular/common/http'; -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { Regex } from 'app/helpers/auth/regex'; -import { using } from 'app/testing/spec-helpers'; -import { WebUIKey } from 'app/entities/servers/server.model'; -import { UpdateWebUIKeyFailure, UpdateWebUIKeySuccess } from 'app/entities/servers/server.actions'; -import { HttpStatus } from 'app/types/types'; -import { HttpErrorResponse } from '@angular/common/http'; - -describe('UpdateWebUIKeySliderComponent', () => { - let component: UpdateWebUIKeySliderComponent; - let fixture: ComponentFixture; - - let updateKeyForm: FormGroup; - let errors = {}; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ - MockComponent({ selector: 'chef-button', inputs: ['disabled'] }), - MockComponent({ selector: 'chef-error' }), - MockComponent({ selector: 'chef-icon' }), - MockComponent({ selector: 'chef-form-field' }), - MockComponent({ selector: 'chef-loading-spinner' }), - UpdateWebUIKeySliderComponent - ], - imports: [ - ReactiveFormsModule, - StoreModule.forRoot(ngrxReducers, { runtimeChecks }) - ], - providers: [ - HttpClient, - HttpHandler - ], - schemas: [ CUSTOM_ELEMENTS_SCHEMA ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(UpdateWebUIKeySliderComponent); - component = fixture.componentInstance; - component.updateWebuiKeyForm = new FormBuilder().group({ - webuikey: ['', [Validators.required, Validators.pattern(Regex.patterns.NON_BLANK), - Validators.pattern(Regex.patterns.NO_WILDCARD_ALLOW_HYPHEN)]] - }); - updateKeyForm = component.updateWebuiKeyForm; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - describe('form validity', () => { - describe('the form should be invalid', () => { - it('when all inputs are empty', () => { - expect(updateKeyForm.valid).toBeFalsy(); - }); - - it('when webuikey is missing', () => { - - errors = updateKeyForm.controls['webuikey'].errors || {}; - - expect(updateKeyForm.valid).toBeFalsy(); - expect(errors['required']).toBeTruthy(); - }); - }); - - describe('the form should be valid', () => { - it('when all inputs are filled and valid', () => { - expect(updateKeyForm.valid).toBeFalsy(); - updateKeyForm.controls['webuikey'].setValue('WebUIKey'); - expect(updateKeyForm.valid).toBeTruthy(); - }); - - using([ - ['contains numbers range 0-9.', 'WebUIKey123'], - ['contains alphabets a-z', 'WebUIKey-test'], - ['contains underscore.', 'WebUIKey_test'], - ['contains hyphen, minus, or dash.', 'WebUIKey_test-1'], - ['has mixed characters', 'WebUIKey-Test_10'] - ], function (description: string, input: string) { - it(('when the webuikey ' + description), () => { - - updateKeyForm.controls['webuikey'].setValue(input); - errors = updateKeyForm.controls['webuikey'].errors || {}; - - expect(updateKeyForm.valid).toBeTruthy(); - expect(errors['pattern']).toBeFalsy(); - }); - }); - }); - }); - - describe('#webuikey', () => { - let store: Store; - const webuikey: WebUIKey = { - id: 'test_server', - webui_key: 'test_webuikey' - }; - - beforeEach(() => { - store = TestBed.inject(Store); - }); - - it('render the UI Key Slider', () => { - component.slidePanel(); - expect(component.isSlideOpen).toBe(true); - }); - - it('should be invalid when no fields are filled out', () => { - expect(component.updateWebuiKeyForm.valid).toBeFalsy(); - }); - - it('should be valid when all fields are filled out', () => { - component.updateWebuiKeyForm.controls['webuikey'].setValue(webuikey.webui_key); - expect(component.updateWebuiKeyForm.valid).toBeTruthy(); - }); - - it('hide slider after updating webuikey.', () => { - component.updateWebuiKeyForm.controls['webuikey'].setValue(webuikey.webui_key); - component.updateWebUIkey(); - - store.dispatch(new UpdateWebUIKeySuccess(webuikey)); - }); - - it('on create , slider is closed with failure banner', () => { - component.updateWebuiKeyForm.controls['webuikey'].setValue(webuikey.webui_key); - component.updateWebUIkey(); - - const error = { - status: HttpStatus.INTERNAL_SERVER_ERROR, - ok: false - }; - store.dispatch(new UpdateWebUIKeyFailure(error)); - expect(component.conflictError).toBe(false); - }); - }); -}); diff --git a/components/automate-ui/src/app/modules/roles/list/roles-list.component.spec.ts b/components/automate-ui/src/app/modules/roles/list/roles-list.component.spec.ts index 3191ffa3b66..d3a07df9781 100644 --- a/components/automate-ui/src/app/modules/roles/list/roles-list.component.spec.ts +++ b/components/automate-ui/src/app/modules/roles/list/roles-list.component.spec.ts @@ -31,7 +31,6 @@ describe('RolesListComponent', () => { MockComponent({ selector: 'chef-th' }), MockComponent({ selector: 'chef-thead' }), MockComponent({ selector: 'chef-tr' }), - MockComponent({ selector: 'chef-option' }), MockComponent({ selector: 'mat-select' }), MockComponent({ selector: 'mat-option' }), MockComponent({ selector: 'a', inputs: ['routerLink']}), diff --git a/e2e/cypress/integration/api/iam/infra_editor_actions.spec.ts b/e2e/cypress/integration/api/iam/infra_editor_actions.spec.ts index 5a14d806523..26ed6018d14 100644 --- a/e2e/cypress/integration/api/iam/infra_editor_actions.spec.ts +++ b/e2e/cypress/integration/api/iam/infra_editor_actions.spec.ts @@ -161,7 +161,7 @@ describe('Infra Editor Policy', () => { name: 'test2', description: 'cypress testing' }, - url: '/api/v0/infra/servers/local-dev/orgs/test-org/environments', + url: '/api/v0/infra/servers/local-dev/orgs/test-org/environments' }).then((resp) => { assert.equal(resp.status, 200); }); @@ -198,7 +198,7 @@ describe('Infra Editor Policy', () => { assert.equal(resp.status, 403); }); }); - + it('create infra server post returns 403 when infraServers create actions is denied', () => { cy.request({ headers: { 'api-token': withInfraEditorActionToken }, @@ -240,4 +240,4 @@ describe('Infra Editor Policy', () => { assert.equal(resp.status, 403); }); }) -}); \ No newline at end of file +}); diff --git a/e2e/cypress/integration/api/iam/infra_viewer_actions.spec.ts b/e2e/cypress/integration/api/iam/infra_viewer_actions.spec.ts index 85070256b06..8763477d3b8 100644 --- a/e2e/cypress/integration/api/iam/infra_viewer_actions.spec.ts +++ b/e2e/cypress/integration/api/iam/infra_viewer_actions.spec.ts @@ -196,4 +196,4 @@ describe('Infra Viewer Policy', () => { assert.equal(resp.status, 403); }); }); -}); \ No newline at end of file +}); diff --git a/e2e/cypress/integration/ui/infra-proxy/chef-organization-details.spec.ts b/e2e/cypress/integration/ui/infra-proxy/chef-organization-details.spec.ts index 0d969512219..ee0fe32267c 100644 --- a/e2e/cypress/integration/ui/infra-proxy/chef-organization-details.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/chef-organization-details.spec.ts @@ -4,13 +4,21 @@ describe('chef server', () => { const cypressPrefix = 'infra'; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); - const tabNames = ['Roles', 'Environments', 'Data Bags', 'Clients', 'Cookbooks']; + const tabNames = [ + 'Roles', + 'Environments', + 'Data Bags', + 'Clients', + 'Policyfiles', + 'Policy Groups', + 'Cookbooks']; + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); before(() => { cy.adminLogin('/').then(() => { @@ -26,7 +34,8 @@ describe('chef server', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { diff --git a/e2e/cypress/integration/ui/infra-proxy/chef-server-details.spec.ts b/e2e/cypress/integration/ui/infra-proxy/chef-server-details.spec.ts index 5f9f7081ab6..28ffc118c76 100644 --- a/e2e/cypress/integration/ui/infra-proxy/chef-server-details.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/chef-server-details.spec.ts @@ -6,9 +6,9 @@ describe('chef server details', () => { const updatedServerName = `${cypressPrefix} updated server ${now}`; const serverID = serverName.split(' ').join('-'); const customServerID = `${cypressPrefix}-custom-id-${now}`; - const serverFQDN = 'chef-server-1617089723092818000.com'; - const serverIP = '176.119.50.159'; - const webui_key = 'Dummy--webui--key'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); const orgName = `${cypressPrefix} org ${now}`; const generatedOrgID = orgName.split(' ').join('-'); const customOrgID = `${cypressPrefix}-custom-id-${now}`; @@ -31,7 +31,7 @@ describe('chef server details', () => { name: serverName, fqdn: serverFQDN, ip_address: serverIP, - webui_key: webui_key + webui_key: webuiKey } }); @@ -61,7 +61,7 @@ describe('chef server details', () => { it('it can update the webui key', () => { cy.get('[data-cy=update-web-ui-key]').contains('Update').click(); cy.get('app-chef-server-details .sidenav-header').should('exist'); - cy.get('[data-cy=enter-webui-key]').type(webui_key); + cy.get('[data-cy=enter-webui-key]').type(webuiKey); cy.get('[data-cy=update-webui-key-button]').click(); cy.get('app-chef-server-details .sidenav-header').should('not.be.visible'); @@ -78,7 +78,8 @@ describe('chef server details', () => { }); it('can add a organization', () => { - cy.get('[data-cy=add-org-button]').contains('Add Chef Organization').click(); + cy.get('[data-cy=add-org-button]').contains('Add Chef Organization') + .click({multiple: true, force: true}); cy.get('app-chef-server-details chef-modal').should('exist'); cy.get('[data-cy=org-name]').type(orgName); cy.get('[data-cy=id-label]').contains(generatedOrgID); @@ -91,7 +92,7 @@ describe('chef server details', () => { // verify success notification and then dismiss it // so it doesn't get in the way of subsequent interactions cy.get('app-notification.info').should('be.visible'); - cy.get('app-notification.info chef-icon').click(); + cy.get('app-notification.info chef-icon').click({multiple: true, force: true}); cy.get('app-chef-server-details chef-tbody chef-td').contains(orgName).should('exist'); }); @@ -103,7 +104,8 @@ describe('chef server details', () => { }); it('can create a chef organization with a custom ID', () => { - cy.get('[data-cy=add-org-button]').contains('Add Chef Organization').click(); + cy.get('[data-cy=add-org-button]').contains('Add Chef Organization') + .click({multiple: true, force: true}); cy.get('app-chef-server-details chef-modal').should('exist'); cy.get('[data-cy=org-name]').type(orgName); cy.get('[data-cy=add-id]').should('not.be.visible'); @@ -119,7 +121,7 @@ describe('chef server details', () => { // verify success notification and then dismiss it // so it doesn't get in the way of subsequent interactions cy.get('app-notification.info').should('be.visible'); - cy.get('app-notification.info chef-icon').click(); + cy.get('app-notification.info chef-icon').click({multiple: true, force: true}); cy.get('app-chef-server-details chef-tbody chef-td').contains(orgName).should('exist'); }); @@ -159,17 +161,15 @@ describe('chef server details', () => { .find('.mat-select-trigger').as('controlMenu'); // we throw in a `should` so cypress retries until introspection allows menu to be shown - cy.get('@controlMenu').scrollIntoView().should('be.visible') - .click(); - cy.get('[data-cy=delete-org]').should('be.visible') - .click(); + cy.get('@controlMenu').scrollIntoView().should('be.visible').click(); + cy.get('[data-cy=delete-org]').should('be.visible').click(); // accept dialog cy.get('app-chef-server-details chef-button').contains('Delete').click(); // verify success notification and then dismiss it - cy.get('app-notification.info').contains('Successfully deleted org'); - cy.get('app-notification.info chef-icon').click(); + cy.get('app-notification.info').should('be.visible'); + cy.get('app-notification.info chef-icon').click({multiple: true, force: true}); cy.get('app-chef-server-details chef-tbody chef-td') .contains(customOrgID).should('not.exist'); diff --git a/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts b/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts index 307d465dfa2..0bf5b6189b7 100644 --- a/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts @@ -4,8 +4,9 @@ describe('chef server', () => { const serverName = `${cypressPrefix} server ${now}`; const generatedServerID = serverName.split(' ').join('-'); const customServerID = `${cypressPrefix}-custom-id-${now}`; - const serverFQDN = 'chef-server-1617089723092818000.com'; - const serverIP = '176.119.50.159'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); before(() => { cy.adminLogin('/infrastructure/chef-servers').then(() => { @@ -30,7 +31,7 @@ describe('chef server', () => { cy.get('[data-cy=add-name]').type(serverName); cy.get('[data-cy=id-label]').contains(generatedServerID); cy.get('[data-cy=add-fqdn]').type(serverFQDN); - + cy.get('[data-cy=webui_key]').type(webuiKey); cy.get('[data-cy=add-button]').click(); cy.get('[data-cy=chef-infra-server-slider]').should('not.be.visible'); @@ -60,6 +61,7 @@ describe('chef server', () => { cy.get('[data-cy=id-label]').should('not.be.visible'); cy.get('[data-cy=add-id]').should('be.visible').clear().type(customServerID); cy.get('[data-cy=add-fqdn]').type(serverFQDN); + cy.get('[data-cy=webui_key]').type(webuiKey); cy.get('[data-cy=add-button]').click(); cy.get('app-chef-servers-list chef-modal').should('not.be.visible'); @@ -80,6 +82,7 @@ describe('chef server', () => { cy.get('chef-select').contains('FQDN').click(); cy.get('chef-select chef-option').contains('IP Address').click(); cy.get('[data-cy=add-ip-address]').type(serverIP); + cy.get('[data-cy=webui_key]').type(webuiKey); cy.get('[data-cy=add-button]').click(); cy.get('[data-cy=chef-infra-server-slider]').should('not.be.visible'); @@ -101,6 +104,7 @@ describe('chef server', () => { cy.get('[data-cy=id-label]').should('not.be.visible'); cy.get('[data-cy=add-id]').should('be.visible').clear().type(customServerID); cy.get('[data-cy=add-fqdn]').type(serverFQDN); + cy.get('[data-cy=webui_key]').type(webuiKey); cy.get('[data-cy=add-button]').click(); }); diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-databags.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-databags.spec.ts index 91bb1f5cfbb..ab14e6b2dfb 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-databags.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-databags.spec.ts @@ -4,13 +4,14 @@ describe('infra databag', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); const databagName = `${cypressPrefix}-databag-${now}-1`; + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); before(() => { cy.adminLogin('/').then(() => { @@ -26,7 +27,8 @@ describe('infra databag', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-node-details.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-node-details.spec.ts index 2105a5c0eb3..f197ad3b6a0 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-node-details.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-node-details.spec.ts @@ -6,12 +6,13 @@ describe('infra node detail', () => { const environment = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); const nullJson = '{}'; const validJson = '{"test":"test"}'; const invalidJson = '{"invalid "test"'; @@ -30,7 +31,8 @@ describe('infra node detail', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((response) => { if (response.status === 200 && response.body.ok === true) { @@ -251,8 +253,8 @@ describe('infra node detail', () => { if (nodeName !== '') { cy.get('.ng-arrow-wrapper').click(); cy.get('.ng-dropdown-panel-items').should(('be.visible')); - cy.get('.ng-option').contains('google').then(option => { - option[0].click(); // this is jquery click() not cypress click() + cy.get('.ng-option').then(option => { + option[1].click(); // this is jquery click() not cypress click() }); cy.get('[data-cy=change-confirm]').should(('be.visible')); } @@ -275,12 +277,12 @@ describe('infra node detail', () => { if (nodeName !== '') { cy.get('.ng-arrow-wrapper').click(); cy.get('.ng-dropdown-panel-items').should(('be.visible')); - cy.get('.ng-option').contains('chef-environment-609823800').then(option => { - option[0].click(); // this is jquery click() not cypress click() + cy.get('.ng-option').then(option => { + option[1].click(); // this is jquery click() not cypress click() }); cy.get('.ng-arrow-wrapper').click(); cy.get('.ng-dropdown-panel-items').should(('be.visible')); - cy.get('.ng-option').contains('_default').then(option => { + cy.get('.ng-option').then(option => { option[0].click(); // this is jquery click() not cypress click() }); cy.get('[data-cy=change-confirm]').should(('be.visible')); diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-node-list.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-node-list.spec.ts index d9ef03f17dd..46b4ddacf25 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-node-list.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-node-list.spec.ts @@ -4,12 +4,13 @@ describe('infra node list', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); const nodeName = `${cypressPrefix}-node-${now}-1`; const seachableNode = 'chef-load-3'; @@ -27,7 +28,8 @@ describe('infra node list', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-details.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-details.spec.ts index ef985b9cd94..365ce5a5261 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-details.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-details.spec.ts @@ -2,12 +2,13 @@ describe('infra policy details', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); let policyFileName = ''; let revision = ''; let includedPolicyFileName = ''; @@ -29,7 +30,8 @@ describe('infra policy details', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { @@ -227,8 +229,8 @@ describe('infra policy details', () => { it('can open cookbook details page', () => { if (policyFileName !== '') { - cy.get('[data-cy=cookbook-table-container] chef-td a').contains(policyFileName).click(); - cy.get('[data-cy=close-cookbook-detail-button]').click(); + cy.get('[data-cy=cookbook-table-container] chef-td a').eq(1).click(); + cy.get('[data-cy=close-cookbook-detail-button]').click({ multiple: true, force: true }); cy.get('[data-cy=close-cookbook-button]').click(); } }); @@ -262,6 +264,7 @@ describe('infra policy details', () => { .contains(includedPolicyFileName).click(); getPolicyFileDetails(includedPolicyFileName, includedPolicyRevision).then(response => { if (checkIncludedPolicyDetailsResponse(response)) { + cy.wait(1000); cy.get('[data-cy=policyfile-details]').contains('Go to Policyfile Details >').click(); } }); @@ -281,8 +284,9 @@ describe('infra policy details', () => { it('can open runlist details slider', () => { if (policyFileName !== '') { - cy.get('[data-cy=run-list-table-container] chef-td a').contains(policyFileName).click(); - cy.get('[data-cy=close-cookbook-detail-button] chef-icon').click(); + cy.get('[data-cy=run-list-table-container] chef-td a').eq(1).click(); + cy.get('[data-cy=close-cookbook-detail-button] chef-icon') + .click({ multiple: true, force: true }); } }); }); diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-list.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-list.spec.ts index 00801d54a0a..4e121603eb3 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-list.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-policy-file-list.spec.ts @@ -4,12 +4,13 @@ describe('infra policy file', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); let policies: any; const policyFileName = `${cypressPrefix}-policyFile-${now}-1`; @@ -27,7 +28,8 @@ describe('infra policy file', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-policy-group-details.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-policy-group-details.spec.ts index 54af7410740..c2b3f3ff8b7 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-policy-group-details.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-policy-group-details.spec.ts @@ -2,12 +2,13 @@ describe('infra policy group details', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); let policies: any; let policyGroupName = ''; let policyFilesCount: number; @@ -29,7 +30,8 @@ describe('infra policy group details', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-policy-groups-list.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-policy-groups-list.spec.ts index f43ea9cdd4e..315c5b12110 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-policy-groups-list.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-policy-groups-list.spec.ts @@ -4,12 +4,13 @@ describe('infra policy groups', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); const policyGroupName = `${cypressPrefix}-policyGroup-${now}-1`; let policies: any; @@ -27,7 +28,8 @@ describe('infra policy groups', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-role-details.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-role-details.spec.ts index fa3aa2ea1b4..cf6c8ddc813 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-role-details.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-role-details.spec.ts @@ -4,12 +4,13 @@ describe('infra role detail', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); const roleName = `${cypressPrefix}-role-${now}`; const roleDescription = 'role description'; const defaultAttribute = {default: 'test'}; @@ -36,7 +37,8 @@ describe('infra role detail', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((response) => { if (response.status === 200 && response.body.ok === true) { @@ -316,10 +318,8 @@ describe('infra role detail', () => { it('can select multiple item from list, move to right then update the run list', () => { cy.get('[data-cy=edit-runlist]').contains('Edit').click(); cy.get('app-infra-role-details chef-modal').should('exist'); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]') - .contains('audit::inspec').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]') - .contains('chef-client').click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(2).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=update-run-list]').click(); @@ -374,8 +374,8 @@ describe('infra role detail', () => { () => { cy.get('[data-cy=edit-runlist]').contains('Edit').click(); cy.get('app-infra-role-details chef-modal').should('exist'); - cy.get('.vertical [data-cy=updated-run-list]').contains('audit').click(); - cy.get('.vertical [data-cy=updated-run-list]').contains('chef-client').click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(0).click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(1).click(); cy.get('[data-cy=drag-left]').click(); cy.get('[data-cy=update-run-list]').click(); @@ -402,8 +402,7 @@ describe('infra role detail', () => { it('can select a item from selected run list, move item up then update the run list', () => { cy.get('[data-cy=edit-runlist]').contains('Edit').click(); cy.get('app-infra-role-details chef-modal').should('exist'); - cy.get('.vertical [data-cy=updated-run-list]').contains('aix::nim_master_setup_standalone') - .click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(1).click(); cy.get('[data-cy=drag-up]').click(); cy.get('[data-cy=update-run-list]').click(); @@ -433,9 +432,8 @@ describe('infra role detail', () => { () => { cy.get('[data-cy=edit-runlist]').contains('Edit').click(); cy.get('app-infra-role-details chef-modal').should('exist'); - cy.get('.vertical [data-cy=updated-run-list]').contains('audit').click(); - cy.get('.vertical [data-cy=updated-run-list]').contains('aix::nim_master_setup_standalone') - .click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(1).click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(2).click(); cy.wait(2000); cy.get('[data-cy=drag-up]').click(); cy.get('[data-cy=update-run-list]').click(); @@ -479,7 +477,7 @@ describe('infra role detail', () => { xit('can select a item from selected run list, move item down then update the run list', () => { cy.get('[data-cy=edit-runlist]').contains('Edit').click(); cy.get('app-infra-role-details chef-modal').should('exist'); - cy.get('.vertical [data-cy=updated-run-list]').contains('centos-cookbook-file').click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(1).click(); cy.get('[data-cy=drag-down]').click(); cy.get('[data-cy=update-run-list]').click(); @@ -509,10 +507,9 @@ describe('infra role detail', () => { () => { cy.get('[data-cy=edit-runlist]').contains('Edit').click(); cy.get('app-infra-role-details chef-modal').should('exist'); - cy.get('.vertical [data-cy=updated-run-list]').contains('aix::nim_master_setup_standalone') - .click(); - cy.get('.vertical [data-cy=updated-run-list]').contains('centos-cookbook-file').click(); - cy.get('.vertical [data-cy=updated-run-list]').contains('cron').click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(1).click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(2).click(); + cy.get('.vertical [data-cy=updated-run-list]').eq(3).click(); cy.get('[data-cy=drag-down]').click(); cy.get('[data-cy=update-run-list]').click(); diff --git a/e2e/cypress/integration/ui/infra-proxy/infra-roles.spec.ts b/e2e/cypress/integration/ui/infra-proxy/infra-roles.spec.ts index 5d0ba2bce5c..e370f5a9950 100644 --- a/e2e/cypress/integration/ui/infra-proxy/infra-roles.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/infra-roles.spec.ts @@ -4,12 +4,13 @@ describe('infra role', () => { let adminIdToken = ''; const serverID = 'chef-manage'; const serverName = 'chef manage'; - const orgID = 'viveksingh_msys'; - const orgName = 'viveksingh_msys'; - const serverFQDN = 'api.chef.io'; - const serverIP = '50.21.221.24'; - const adminUser = 'viveksingh_msys'; + const orgID = 'demoorg'; + const orgName = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; + const adminUser = 'kallol'; const adminKey = Cypress.env('AUTOMATE_INFRA_ADMIN_KEY').replace(/\\n/g, '\n'); + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); const roleName = `${cypressPrefix}-role-${now}-1`; const roleDescription = 'role description'; const roleRunlistName = `${cypressPrefix}-role-${now}-2`; @@ -32,7 +33,8 @@ describe('infra role', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }).then((resp) => { if (resp.status === 200 && resp.body.ok === true) { @@ -255,8 +257,7 @@ describe('infra role', () => { cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('aix') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); // here we exit with the Cancel button cy.get('[data-cy=cancel-run-list-button]').contains('Cancel').should('be.visible') @@ -296,8 +297,7 @@ describe('infra role', () => { cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('audit') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); @@ -320,8 +320,7 @@ describe('infra role', () => { cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('aix') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); @@ -338,8 +337,7 @@ describe('infra role', () => { cy.get('[data-cy=role-name]').type(roleDefaultAttrName); cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('aix') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); @@ -367,8 +365,7 @@ describe('infra role', () => { cy.get('[data-cy=role-name]').type(roleDefaultAttrName); cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('aix') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); @@ -398,8 +395,7 @@ describe('infra role', () => { cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('audit') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(2).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); @@ -426,8 +422,7 @@ describe('infra role', () => { cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('aix') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); @@ -449,8 +444,7 @@ describe('infra role', () => { cy.get('[data-cy=role-name]').type(roleOverrideAttrName); cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('aix') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); @@ -482,8 +476,7 @@ describe('infra role', () => { cy.get('[data-cy=role-name]').type(roleOverrideAttrName); cy.get('[data-cy=role-description]').type(roleDescription); cy.get('[data-cy=navbar]').contains('Run List').click(); - cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').contains('aix') - .click(); + cy.get('.cdk-virtual-scroll-content-wrapper [data-cy=select-run-list]').eq(1).click(); cy.get('[data-cy=drag-right]').click(); cy.get('[data-cy=navbar]').contains('Default Attributes').click(); diff --git a/e2e/cypress/integration/ui/infra-proxy/update-web-uikey-slider.spec.ts b/e2e/cypress/integration/ui/infra-proxy/update-web-uikey-slider.spec.ts index 16f6ab6b27e..f0f6d4f816f 100644 --- a/e2e/cypress/integration/ui/infra-proxy/update-web-uikey-slider.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/update-web-uikey-slider.spec.ts @@ -6,12 +6,14 @@ describe('chef server details', () => { const updatedServerName = `${cypressPrefix} updated server ${now}`; const serverID = serverName.split(' ').join('-'); const customServerID = `${cypressPrefix}-custom-id-${now}`; - const serverFQDN = 'chef-server-1617089723092818000.com'; - const serverIP = '176.119.50.159'; + const orgID = 'demoorg'; + const serverFQDN = 'https://ec2-18-117-112-129.us-east-2.compute.amazonaws.com'; + const serverIP = '18-117-112-129'; const orgName = `${cypressPrefix} org ${now}`; const generatedOrgID = orgName.split(' ').join('-'); const customOrgID = `${cypressPrefix}-custom-id-${now}`; const adminUser = 'test_admin_user'; + const webuiKey = Cypress.env('AUTOMATE_INFRA_WEBUI_KEY').replace(/\\n/g, '\n'); // using dummy admin key value for creating the org const adminKey = 'Dummy--admin--key'; @@ -29,7 +31,8 @@ describe('chef server details', () => { id: serverID, name: serverName, fqdn: serverFQDN, - ip_address: serverIP + ip_address: serverIP, + webui_key: webuiKey } }); @@ -65,10 +68,10 @@ describe('chef server details', () => { it('check if Upload button is disabled before entering input', () => { cy.get('[data-cy=open-WebKey-slider]').contains('Update').click(); cy.get('[data-cy=title]').contains('Update Web UI Key'); - cy.get('[data-cy=Upload]') + cy.get('[data-cy=update-webui-key-button]') .invoke('attr', 'disabled') .then(disabled => { - disabled ? cy.log('buttonIsDiabled') : cy.get('[data-cy=Upload]').click(); + disabled ? cy.log('buttonIsDiabled') : cy.get('[data-cy=update-webui-key-button]').click(); }); cy.get('[data-cy=cancel]').click(); }); @@ -76,8 +79,8 @@ describe('chef server details', () => { it('Upload Web UI Key', () => { cy.get('[data-cy=open-WebKey-slider]').contains('Update').click(); cy.get('[data-cy=title]').contains('Update Web UI Key'); - cy.get('[data-cy=enter-key]').clear().type('testing'); - cy.get('[data-cy=Upload').click(); + cy.get('[data-cy=enter-webui-key]').clear().type('testing'); + cy.get('[data-cy=update-webui-key-button').click(); }); }); }); diff --git a/integration/run_test b/integration/run_test index 9941282e8c8..3a77fb14d20 100755 --- a/integration/run_test +++ b/integration/run_test @@ -102,6 +102,7 @@ docker_run_args=( "--env" "CYPRESS_AUTOMATE_ACCEPTANCE_TARGET_USER" "--env" "CYPRESS_AUTOMATE_ACCEPTANCE_TARGET_KEY" "--env" "CYPRESS_AUTOMATE_INFRA_ADMIN_KEY" + "--env" "CYPRESS_AUTOMATE_INFRA_WEBUI_KEY" "--env" "AWS_ACCESS_KEY_ID" "--env" "AWS_SECRET_ACCESS_KEY" "--env" "AWS_SESSION_TOKEN" diff --git a/scripts/get_secrets.sh b/scripts/get_secrets.sh index 144bb9fc535..72e029904c7 100755 --- a/scripts/get_secrets.sh +++ b/scripts/get_secrets.sh @@ -67,6 +67,7 @@ target_host=$(vault kv get -field=data secret/a2/testing/target_host) target_user=$(vault kv get -field=data secret/a2/testing/target_user) target_key=$(vault kv get -field=data secret/a2/testing/target_key) infra_admin_key=$(vault kv get -field=data secret/a2/testing/infra_admin_key) +infra_webui_key=$(vault kv get -field=data secret/a2/testing/infra_webui_key) cat >dev/secrets-env.sh <