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

Commit

Permalink
fix(bridge): Fix missing sequence menu icon selection (#8308)
Browse files Browse the repository at this point in the history
fix(bridge): Fix missing menu icon selection

Signed-off-by: Klaus Strießnig <k.striessnig@gmail.com>
  • Loading branch information
Kirdock committed Jul 5, 2022
1 parent 999d2de commit d841387
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
Expand Up @@ -416,9 +416,12 @@ export class KtbSequenceViewComponent implements OnDestroy {
}

public loadSequenceFilters(projectName: string): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: this.apiService.getSequenceFilters(projectName),
const queryParams = this.apiService.getSequenceFilters(projectName);
if (!Object.keys(queryParams).length) {
return;
}
this.router.navigate(['project', projectName, 'sequence'], {
queryParams,
replaceUrl: true,
});
}
Expand Down
7 changes: 7 additions & 0 deletions bridge/cypress/integration/sequences.spec.ts
@@ -1,6 +1,7 @@
import { SequencesPage } from '../support/pageobjects/SequencesPage';
import { interceptProjectBoard } from '../support/intercept';
import EnvironmentPage from '../support/pageobjects/EnvironmentPage';
import { ProjectBoardPage } from '../support/pageobjects/ProjectBoardPage';

describe('Sequences', () => {
const sequencePage = new SequencesPage();
Expand Down Expand Up @@ -127,6 +128,12 @@ describe('Sequences', () => {
sequencePage.assertSequenceCount(1).assertLoadOlderSequencesButtonExists(false);
});

it('should have active menu button if navigated from one sub page to this one', () => {
const projectBoardPage = new ProjectBoardPage();
environmentPage.intercept().visit('sockshop');
projectBoardPage.clickSequenceMenuitem().assertOnlySequencesViewSelected();
});

describe('filtering', () => {
it('should show a filtered list if filters are applied for Service', () => {
sequencePage.visit('sockshop');
Expand Down
17 changes: 13 additions & 4 deletions bridge/cypress/support/pageobjects/ProjectBoardPage.ts
Expand Up @@ -5,10 +5,10 @@ import ServicesPage from './ServicesPage';
import { interceptProjectBoard } from '../intercept';

enum View {
SERVICE_VIEW = 'service-view',
ENVIRONMENT_VIEW = 'environment-view',
SEQUENCE_VIEW = 'sequence-view',
SETTINGS_VIEW = 'settings-view',
SERVICE_VIEW = 'services',
ENVIRONMENT_VIEW = 'environment',
SEQUENCE_VIEW = 'sequences',
SETTINGS_VIEW = 'settings',
}

export class ProjectBoardPage {
Expand Down Expand Up @@ -103,6 +103,15 @@ export class ProjectBoardPage {
.assertSettingsViewSelected(view === View.SETTINGS_VIEW);
}

public clickSequenceMenuitem(): this {
return this.clickMenuItem(View.SEQUENCE_VIEW);
}

private clickMenuItem(view: View): this {
cy.byTestId(`ktb-${view}-menu-button`).click();
return this;
}

private assertMenuSelected(selector: string, status: boolean): this {
cy.byTestId(selector).should(status ? 'have.class' : 'not.have.class', 'active');
return this;
Expand Down

0 comments on commit d841387

Please sign in to comment.