@@ -641,26 +641,6 @@ function selectProviderAndDeleteWithOptionalFlashMessage({
641641 } ) ;
642642}
643643
644- /**
645- * Cleans up a provider by deleting it
646- * @param {string } createdProviderName - The name of the provider to clean up
647- */
648- function cleanUp ( { createdProviderName } ) {
649- cy . url ( )
650- . then ( ( url ) => {
651- // Navigate to cloud providers table view
652- if ( ! url . endsWith ( '/ems_cloud/show_list#/' ) ) {
653- cy . visit ( '/ems_cloud/show_list#/' ) ;
654- }
655- } )
656- . then ( ( ) => {
657- cy . selectProviderAndDeleteWithOptionalFlashMessage ( {
658- createdProviderName,
659- assertDeleteFlashMessage : false ,
660- } ) ;
661- } ) ;
662- }
663-
664644/**
665645 * Provider Test Generator helpers - Generates test cases for cloud providers
666646 * These utilities make it easy to create test cases for different provider types
@@ -696,7 +676,7 @@ function generateAddFormValidationTests(providerConfig, isAzureStack = false) {
696676
697677 it ( 'Verify successful validate + add/refresh/delete operations' , ( ) => {
698678 /**
699- * The provider name is set in this variable to identify it for deletion
679+ * The provider's unique name is set in nameValue variable
700680 */
701681 const uniqueId = generateUniqueIdentifier ( ) ;
702682 const nameValue = `${ providerConfig . nameValue } - verify-validate-add-refresh-and-delete-operations - ${ uniqueId } ` ;
@@ -743,8 +723,7 @@ function generateAddFormValidationTests(providerConfig, isAzureStack = false) {
743723function generateEditFormValidationTests ( providerConfig , isAzureStack = false ) {
744724 describe ( `Validate ${ providerConfig . type } edit form` , ( ) => {
745725 /**
746- * The provider name is set in this variable at the start of each test,
747- * allowing afterEach to identify it for deletion.
726+ * The provider's unique name is set in this variable at the start of each test
748727 */
749728 let nameFieldValue ;
750729 let hostValue ;
@@ -841,8 +820,7 @@ function generateEditFormValidationTests(providerConfig, isAzureStack = false) {
841820 } ) ;
842821
843822 afterEach ( ( ) => {
844- // TODO: Replace with better data clean-up approach
845- cleanUp ( { createdProviderName : nameFieldValue } ) ;
823+ cy . appDbState ( 'restore' ) ;
846824 } ) ;
847825 } ) ;
848826}
@@ -855,7 +833,7 @@ function generateEditFormValidationTests(providerConfig, isAzureStack = false) {
855833function generateNameUniquenessTests ( providerConfig , isAzureStack = false ) {
856834 describe ( `${ providerConfig . type } provider name uniqueness validation` , ( ) => {
857835 /**
858- * The provider name is set in this variable at the start of the test, allowing afterEach to identify it for deletion.
836+ * The provider's unique name is set in this variable at the start of the test
859837 */
860838 let nameFieldValue ;
861839 let hostValue ;
@@ -881,8 +859,7 @@ function generateNameUniquenessTests(providerConfig, isAzureStack = false) {
881859 } ) ;
882860
883861 afterEach ( ( ) => {
884- // TODO: Replace with better data clean-up approach
885- cleanUp ( { createdProviderName : nameFieldValue } ) ;
862+ cy . appDbState ( 'restore' ) ;
886863 } ) ;
887864 } ) ;
888865}
0 commit comments