-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e test for resource search and namespace filter issue (#10932)
* Add e2e test for resource search and namespace filter issue * Fix lint issues
- Loading branch information
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import ComponentPo from '@/cypress/e2e/po/components/component.po'; | ||
|
||
const CMD_K_KEY = { | ||
key: 'k', | ||
keyCode: 75, | ||
which: 75, | ||
code: 'KeyK', | ||
location: 0, | ||
altKey: false, | ||
ctrlKey: false, | ||
metaKey: true, | ||
shiftKey: false, | ||
repeat: false | ||
}; | ||
|
||
export default class ResourceSearchDialog extends ComponentPo { | ||
constructor() { | ||
super('[data-modal="searchModal"]'); | ||
} | ||
|
||
open() { | ||
cy.keyboardControls(CMD_K_KEY, 1); | ||
} | ||
|
||
close() { | ||
cy.get('body').click(10, 10); // Click outside of the search modal | ||
} | ||
|
||
searchBox() { | ||
return this.self().get('input.search'); | ||
} | ||
|
||
results() { | ||
return this.self().get('.results li.child .label'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import HomePagePo from '@/cypress/e2e/po/pages/home.po'; | ||
import ClusterDashboardPagePo from '@/cypress/e2e/po/pages/explorer/cluster-dashboard.po'; | ||
import ResourceSearchDialog from '@/cypress/e2e/po/dialog/ResourceSearchDialog.po'; | ||
import { NamespaceFilterPo } from '@/cypress/e2e/po/components/namespace-filter.po'; | ||
import { ConfigMapPagePo } from '@/cypress/e2e/po/pages/explorer/config-map.po'; | ||
|
||
const clusterDashboard = new ClusterDashboardPagePo('local'); | ||
|
||
describe('Cluster Dashboard', { testIsolation: 'off', tags: ['@explorer', '@adminUser', '@standardUser'] }, () => { | ||
before(() => { | ||
cy.login(); | ||
HomePagePo.goTo(); | ||
|
||
ClusterDashboardPagePo.navTo(); | ||
}); | ||
|
||
it('can show resource search dialog', () => { | ||
// Open the resource search | ||
clusterDashboard.resourceSearchButton().click(); | ||
|
||
const dialog = new ResourceSearchDialog(); | ||
|
||
dialog.checkExists(); | ||
dialog.checkVisible(); | ||
|
||
dialog.searchBox().type('ConfigMap'); | ||
|
||
dialog.results().should('have.length', 1); | ||
dialog.results().first().should('have.text', 'ConfigMaps'); | ||
|
||
dialog.close(); | ||
|
||
dialog.checkNotExists(); | ||
}); | ||
|
||
it('can show resource dialog when namespace chooser is open', () => { | ||
const namespacePicker = new NamespaceFilterPo(); | ||
|
||
namespacePicker.toggle(); | ||
namespacePicker.clickOptionByLabel('Only User Namespaces'); | ||
namespacePicker.isChecked('Only User Namespaces'); | ||
|
||
// Namespace filter is still open | ||
const dialog = new ResourceSearchDialog(); | ||
|
||
// Open the resource search | ||
dialog.open(); | ||
|
||
dialog.checkExists(); | ||
dialog.checkVisible(); | ||
|
||
dialog.searchBox().type('ConfigMap'); | ||
|
||
dialog.results().should('have.length', 1); | ||
dialog.results().first().should('have.text', 'ConfigMaps'); | ||
|
||
dialog.results().first().click(); | ||
|
||
const configMapPage = new ConfigMapPagePo('local'); | ||
|
||
configMapPage.waitForPage(); | ||
|
||
dialog.checkNotExists(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters