#=============================================================================================
# @TITLE			3. Step DBM Wizard.
#
# @NUMBER			DBM2_FKT_02003
#
# @DESCRIPTION		Clicking 'Back' and checking the window content. Then 'Next' and again
# @					checking window content. Selecting the version to install and going 'Next'.
#
# @EXP_RESULT		'Dababase Version' step.
#
# @REQUIREMENTS		"Database Manager" is installed.
#=============================================================================================
TestName = "DBM2_FKT_02003";
static WizardOpen = 1;
static inst_version = "1";
#=============================================================================================
# @STEP 1			Going back and checking window content.
#=============================================================================================
if (win_exists("Database Manager Installation Wizard") == 0) {

	set_window ("Database Manager Installation Wizard", 2);
	button_press ("< Back");
	
	ActiveX_get_info("DBMWfr2.Framework", "HeaderTitle", Header);
	
	if (Header == "Database Instance Name" ||
		Header == "Database Name") {		
		tl_step ("Installation wizard - 'Database Name' - 'Back'", "0", "Window is correct. - TN: " & TestName);
	} else {		
		tl_step ("Installation wizard - 'Database Name' - 'Back'", "1", "Window is incorrect. - TN: " & TestName);
	}
#=============================================================================================
# @STEP 2			Going next.
#=============================================================================================
	set_window ("Database Manager Installation Wizard", 2);
	button_press ("Next >");
	
	ActiveX_get_info("DBMWfr2.Framework", "HeaderTitle", Header);
	
	if (Header == "Installations") {		
		tl_step ("Installation wizard - 'Installations' - 'Next'", "0", "Window is correct. - TN: " & TestName);
	} else {		
		tl_step ("Installation wizard - 'Installations' - 'Next'", "1", "Window is incorrect. - TN: " & TestName);
	}
#=============================================================================================
# @STEP 3			Checking window content - Installation
#=============================================================================================
	L_RC_1 = obj_exists ("lvwInstallations", 0);
	L_RC_2 = obj_exists ("< Back", 0);
	L_RC_3 = obj_exists ("Next >", 0);
	L_RC_4 = obj_exists ("Cancel", 0);
	
	if (L_RC_1 == 0 &&
		L_RC_2 == 0 &&
		L_RC_3 == 0 &&
		L_RC_4 == 0) {
			
		tl_step("Installation Wizard - Database Name", "0", "All expected controls are displayed. - TN: " & TestName);
		
		obj_get_info("lvwInstallations", "enabled", state1);
		
		if (state1 == 1) {
			
			tl_step("Installation Wizard - Database Name", "0", "All checked controls are in correct state. - TN: " & TestName);
		} else {
			tl_step("Installation Wizard - Database Name", "1", "At least one checked controls is in incorrect state. - TN: " & TestName);
			tl_step("Installation Wizard - Database Name", "1", "lvwInstallations: " & state1 & " expected 1. - TN: " & TestName);
		}
#=============================================================================================
# @STEP 4			Selecting the version to install and going 'Next'.
#=============================================================================================		
		set_window ("Database Manager Installation Wizard", 2);
		list_get_info ("lvwInstallations", "count", count);
		
		for (i=0;i<count;i++) {
			
			set_window ("Database Manager Installation Wizard", 2);
			list_get_item ("lvwInstallations", i, item);
			
			if (match (item, DetailVersion) != 0) {
			
				set_window ("Database Manager Installation Wizard", 2);
				list_select_item ("lvwInstallations", item);
				
				inst_version = item;
			} 
		}

		set_window ("Database Manager Installation Wizard", 0);
		button_press ("Next >");
		
	} else {		
		tl_step("Installation Wizard - Database Name", "1", "Not all expected controls are displayed. - TN: " & TestName);
	}
} else {
	
	tl_step("Database Manager Installation Wizard - Window Check", "1", "Window not open. - TN: " & TestName);
	WizardOpen = 0;
}
