From 2d04c822711f72b4d4f71b18d5c7c23848e156a3 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Thu, 19 Sep 2024 08:35:05 -0700 Subject: [PATCH] Add e2e tests for Namespace Filter selection Signed-off-by: Phillip Rak --- cypress/e2e/po/components/namespace-filter.po.ts | 2 +- .../tests/pages/explorer2/namespace-picker.spec.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/po/components/namespace-filter.po.ts b/cypress/e2e/po/components/namespace-filter.po.ts index 4747326ffa6..154129d3b2f 100644 --- a/cypress/e2e/po/components/namespace-filter.po.ts +++ b/cypress/e2e/po/components/namespace-filter.po.ts @@ -30,7 +30,7 @@ export class NamespaceFilterPo extends ComponentPo { } searchByName(label: string) { - return this.self().find('.ns-controls > .ns-input').clear().type(label); + return this.self().find('.ns-controls > .ns-input > .ns-filter-input').clear().type(label); } clearSearchFilter() { diff --git a/cypress/e2e/tests/pages/explorer2/namespace-picker.spec.ts b/cypress/e2e/tests/pages/explorer2/namespace-picker.spec.ts index df30dfee8ff..815140b2c2b 100644 --- a/cypress/e2e/tests/pages/explorer2/namespace-picker.spec.ts +++ b/cypress/e2e/tests/pages/explorer2/namespace-picker.spec.ts @@ -154,6 +154,18 @@ describe('Namespace picker', { testIsolation: 'off' }, () => { namespacePicker.checkIcon().should('have.length', 1); }); + it('can filter after making a selection', { tags: ['@explorer2', '@adminUser', '@standardUser'] }, () => { + namespacePicker.toggle(); + + // Select 'Project: Default' + namespacePicker.clickOptionByLabel('Project: Default'); + namespacePicker.isChecked('Project: Default'); + namespacePicker.checkIcon().should('have.length', 1); + + namespacePicker.searchByName('cattle-logging-system'); + namespacePicker.getOptions().find('.ns-option').should('have.length.gte', 1); + }); + it('can filter options by name', { tags: ['@explorer2', '@adminUser', '@standardUser'] }, () => { namespacePicker.toggle();