@@ -3,6 +3,7 @@ import { expect } from "vitest";
33import * as precondition from "../../preconditions" ;
44import { customChecksFailedRowsList , customChecksListElement , customChecksMessageElement , customChecksFailedReasonList , customChecksListPaginationElement , customChecksReportedDateList } from "./questions/failedCustomChecks" ;
55import { waitFor } from "@testing-library/vue" ;
6+ import { updateCustomCheckItem } from "../../preconditions" ;
67
78describe ( "FEATURE: Failing custom checks" , ( ) => {
89 describe ( "RULE: Failed custom checks should be displayed" , ( ) => {
@@ -71,7 +72,6 @@ describe("FEATURE: Failing custom checks", () => {
7172 await waitFor ( async ( ) => {
7273 expect ( await customChecksListElement ( ) ) . toBeInTheDocument ( ) ; //failed list is visisble
7374 } ) ;
74- expect ( customChecksListPaginationElement ( ) ) . not . toBeInTheDocument ( ) ; //pagination not vsible
7575 await waitFor ( async ( ) => {
7676 expect ( await customChecksFailedRowsList ( ) ) . toHaveLength ( 3 ) ; //count of failed checks matches failing count set
7777 } ) ;
@@ -85,21 +85,52 @@ describe("FEATURE: Failing custom checks", () => {
8585 } ) ;
8686 } ) ;
8787 describe ( "RULE: Custom checks should auto-refresh" , ( ) => {
88- test . todo ( "EXAMPLE: When a custom check fails, the custom checks tab is auto-refreshed with the new failed custom check" ) ;
89-
90- /* SCENARIO
91- Given 2 passing custom checks
92- And the custom checks page is open
93- When the endpoint reports a failing custom check
94- Then the failing custom check should be rendered
95- */
96-
97- test . todo ( "EXAMPLE: A failing custom check that begins passing is auto-refreshed and removed from the list on the custom checks tab" ) ;
98- /* SCENARIO
99- Given 2 failing custom checks
100- And the custom checks page is open
101- When one of the custom checks passes
102- Then the passing custom check should be removed from the list
103- */
88+ test ( "EXAMPLE:When a custom check fails, the custom checks tab is auto-refreshed with the new failed custom check" , async ( { driver } ) => {
89+ await driver . setUp ( precondition . serviceControlWithMonitoring ) ;
90+ const customCheckItems = precondition . setCustomChecksData ( 3 , 2 ) ( ) ;
91+ await driver . setUp ( precondition . getCustomChecks ( customCheckItems ) ) ;
92+
93+ await driver . goTo ( "/custom-checks" ) ;
94+
95+ await waitFor ( async ( ) => {
96+ expect ( await customChecksListElement ( ) ) . toBeInTheDocument ( ) ; //failed list is visisble
97+ } ) ;
98+ await waitFor ( async ( ) => {
99+ expect ( await customChecksFailedRowsList ( ) ) . toHaveLength ( 3 ) ; //count of failed checks matches failing count set
100+ } ) ;
101+
102+ updateCustomCheckItem ( customCheckItems , "Pass" ) ; // Fail an existing item that is passing
103+
104+ await driver . setUp ( precondition . getCustomChecks ( customCheckItems ) ) ;
105+
106+ await driver . goTo ( "/custom-checks" ) ;
107+ await waitFor ( async ( ) => {
108+ expect ( await customChecksFailedRowsList ( ) ) . toHaveLength ( 4 ) ; // Now it should be 4
109+ } ) ;
110+ } ) ;
111+
112+ test ( "EXAMPLE: A failing custom check that begins passing is auto-refreshed and removed from the list on the custom checks tab" , async ( { driver } ) => {
113+ await driver . setUp ( precondition . serviceControlWithMonitoring ) ;
114+ const customCheckItems = precondition . setCustomChecksData ( 3 , 2 ) ( ) ;
115+ await driver . setUp ( precondition . getCustomChecks ( customCheckItems ) ) ;
116+
117+ await driver . goTo ( "/custom-checks" ) ;
118+
119+ await waitFor ( async ( ) => {
120+ expect ( await customChecksListElement ( ) ) . toBeInTheDocument ( ) ; //failed list is visisble
121+ } ) ;
122+ await waitFor ( async ( ) => {
123+ expect ( await customChecksFailedRowsList ( ) ) . toHaveLength ( 3 ) ; //count of failed checks matches failing count set
124+ } ) ;
125+
126+ updateCustomCheckItem ( customCheckItems , "Fail" ) ; // Pass an existing item that is failing
127+
128+ await driver . setUp ( precondition . getCustomChecks ( customCheckItems ) ) ;
129+
130+ await driver . goTo ( "/custom-checks" ) ;
131+ await waitFor ( async ( ) => {
132+ expect ( await customChecksFailedRowsList ( ) ) . toHaveLength ( 2 ) ; // Now it should be 2
133+ } ) ;
134+ } ) ;
104135 } ) ;
105136} ) ;
0 commit comments