#=============================================================================================
# @TITLE			2. Step DBM Wizard.
#
# @NUMBER			DBM2_FKT_02002
#
# @DESCRIPTION		Clicking 'Back' and checking the window content. Then 'Next' and again
# @					checking window content. Entering the name of database and going 'Next'.
#
# @EXP_RESULT		'Dabahase Name' step.
#
# @REQUIREMENTS		"Database Manager" is installed.
#=============================================================================================
TestName = "DBM2_FKT_02002";
static WizardOpen = 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");
	
	wait(3);
	
	ActiveX_get_info("DBMWfr2.Framework", "HeaderTitle", Header);
	
	if (GUI_Version == "2") {
		exp_Header = "Installation Template";
	}
	if (GUI_Version == "3") {
		exp_Header = "Select Template";
	}
	
	if (Header == exp_Header) {		
		tl_step ("Installation wizard - install Template - 'Back'", "0", "Window is correct. - TN: " & TestName);
	} else {		
		tl_step ("Installation wizard - install Template - '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 == "Database Instance Name" ||
		Header == "Database Name") {		
		tl_step ("Installation wizard - install Template - 'Back'", "0", "Window is correct. - TN: " & TestName);
	} else {		
		tl_step ("Installation wizard - install Template - 'Back'", "1", "Window is incorrect. - TN: " & TestName);
	}
#=============================================================================================
# @STEP 3			Checking window content - <local>
#=============================================================================================
	L_RC_0 = obj_exists("txtServerName",0);
	L_RC_1 = obj_exists("txtDatabaseName",0);
	L_RC_2 = obj_exists("txtServerUser",0);
	L_RC_3 = obj_exists("txtServerPassword",0);
	L_RC_4 = obj_exists("< Back",0);
	L_RC_5 = obj_exists("Next >",0);
	L_RC_6 = obj_exists("Cancel",0);
	
	if (L_RC_0 == 0 &&
		L_RC_1 == 0 &&
		L_RC_2 == 0 &&
		L_RC_3 == 0 &&
		L_RC_4 == 0 &&
		L_RC_5 == 0 &&
		L_RC_6 == 0) {
			
		tl_step("Installation Wizard - Database Name", "0", "All expected controls are displayed. - TN: " & TestName);
		
		obj_get_info("txtServerName", "enabled", state1);
		obj_get_info("txtDatabaseName", "enabled", state2);
		obj_get_info("txtServerUser", "enabled", state3);
		obj_get_info("txtServerPassword", "enabled", state4);
		
		if (state1 == 1 && state2 == 1 && state3 == 0 && state4 == 0) {
			
			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", "txtServerName: " & state1 & " expected 1. - TN: " & TestName);
			tl_step("Installation Wizard - Database Name", "1", "txtDatabaseName " & state2 & " expected 1. - TN: " & TestName);
			tl_step("Installation Wizard - Database Name", "1", "txtServerUser " & state3 & " expected 0. - TN: " & TestName);
			tl_step("Installation Wizard - Database Name", "1", "txtServerPassword " & state4 & " expected 0. - TN: " & TestName);
		}
#=============================================================================================
# @STEP 4			Checking window content - with server
#=============================================================================================		
		set_window ("Database Manager Installation Wizard", 13);
		edit_set ("txtServerName", "10.31.165.193");
		
		obj_get_info("txtServerName", "enabled", state1);
		obj_get_info("txtDatabaseName", "enabled", state2);
		obj_get_info("txtServerUser", "enabled", state3);
		obj_get_info("txtServerPassword", "enabled", state4);
		
		if (state1 == 1 && state2 == 1 && state3 == 1 && state4 == 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", "txtServerName: " & state1 & " expected 1. - TN: " & TestName);
			tl_step("Installation Wizard - Database Name", "1", "txtDatabaseName " & state2 & " expected 1. - TN: " & TestName);
			tl_step("Installation Wizard - Database Name", "1", "txtServerUser " & state3 & " expected 1. - TN: " & TestName);
			tl_step("Installation Wizard - Database Name", "1", "txtServerPassword " & state4 & " expected 1. - TN: " & TestName);
		}

	} else {		
		tl_step("Installation Wizard - Database Name", "1", "Not all expected controls are displayed. - TN: " & TestName);
	}
#=============================================================================================
# @STEP 5			Enter name of database.
#=============================================================================================
	set_window ("Database Manager Installation Wizard", 2);
	
	edit_set ("txtServerName", "<Local>");
	edit_set ("txtDatabaseName", database);
	
	button_press ("Next >");
	wait(5);
} else {
	
	tl_step("Database Manager Installation Wizard - Window Check", "1", "Window not open. - TN: " & TestName);
	WizardOpen = 0;
}
