#=============================================================================================
# @TITLE					Check - Files - Check table
#
# @NUMBER					WDBM_FKT_02043
#
# @DESCRIPTION		The for 'Server - Check' will be used and the shown table will be checked.
#
# @EXP_RESULT			The database1 verfiy will work.
#
# @REQUIREMENTS		Test: WDBM_FKT_01000; WDBM_FKT_00100; WDBM_FKT_01010;
#=============================================================================================

public function trim (in str) {
	if (substr(str, 1, 1) == " ") {

		str = trim(substr(str, 2));
	}
	if (substr(str, length(str)) == " ") {
		str = trim(substr(str, 1, length(str)-1));
	}
	return (str);
}

static headline_items_ok = 1;
static headline_items [] = {"Name","Size","Modified"};
#=============================================================================================
# @STEP 1			Clicking the link for Check - Backup.
#=============================================================================================
set_window (menu_window, 3);

if (version == "7.3.00") {
	web_link_click("Files");
}
if (version == "7.4.03" ||
	version == "7.5.00" ||
	version == "7.5.01" ||
	version == "7.6.00") {
	
	web_link_click("Diagnosis Files");
}
#=============================================================================================
# @STEP 2			Checking the shown text and radiobuttons.
#=============================================================================================
set_window (work_window, 3);

if (new_interface == "1") {
	web_obj_get_text("Information - CACHES - DB73","#1","#1",cell_value_1,"","",1);
} else {
	tbl_get_cell_data("Database/Servername", "#1", "#1", cell_value_1);
}

if ((cell_value_1 == "Files - " & database && version == "7.3.00") ||
	(cell_value_1 == "Check - Diagnosis Files" && (version == "7.4.03" || version == "7.5.00" || version == "7.5.01" || version == "7.6.00"))) {
 
	for(n=1;n<4;n++) {
		
		if (new_interface == "1") {
			web_obj_get_text ("Database Users", "#1", "#"&n, cell_value_2, "", "", 1);
		} else {
			tbl_get_cell_data ("1x1", "#1", "#"&n, cell_value_2);
		}
		
		if (trim(cell_value_2) != headline_items [n-1]) {
			headline_items_ok = 0;
			break;
		}
	}
}
			
set_window (work_window, 3);
if (new_interface == "1") {
	tbl_get_cols_count("1x1_2",cols_count);
} else {
	tbl_get_cols_count ("1x1", cols_count);
}

if (cols_count > 1) {
	tl_step("'Check - Server' table","0","Table has " & cols_count & "rows - correct");
} else {
	tl_step("'Check - Server' table","1","Table has only " & cols_count & "rows - incorrect");
}
#=============================================================================================
# @STEP 3			Checking table content after 'Refresh'.
#=============================================================================================
set_window (work_window, 1);
if (new_interface == "1") {
	web_image_click("1x1.gif", 7, 9);
} else {
	web_image_click("refresh", 9, 4);
}
wait(5);
set_window (work_window, 1);
web_obj_get_text ("Information - CACHES - DB73", "#1", "#1", cell_value_2, "", "", 1);

if ((trim(cell_value_2) == "Files - " & database && version == "7.3.00") ||
	(trim(cell_value_2) == "Check - Diagnosis Files" && (version == "7.4.03" || version == "7.5.00" || version == "7.5.01" || version == "7.6.00"))) {
	
	tl_step("After 'Refresh'","0","still the same table");
} else {
	tl_step("After 'Refresh'","1","is not the same table");
}
#=============================================================================================
# @STEP 3			Clicking one link for functionality.
#=============================================================================================
set_window (work_window, 1);
web_link_click("Database Messages");
set_window (work_window, 1);

if (new_interface == "1") {
	web_obj_get_text ("Information - CACHES - DB73", "#1", "#1", cell_value_3, "", "", 1);
} else {
	tbl_get_cell_data ("Database/Servername", "#1", "#1", cell_value_3);
}

if ((cell_value_3 == "File - KNLDIAG" && version == "7.3.00") ||
	(cell_value_3 == "Check - Diagnosis File - KNLDIAG" && (version == "7.4.03" || version == "7.5.00" || version == "7.5.01" || version == "7.6.00"))) {
	
	tl_step("Link in 'Files - Server' table","0","is correct");
} else {
	tl_step("Link in 'Files - Server' table","1","is incorrect");
}

set_window (work_window, 2);
web_link_click("Back");
wait(10);
set_window (work_window, 1);
web_obj_get_text("Information - CACHES - DB73","#1","#1",cell_value_4,"","",1);

if ((trim(cell_value_4) == "Files - " & database && version == "7.3.00") ||
	(trim(cell_value_4) == "Check - Diagnosis Files" && (version == "7.4.03" || version == "7.5.00" || version == "7.5.01" || version == "7.6.00"))) {
	
	tl_step("After 'Back' - button","0","still the same table");
} else {
	tl_step("After 'Back' - button","1","is not the same table");
}
