Skip to content

Commit

Permalink
chore: add test for dahboard details failing to load
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Dec 11, 2024
1 parent b7d1abb commit 56b3b76
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cypress/e2e/view_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Feature: Errors while in view mode
When I open the "Delivery" dashboard
Then the "Delivery" dashboard displays in view mode

@nonmutating
Scenario: I navigate to a dashboard that fails to load
Given I type a dashboard id in the browser url that fails to load
Then a warning message is displayed stating that the dashboard could not be loaded

# @nonmutating
# Scenario: I navigate to print dashboard that doesn't exist
# Given I type an invalid print dashboard id in the browser url
Expand Down
23 changes: 23 additions & 0 deletions cypress/e2e/view_errors/error_while_fetching_dashboard_details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { When, Then } from '@badeball/cypress-cucumber-preprocessor'

When('I type a dashboard id in the browser url that fails to load', () => {
console.log('TEST RUNS')

cy.intercept('**/dashboards/iMnYyBfSxmM**', {
statusCode: 500,
body: 'Oopsie!',
}).as('failure')

cy.visit('#/iMnYyBfSxmM')
cy.wait('@failure')
})

Then(
'a warning message is displayed stating that the dashboard could not be loaded',
() => {
cy.contains('Load dashboard failed').should('exist')
cy.contains(
'This dashboard could not be loaded. Please try again later.'
).should('exist')
}
)

0 comments on commit 56b3b76

Please sign in to comment.