11/* eslint-disable @typescript-eslint/no-namespace */
22/// <reference types="cypress" />
33import { guidedTour } from '../../views/tour' ;
4- import * as dataTest from '../../fixtures/data-test' ;
4+ import * as dt from '../../fixtures/data-test' ;
55import * as helperfuncs from '../views/utils' ;
66
77declare global {
@@ -11,12 +11,16 @@ declare global {
1111 value ?: string ;
1212 }
1313 interface Chainable < Subject > {
14- openTroubeshootPanel ( ) ;
14+ openTroubleshootPanel ( ) ;
15+ closeTroubleshootPanel ( ) ;
16+ focusTroubleshootPanel ( ) ;
17+ refreshTroubleshootPanel ( ) ;
18+ getTroubleshootPanelQueryText ( ) ;
1519 }
1620 }
1721}
1822
19- function retryOpenTroubeshootPanel ( count = 5 ) {
23+ function retryOpenTroubleshootPanel ( count = 5 ) {
2024 if ( count === 0 ) {
2125 throw new Error ( 'Popup did not appear after clicking the trigger' )
2226 }
@@ -28,55 +32,52 @@ function retryOpenTroubeshootPanel(count = 5) {
2832 return
2933 } else {
3034 // Step 1: click trigger button
31- cy . byLegacyTestID ( dataTest . LegacyTestIDs . AppicationLauncher ) . click ( )
32- cy . get ( 'div.co-app-launcher' ) . should ( 'be.visible' )
35+ cy . byLegacyTestID ( dt . LegacyTestIDs . AppicationLauncher ) . click ( )
36+ cy . get ( dt . Classes . AppLaunch ) . should ( 'be.visible' )
3337 cy . byButtonText ( 'Signal Correlation' ) . click ( )
3438 cy . wait ( 6000 ) // wait for 6 seconds
3539 // retry after small delay
36- retryOpenTroubeshootPanel ( count - 1 )
40+ retryOpenTroubleshootPanel ( count - 1 )
3741 }
3842 } )
3943}
4044
41- Cypress . Commands . add ( 'openTroubeshootPanel ' , ( ) => {
45+ Cypress . Commands . add ( 'openTroubleshootPanel ' , ( ) => {
4246 cy . window ( ) . its ( 'document.readyState' ) . should ( 'eq' , 'complete' ) ;
4347 // Retry until popup div appears.
44- retryOpenTroubeshootPanel ( 5 )
45- cy . get ( 'div.tp-plugin__panel-topology-container' ) . should ( 'be.visible' ) ;
48+ retryOpenTroubleshootPanel ( 5 )
49+ cy . get ( dt . Classes . TroubleShootPanelTopologyContainer ) . should ( 'be.visible' ) ;
4650} )
4751
48- Cypress . Commands . add ( 'closeTroubeshootPanel' , ( ) => {
49- cy . get ( 'div.tp-plugin__popover' )
50- . find ( 'svg.tp-plugin__popover-close' )
51- . click ( { force : true } ) ;
52+ Cypress . Commands . add ( 'closeTroubleshootPanel' , ( ) => {
53+ cy . get ( dt . Classes . TroubleShootPanelCloseButton ) . click ( { force : true } ) ;
5254} )
5355
54- Cypress . Commands . add ( 'focusTroubeshootPanel' , ( ) => {
55- //cy.get('div. tp-plugin__panel-query-container').contains('button', 'Forcs').click();
56- cy . get ( 'div.tp-plugin__panel-query-container' )
56+ Cypress . Commands . add ( 'focusTroubleshootPanel' , ( ) => {
57+ cy . get ( dt . Classes . TroubleShootPanelQueryContainer )
5758 . contains ( 'button' , 'Focus' )
5859 . click ( { force : true } ) ;
5960 cy . get ( 'body' ) . trigger ( 'mouseover' ) ;
6061 cy . get ( 'body' ) . click ( 0 , 0 ) ;
61- cy . get ( 'div.tp-plugin__panel-topology-container' ) . should ( 'exist' ) ;
62+ cy . get ( dt . Classes . TroubleShootPanelTopologyContainer ) . should ( 'exist' ) ;
6263} )
6364
64- Cypress . Commands . add ( 'refreshTroubeshootPanel ' , ( ) => {
65+ Cypress . Commands . add ( 'refreshTroubleshootPanel ' , ( ) => {
6566 //There’s no alternative way to locate this button
66- cy . get ( 'div.tp-plugin__panel-query-container' )
67+ cy . get ( dt . Classes . TroubleShootPanelQueryContainer )
6768 . find ( 'button' )
6869 . eq ( 2 )
6970 . click ( { focus : true } ) ;
70- cy . get ( 'div.tp-plugin__panel-topology-container' ) . should ( 'be.visible' )
71+ cy . get ( dt . Classes . TroubleShootPanelTopologyContainer ) . should ( 'be.visible' )
7172} )
7273
73- Cypress . Commands . add ( 'clickTroubeshootPanelAdvance ' , ( ) => {
74- cy . get ( 'div.tp-plugin__panel-query-container' )
74+ Cypress . Commands . add ( 'clickTroubleshootPanelAdvance ' , ( ) => {
75+ cy . get ( dt . Classes . TroubleShootPanelQueryContainer )
7576 . contains ( 'button' , 'Advanced' )
7677 . click ( { focus : true } ) ;
7778} )
7879
79- Cypress . Commands . add ( 'getTroubeshootPanelQueryText ' , ( ) => {
80+ Cypress . Commands . add ( 'getTroubleshootPanelQueryText ' , ( ) => {
8081 //Note: The advance tab need to be expaned before run this commands.
81- return cy . get ( 'div.tp-plugin__panel-query-container' ) . find ( 'textarea#query-input' ) . invoke ( 'val' )
82+ return cy . get ( dt . Classes . TroubleShootPanelQueryContainer ) . find ( 'textarea#query-input' ) . invoke ( 'val' )
8283} )
0 commit comments