1+ import { Classes , DataTestIDs , LegacyTestIDs } from "../../../src/components/data-test" ;
12export { } ;
23
34declare global {
@@ -57,21 +58,39 @@ Cypress.Commands.add('waitUntilWithCustomTimeout', (
5758
5859 Cypress . Commands . add ( 'changeNamespace' , ( namespace : string ) => {
5960 cy . log ( 'Changing Namespace to: ' + namespace ) ;
60- cy . byLegacyTestID ( 'namespace-bar-dropdown' ) . find ( 'button' ) . scrollIntoView ( ) . should ( 'be.visible' ) . click ( ) ;
61- cy . get ( '[data-test="showSystemSwitch"]' ) . then ( ( $element ) => {
62- if ( $element . attr ( 'data-checked-state' ) !== 'true' ) {
63- cy . byTestID ( 'showSystemSwitch' ) . siblings ( 'span' ) . eq ( 0 ) . should ( 'be.visible' ) . click ( ) ;
61+ cy . wait ( 2000 ) ;
62+ cy . get ( 'body' ) . then ( ( $body ) => {
63+ const hasNamespaceBarDropdown = $body . find ( '[data-test-id="' + LegacyTestIDs . NamespaceBarDropdown + '"]' ) . length > 0 ;
64+ if ( hasNamespaceBarDropdown ) {
65+ cy . byLegacyTestID ( LegacyTestIDs . NamespaceBarDropdown ) . find ( 'button' ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
66+ cy . byLegacyTestID ( LegacyTestIDs . NamespaceBarDropdown ) . find ( 'button' ) . scrollIntoView ( ) . should ( 'be.visible' ) . click ( { force : true } ) ;
67+ } else {
68+ cy . byClass ( Classes . NamespaceDropdown ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
69+ cy . byClass ( Classes . NamespaceDropdown ) . scrollIntoView ( ) . should ( 'be.visible' ) . click ( { force : true } ) ;
6470 }
6571 } ) ;
66- cy . byTestID ( 'dropdown-text-filter' ) . type ( namespace ) ;
67- cy . byTestID ( 'dropdown-menu-item-link' ) . contains ( namespace ) . should ( 'be.visible' ) . click ( ) ;
72+ cy . get ( 'body' ) . then ( ( $body ) => {
73+ const hasShowSystemSwitch = $body . find ( '[data-test="' + DataTestIDs . NamespaceDropdownShowSwitch + '"]' ) . length > 0 ;
74+ if ( hasShowSystemSwitch ) {
75+ cy . get ( '[data-test="' + DataTestIDs . NamespaceDropdownShowSwitch + '"]' ) . then ( ( $element ) => {
76+ if ( $element . attr ( 'data-checked-state' ) !== 'true' ) {
77+ cy . byTestID ( DataTestIDs . NamespaceDropdownShowSwitch ) . siblings ( 'span' ) . eq ( 0 ) . should ( 'be.visible' ) ;
78+ cy . byTestID ( DataTestIDs . NamespaceDropdownShowSwitch ) . siblings ( 'span' ) . eq ( 0 ) . should ( 'be.visible' ) . click ( { force : true } ) ;
79+ }
80+ } ) ;
81+ }
82+ } ) ;
83+ cy . byTestID ( DataTestIDs . NamespaceDropdownTextFilter ) . type ( namespace , { delay : 100 } ) ;
84+ cy . byTestID ( DataTestIDs . NamespaceDropdownMenuLink ) . contains ( namespace ) . should ( 'be.visible' ) ;
85+ cy . byTestID ( DataTestIDs . NamespaceDropdownMenuLink ) . contains ( namespace ) . should ( 'be.visible' ) . click ( { force : true } ) ;
6886 cy . log ( 'Namespace changed to: ' + namespace ) ;
6987 } ) ;
7088
7189 Cypress . Commands . add ( 'aboutModal' , ( ) => {
7290 cy . log ( 'Getting OCP version' ) ;
73- cy . byTestID ( 'help-dropdown-toggle' ) . should ( 'be.visible' ) . click ( ) ;
74- cy . byTestID ( 'application-launcher-item' ) . contains ( 'About' ) . should ( 'be.visible' ) . click ( ) ;
91+ cy . byTestID ( DataTestIDs . MastHeadHelpIcon ) . should ( 'be.visible' ) ;
92+ cy . byTestID ( DataTestIDs . MastHeadHelpIcon ) . should ( 'be.visible' ) . click ( { force : true } ) ;
93+ cy . byTestID ( DataTestIDs . MastHeadApplicationItem ) . contains ( 'About' ) . should ( 'be.visible' ) . click ( ) ;
7594 cy . byAriaLabel ( 'About modal' ) . find ( 'div[class*="co-select-to-copy"]' ) . eq ( 0 ) . should ( 'be.visible' ) . then ( ( $ocpversion ) => {
7695 cy . log ( 'OCP version: ' + $ocpversion . text ( ) ) ;
7796 } ) ;
@@ -97,14 +116,25 @@ Cypress.Commands.add('waitUntilWithCustomTimeout', (
97116 cy . log ( 'Get pod image' ) ;
98117 cy . clickNavLink ( [ 'Workloads' , 'Pods' ] ) ;
99118 cy . changeNamespace ( namespace ) ;
100- cy . byTestID ( 'name-filter-input' ) . should ( 'be.visible' ) . type ( pod ) ;
101- cy . get ( `a[data-test^="${ pod } "]` ) . eq ( 0 ) . as ( 'podLink' ) . click ( ) ;
102- cy . get ( '@podLink' ) . should ( 'be.visible' ) . click ( ) ;
103- cy . byPFRole ( 'rowgroup' ) . find ( 'td' ) . eq ( 1 ) . scrollIntoView ( ) . should ( 'be.visible' ) . then ( ( $td ) => {
104- cy . log ( 'Pod image: ' + $td . text ( ) ) ;
105-
119+ cy . byTestID ( 'page-heading' ) . contains ( 'Pods' ) . should ( 'be.visible' ) ;
120+ cy . wait ( 5000 ) ;
121+ // Check for DataViewFilters component using Cypress's built-in retry-ability
122+ cy . get ( 'body' ) . then ( ( $body ) => {
123+ const hasDataViewFilters = $body . find ( '[data-ouia-component-id="DataViewFilters"]' ) . length > 0 ;
124+ if ( hasDataViewFilters ) {
125+ cy . byOUIAID ( 'DataViewFilters' ) . find ( 'button' ) . contains ( 'Status' ) . scrollIntoView ( ) . should ( 'be.visible' ) . click ( ) ;
126+ cy . byOUIAID ( 'OUIA-Generated-Menu' ) . find ( 'button' ) . contains ( 'Name' ) . scrollIntoView ( ) . should ( 'be.visible' ) . click ( ) ;
127+ cy . byAriaLabel ( 'Name filter' ) . scrollIntoView ( ) . should ( 'be.visible' ) . type ( pod ) ;
128+ } else {
129+ cy . byTestID ( 'name-filter-input' ) . should ( 'be.visible' ) . type ( pod ) ;
130+ }
106131 } ) ;
107- cy . log ( 'Get pod image completed' ) ;
132+ cy . get ( `a[data-test^="${ pod } "]` ) . eq ( 0 ) . as ( 'podLink' ) . click ( ) ;
133+ cy . get ( '@podLink' ) . should ( 'be.visible' ) . click ( ) ;
134+ cy . byPFRole ( 'rowgroup' ) . find ( 'td' ) . eq ( 1 ) . scrollIntoView ( ) . should ( 'be.visible' ) . then ( ( $td ) => {
135+ cy . log ( 'Pod image: ' + $td . text ( ) ) ;
136+ } ) ;
137+ cy . log ( 'Get pod image completed' ) ;
108138 } ) ;
109139
110140
0 commit comments