-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
frontend/src/__tests__/cypress/cypress/e2e/appLauncher/AppLauncher.cy.ts
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,22 @@ | ||
import { mockDashboardConfig, mockDscStatus, mockStatus } from '~/__mocks__'; | ||
import { mockComponents } from '~/__mocks__/mockComponents'; | ||
import { applicationLauncher } from '~/__tests__/cypress/cypress/pages/appLauncher'; | ||
|
||
describe('App launcher', () => { | ||
beforeEach(() => { | ||
cy.intercept('/api/dsc/status', mockDscStatus({})); | ||
cy.intercept('/api/status', mockStatus()); | ||
cy.intercept('/api/config', mockDashboardConfig({})); | ||
cy.intercept('/api/components', mockComponents()); | ||
applicationLauncher.visit(); | ||
}); | ||
it('Validate clicking on App Launcher opens menu', () => { | ||
applicationLauncher.visit(); | ||
applicationLauncher.toggleAppLauncherButton(); | ||
const applicationLauncherMenuGroup = applicationLauncher.getApplicationLauncherMenuGroup( | ||
'Open Data Hub Applications', | ||
); | ||
applicationLauncherMenuGroup.shouldHaveApplicationLauncherItem('OpenShift Cluster Manager'); | ||
applicationLauncher.toggleAppLauncherButton(); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
frontend/src/__tests__/cypress/cypress/pages/appLauncher.ts
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,34 @@ | ||
import { Contextual } from './components/Contextual'; | ||
|
||
class ApplicationLauncherMenuGroup extends Contextual<HTMLElement> { | ||
shouldHaveApplicationLauncherItem(name: string) { | ||
this.find().findAllByTestId('application-launcher-item').contains(name).should('exist'); | ||
return this; | ||
} | ||
} | ||
|
||
class ApplicationLauncher { | ||
visit() { | ||
cy.visit('/explore'); | ||
this.wait(); | ||
} | ||
|
||
private wait() { | ||
cy.findByTestId('explore-applications').should('be.visible'); | ||
cy.testA11y(); | ||
} | ||
|
||
toggleAppLauncherButton() { | ||
cy.findByTestId('application-launcher') | ||
.findByRole('button', { name: 'Application launcher' }) | ||
.click(); | ||
} | ||
|
||
getApplicationLauncherMenuGroup(name: string) { | ||
return new ApplicationLauncherMenuGroup(() => | ||
cy.findAllByTestId('application-launcher-group').contains(name).parents(), | ||
); | ||
} | ||
} | ||
|
||
export const applicationLauncher = new ApplicationLauncher(); |
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