Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
fix(bridge): Navigating to service from stage-details (#8399)
Browse files Browse the repository at this point in the history
* fix(bridge): Navigating to service from stage-details

Signed-off-by: TannerGilbert <gilberttanner.work@gmail.com>

* Removed cypress only calls.

Signed-off-by: TannerGilbert <gilberttanner.work@gmail.com>

* Added alias for mongodb-datastore

Signed-off-by: TannerGilbert <gilberttanner.work@gmail.com>

* Removed only method call in environment.spec.ts

Signed-off-by: TannerGilbert <gilberttanner.work@gmail.com>
  • Loading branch information
TannerGilbert committed Jul 12, 2022
1 parent b2afdf9 commit e0ce5bd
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,16 @@ export class KtbStageDetailsComponent implements OnInit, OnDestroy {
}

getServiceLink(service: Service): string[] {
return ['service', service.serviceName, 'context', service.deploymentContext ?? '', 'stage', service.stage];
return [
'/project',
this.project?.projectName ?? '',
'service',
service.serviceName,
'context',
service.deploymentContext ?? '',
'stage',
service.stage,
];
}

public filterServices(services: Service[], type: ServiceFilterType): Service[] {
Expand Down
2 changes: 1 addition & 1 deletion bridge/cypress/fixtures/project.mock.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@
"lastEventTypes": {
"sh.keptn.event.deployment.finished": {
"eventId": "717a6fb0-8e8d-46ad-909c-6d219bd8e7f3",
"keptnContext": "6e3c1cd1-dd29-4fcd-bca6-291ed5d3b2db",
"keptnContext": "da740469-9920-4e0c-b304-0fd4b18d17c2",
"time": "1632413574151690370"
},
"sh.keptn.event.deployment.started": {
Expand Down
29 changes: 29 additions & 0 deletions bridge/cypress/integration/environment.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import EnvironmentPage from '../support/pageobjects/EnvironmentPage';
import { ServicesSettingsPage } from '../support/pageobjects/ServicesSettingsPage';
import ServicesPage from '../support/pageobjects/ServicesPage';

describe('Environment Screen empty', () => {
const environmentPage = new EnvironmentPage();
Expand Down Expand Up @@ -66,6 +67,34 @@ describe('Environment Screen default requests', () => {
});
});

describe('Environment Screen Navigation', () => {
const environmentPage = new EnvironmentPage();
const servicesPage = new ServicesPage();
const project = 'sockshop';
const stage = 'production';
const service = 'carts';
const keptnContext = 'da740469-9920-4e0c-b304-0fd4b18d17c2';

beforeEach(() => {
environmentPage.intercept();
servicesPage.intercept();

environmentPage.visit(project);
});

it('navigate to service if clicking on service from stage-overview', () => {
environmentPage.clickServiceFromStageOverview(stage, service);
cy.wait('@serviceDatastore');
servicesPage.assertDeploymentDeepLink(project, service, keptnContext, stage);
});

it('navigate to service if clicking on service from stage-details', () => {
environmentPage.clickServiceFromStageDetails(stage, service);
cy.wait('@serviceDatastore');
servicesPage.assertDeploymentDeepLink(project, service, keptnContext, stage);
});
});

describe('Environment Screen dynamic requests', () => {
const environmentPage = new EnvironmentPage();
const project = 'sockshop';
Expand Down
2 changes: 1 addition & 1 deletion bridge/cypress/support/intercept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function interceptServicesPage(): void {
cy.intercept('GET', 'api/mongodb-datastore/event/type/sh.keptn.event.evaluation.finished?*', {
statusCode: 200,
fixture: 'get.sockshop.service.carts.evaluations.mock.json',
});
}).as('serviceDatastore');
}

export function interceptServicesPageWithLoadingSequences(): void {
Expand Down
16 changes: 16 additions & 0 deletions bridge/cypress/support/pageobjects/EnvironmentPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ class EnvironmentPage {
return this;
}

public clickServiceFromStageOverview(stage: string, service: string): this {
cy.get('ktb-selectable-tile h2')
.contains(stage)
.parentsUntil('ktb-selectable-tile')
.find('ktb-services-list')
.contains(service)
.click();
return this;
}

public clickServiceFromStageDetails(stage: string, service: string): this {
this.selectStage(stage);
cy.get('ktb-expandable-tile dt-info-group a').contains(service).click();
return this;
}

public assertEvaluationHistoryLoadingCount(service: string, count: number): this {
this.getServiceDetailsContainer(service)
.find('ktb-evaluation-info dt-tag-list[aria-label="evaluation-history"] dt-tag ktb-loading-spinner')
Expand Down

0 comments on commit e0ce5bd

Please sign in to comment.