Skip to content

Commit

Permalink
fix header dropdown visibility
Browse files Browse the repository at this point in the history
language - always
docs - not on login screen
user - logged in, not anonymous
login - not logged in, or anonymous
  • Loading branch information
himdel committed Oct 9, 2023
1 parent b8854c6 commit b8a37a1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
30 changes: 16 additions & 14 deletions src/loaders/standalone/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,25 @@ export const StandaloneLayout = ({
headerTools={
<PageHeaderTools>
<LanguageSwitcher />
{user ? (
<StatefulDropdown
ariaLabel={t`Docs dropdown`}
data-cy='docs-dropdown'
defaultText={<QuestionCircleIcon />}
items={docsDropdownItems}
toggleType='icon'
/>
) : null}
{!user || user.is_anonymous ? (
<LoginLink next={location.pathname} />
) : (
<div>
<StatefulDropdown
ariaLabel={'docs-dropdown'}
defaultText={<QuestionCircleIcon />}
items={docsDropdownItems}
toggleType='icon'
/>
<StatefulDropdown
ariaLabel={'user-dropdown'}
defaultText={userName}
items={userDropdownItems}
toggleType='dropdown'
/>
</div>
<StatefulDropdown
ariaLabel={t`User dropdown`}
data-cy='user-dropdown'
defaultText={userName}
items={userDropdownItems}
toggleType='dropdown'
/>
)}
</PageHeaderTools>
}
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/groups_and_users/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const manualLogin = (username, password) => {
const manualLogout = () => {
cy.intercept('GET', `${apiPrefix}_ui/v1/feature-flags/`).as('feature-flags');

cy.get('[aria-label="user-dropdown"] button').click();
cy.get('[data-cy="user-dropdown"] button').click();
cy.get('[aria-label="logout"]').click();

cy.wait('@feature-flags');
Expand Down
4 changes: 2 additions & 2 deletions test/cypress/e2e/misc/docs_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Documentation dropdown', () => {
});

it('user can open docs dropdown menu', () => {
cy.get('[aria-label="docs-dropdown"]').click();
cy.get('[data-cy="docs-dropdown"]').click();

cy.get('.pf-c-dropdown__menu')
.contains('Customer Support')
Expand All @@ -23,7 +23,7 @@ describe('Documentation dropdown', () => {
});

it('user can toggle about modal', () => {
cy.get('[aria-label="docs-dropdown"]').click();
cy.get('[data-cy="docs-dropdown"]').click();
cy.get('.pf-c-dropdown__menu').contains('About').click();
cy.get('.pf-c-about-modal-box').should('be.visible');
cy.get('h1').contains('Galaxy NG');
Expand Down
8 changes: 4 additions & 4 deletions test/cypress/e2e/misc/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('My Profile Tests', () => {
beforeEach(() => {
cy.login();
// open the dropdown labeled with the username and then...
cy.get('[aria-label="user-dropdown"] button').click();
cy.get('[data-cy="user-dropdown"] button').click();
// a little hacky, but basically
// just click the one link that says 'My profile'.
cy.get('a').contains('My profile').click();
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('My Profile Tests', () => {
it('user cannot set superusers rights', () => {
cy.login(username, password);

cy.get('[aria-label="user-dropdown"] button').click();
cy.get('[data-cy="user-dropdown"] button').click();
cy.get('a').contains('My profile').click();

cy.get('.pf-c-switch__input').should('be.disabled');
Expand All @@ -53,7 +53,7 @@ describe('My Profile Tests', () => {
it('email must be email', () => {
cy.login(username, password);

cy.get('[aria-label="user-dropdown"] button').click();
cy.get('[data-cy="user-dropdown"] button').click();
cy.get('a').contains('My profile').click();
cy.get('button:contains("Edit")').click();

Expand All @@ -71,7 +71,7 @@ describe('My Profile Tests', () => {
it('password validations', () => {
cy.login(username, password);

cy.get('[aria-label="user-dropdown"] button').click();
cy.get('[data-cy="user-dropdown"] button').click();
cy.get('a').contains('My profile').click();
cy.get('button:contains("Edit")').click();

Expand Down

0 comments on commit b8a37a1

Please sign in to comment.