@@ -18,11 +18,16 @@ describe('Source secrets', () => {
1818 } ) ;
1919
2020 beforeEach ( ( ) => {
21+ // ensure the test project is selected to avoid flakes
22+ cy . visit ( `/k8s/cluster/projects/${ testName } ` ) ;
2123 cy . visit ( `/k8s/ns/${ testName } /secrets/` ) ;
2224 secrets . clickCreateSecretDropdownButton ( 'source' ) ;
2325 } ) ;
2426
2527 afterEach ( ( ) => {
28+ cy . exec ( `oc delete secret -n ${ testName } ${ basicSourceSecretName } ${ sshSourceSecretName } ` , {
29+ failOnNonZeroExit : false ,
30+ } ) ;
2631 checkErrors ( ) ;
2732 } ) ;
2833
@@ -32,11 +37,12 @@ describe('Source secrets', () => {
3237
3338 it ( `Creates, edits, and deletes a basic source secret` , ( ) => {
3439 cy . log ( 'Create secret' ) ;
35- cy . get ( '[data-test=" page-heading"] h1 ') . contains ( 'Create source secret' ) ;
40+ cy . byTestID ( ' page-heading') . contains ( 'Create source secret' ) ;
3641 secrets . enterSecretName ( basicSourceSecretName ) ;
3742 cy . byTestID ( 'secret-username' ) . type ( basicSourceSecretUsername ) ;
3843 cy . byTestID ( 'secret-password' ) . type ( basicSourceSecretPassword ) ;
3944 secrets . save ( ) ;
45+ cy . byTestID ( 'loading-indicator' ) . should ( 'not.exist' ) ;
4046 secrets . detailsPageIsLoaded ( basicSourceSecretName ) ;
4147
4248 cy . log ( 'Verify secret' ) ;
@@ -47,11 +53,16 @@ describe('Source secrets', () => {
4753
4854 cy . log ( 'Edit secret' ) ;
4955 detailsPage . clickPageActionFromDropdown ( 'Edit Secret' ) ;
56+ // Wait for form to load and hydrate with current values
57+ cy . byTestID ( 'page-heading' ) . contains ( 'Edit source secret' ) ;
58+ cy . byTestID ( 'secret-username' ) . should ( 'have.value' , basicSourceSecretUsername ) ;
59+ cy . byTestID ( 'secret-password' ) . should ( 'have.value' , basicSourceSecretPassword ) ;
5060 cy . byTestID ( 'secret-username' ) . clear ( ) ;
5161 cy . byTestID ( 'secret-username' ) . type ( basicSourceSecretUsernameUpdated ) ;
5262 cy . byTestID ( 'secret-password' ) . clear ( ) ;
5363 cy . byTestID ( 'secret-password' ) . type ( basicSourceSecretPasswordUpdated ) ;
5464 secrets . save ( ) ;
65+ cy . byTestID ( 'loading-indicator' ) . should ( 'not.exist' ) ;
5566
5667 cy . log ( 'Verify edit' ) ;
5768 secrets . detailsPageIsLoaded ( basicSourceSecretName ) ;
@@ -66,12 +77,13 @@ describe('Source secrets', () => {
6677
6778 it ( `Creates, edits, and deletes a SSH source secret` , ( ) => {
6879 cy . log ( 'Create secret' ) ;
69- cy . get ( '[data-test=" page-heading"] h1 ') . contains ( 'Create source secret' ) ;
80+ cy . byTestID ( ' page-heading') . contains ( 'Create source secret' ) ;
7081 secrets . enterSecretName ( sshSourceSecretName ) ;
7182 cy . byTestID ( 'console-select-auth-type-menu-toggle' ) . click ( ) ;
7283 cy . byTestDropDownMenu ( 'kubernetes.io/ssh-auth' ) . click ( ) ;
7384 cy . byLegacyTestID ( 'file-input-textarea' ) . type ( sshSourceSecretSSHKey ) ;
7485 secrets . save ( ) ;
86+ cy . byTestID ( 'loading-indicator' ) . should ( 'not.exist' ) ;
7587 secrets . detailsPageIsLoaded ( sshSourceSecretName ) ;
7688
7789 cy . log ( 'Verify secret' ) ;
@@ -81,9 +93,13 @@ describe('Source secrets', () => {
8193
8294 cy . log ( 'Edit secret' ) ;
8395 detailsPage . clickPageActionFromDropdown ( 'Edit Secret' ) ;
96+ // Wait for form to load and hydrate with current values
97+ cy . byTestID ( 'page-heading' ) . contains ( 'Edit source secret' ) ;
98+ cy . byLegacyTestID ( 'file-input-textarea' ) . should ( 'contain.value' , sshSourceSecretSSHKey ) ;
8499 cy . byLegacyTestID ( 'file-input-textarea' ) . clear ( ) ;
85100 cy . byLegacyTestID ( 'file-input-textarea' ) . type ( sshSourceSecretSSHKeUpdated ) ;
86101 secrets . save ( ) ;
102+ cy . byTestID ( 'loading-indicator' ) . should ( 'not.exist' ) ;
87103
88104 cy . log ( 'Verify edit' ) ;
89105 secrets . detailsPageIsLoaded ( sshSourceSecretName ) ;
0 commit comments