Skip to content

Commit

Permalink
chore: update HeaderBar tests
Browse files Browse the repository at this point in the history
- update data-test ids and classes used to retrieve components
- update test titles/scenarios to account for apps, shortcuts and commands
  • Loading branch information
d-rita committed Oct 25, 2024
1 parent 83243dd commit 0579262
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 14 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Feature: The HeaderBar contains a menu to all apps
Feature: The HeaderBar contains a menu to all apps, shortcuts, and commands

Scenario: The HeaderBar contains a menu icon
Given the HeaderBar loads without an error
Then the HeaderBar displays a menu icon

Scenario: The menu is closed by default
Given the HeaderBar loads without an error
Then the HeaderBar dos not display the app menu
Then the HeaderBar does not display the command palette

Scenario: The user will be offered a menu with apps
Scenario: The user will be offered a menu with apps, shortcuts and commands
Given the HeaderBar loads without an error
When the user clicks on the menu icons
Then the menu opens
Expand All @@ -18,4 +18,4 @@ Feature: The HeaderBar contains a menu to all apps
Given the HeaderBar loads without an error
When the user opens the menu
And the user clicks outside of the menu
Then the HeaderBar dos not display the app menu
Then the HeaderBar does not display the command palette
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Then } from '@badeball/cypress-cucumber-preprocessor'

Then('the HeaderBar does not display the command palette', () => {
cy.get('[data-test="headerbar-menu"]').should('not.exist')
})
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ When('the user opens the menu', () => {
})

When('the user clicks outside of the menu', () => {
cy.get('[data-test="headerbar-title"]').click()
cy.get('.backdrop').click({ force: true })
})
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ When('the user clicks on the menu icons', () => {
})

Then('the menu opens', () => {
cy.get('[data-test="headerbar-apps-menu"]').should('be.visible')
cy.get('[data-test="headerbar-menu"]').should('be.visible')
})

Then('contains items with links', () => {
cy.get('[data-test="headerbar-apps-menu-list"]')
cy.get('[data-test="headerbar-top-apps-list"]')
.find('a')
.its('length')
.should('be.greaterThan', 0)

cy.get('[data-test="headerbar-actions-menu"]').should('exist')
})
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Given(/no app name contains a (.*)/, (character) => {
})

Then('no results should be shown', () => {
cy.get('[data-test="headerbar-apps-menu-list"] > a > div').should(
cy.get('[data-test="headerbar-list"] > a > .text-content .title').should(
'not.exist'
)
cy.get('[data-test="headerbar-empty-search"]').should('exist')
})
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Given(/some app names contain a (.*)/, (character) => {
})

Then(/only apps with (.*) in their name should be shown/, (character) => {
cy.get('[data-test="headerbar-apps-menu-list"] > a > div').should(
cy.get('[data-test="headerbar-list"] > a .text-content .title').should(
($modules) => {
$modules.each((index, module) => {
const displayName = Cypress.$(module).text()
Expand Down

0 comments on commit 0579262

Please sign in to comment.