Include some functions about labels in common_functions.sah and use them
FEA: ItEr75S18DataTypesTests
This commit is contained in:
parent
ef997a413d
commit
87a81a6fb4
3 changed files with 36 additions and 44 deletions
|
|
@ -407,6 +407,34 @@ function commonCriteriaTryDeleteAssigned($criteriaName){
|
|||
_log("Do not allow criteria because it's assigned", "custom1");
|
||||
}
|
||||
|
||||
/*
|
||||
* Common functions for Labels
|
||||
*/
|
||||
|
||||
function commonLabelCreate($type, $name){
|
||||
commonCreate("Labels");
|
||||
commonLabelForm($type, $name);
|
||||
commonSaveValidation("Label Type", $type);
|
||||
_log("Create a new label", "custom1");
|
||||
}
|
||||
|
||||
function commonLabelForm($name, $list){
|
||||
_setValue(_textbox(0, _near(_span("Name"))), $name);
|
||||
if ($list != null){
|
||||
for (var $i = 0; $i < $list.length; $i++){
|
||||
_setValue(_textbox(0, _near(_span("New label"))), $list[$i]);
|
||||
_click(_cell("Add"));
|
||||
}
|
||||
}
|
||||
_click(_cell("Save"));
|
||||
}
|
||||
|
||||
function commonLabelDelete($name){
|
||||
commonDelete("Labels", $name, 2);
|
||||
commonDeleteValidation("Label Type", $name);
|
||||
_log("Label Deleted", "custom1");
|
||||
}
|
||||
|
||||
/*
|
||||
* Common functions for Work Report Model
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,23 +39,16 @@
|
|||
*/
|
||||
_include("../common_functions.sah");
|
||||
|
||||
function labelCreate($type, $name){
|
||||
commonCreate("Labels");
|
||||
labelForm($type, $name);
|
||||
commonSaveValidation("Label Type", $type);
|
||||
_log("Create a new label", "custom1");
|
||||
}
|
||||
|
||||
function labelCreateDuplicateType($type){
|
||||
commonCreate("Labels");
|
||||
labelForm($type);
|
||||
commonLabelForm($type);
|
||||
labelNotValid($type);
|
||||
_log("Do not allow create a label with duplicate type", "custom1");
|
||||
}
|
||||
|
||||
function labelCreateEmpty(){
|
||||
commonCreate("Labels");
|
||||
labelForm("");
|
||||
commonLabelForm("");
|
||||
_assertExists(_div("cannot be null or empty"));
|
||||
_assert(_isVisible(_div("cannot be null or empty")));
|
||||
_log("Do not allow create a label without type", "custom1");
|
||||
|
|
@ -73,13 +66,6 @@ function labelCreateDuplicateName($type, $name){
|
|||
_log("Do not allow create a label with duplicate name", "custom1");
|
||||
}
|
||||
|
||||
function labelForm($name, $labelName){
|
||||
_setValue(_textbox(0, _near(_span("Name"))), $name);
|
||||
_setValue(_textbox(0, _near(_span("New label"))), $labelName);
|
||||
_click(_cell("Add"));
|
||||
_click(_cell("Save"));
|
||||
}
|
||||
|
||||
/* test to check a that naval plan give us a error */
|
||||
function labelNotValid($labelType){
|
||||
_assertExists(_div("name: "+$labelType+" already exists"));
|
||||
|
|
@ -88,7 +74,7 @@ function labelNotValid($labelType){
|
|||
|
||||
function labelEdit($oldName, $newName, $cell){
|
||||
commonEdit($oldName, $cell);
|
||||
labelForm($newName);
|
||||
commonLabelForm($newName);
|
||||
commonSaveValidation("Label Type", $newName);
|
||||
_log("Edit the label", "custom1");
|
||||
}
|
||||
|
|
@ -155,13 +141,13 @@ function labelEmptyCodeValidation(){
|
|||
var $labelType = "new";
|
||||
var $labelType2 = "new2";
|
||||
var $labelNewType = "newest";
|
||||
var $labelName = "criteria1";
|
||||
var $labelName = ["criteria1"];
|
||||
var $projectName = "project1";
|
||||
|
||||
/* test actions */
|
||||
commonLogin("admin", "admin");
|
||||
|
||||
labelCreate($labelType, $labelName);
|
||||
commonLabelCreate($labelType, $labelName);
|
||||
labelCreateDuplicateType($labelType);
|
||||
labelCreateEmpty();
|
||||
labelCreateDuplicateName($labelType2, $labelName);
|
||||
|
|
@ -169,9 +155,6 @@ labelCreateDuplicateName($labelType2, $labelName);
|
|||
labelEdit($labelType, $labelNewType, 2);
|
||||
labelAssig($projectName, $labelName, $labelNewType);
|
||||
labelCheckCode($labelType, $labelName);
|
||||
|
||||
commonDelete("Labels", $labelNewType, 2);
|
||||
commonDeleteValidation("Label Type", $labelNewType);
|
||||
_log("Delete the label", "custom1");
|
||||
commonLabelDelete($labelNewType);
|
||||
|
||||
commonLogout();
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ function workReportModelCheckComplementaryTextFieldsValidationLength(){
|
|||
}
|
||||
|
||||
function workReportModelCheckLabelTypeFields($name){
|
||||
labelCreate("labelforModel","New");
|
||||
commonLabelCreate("labelforModel",["New"]);
|
||||
commonCreate("Work Report Models");
|
||||
_setValue(_textbox(0, _near(_span("Name:"))), $name);
|
||||
_removeFocus(_textbox(0, _near(_div("Name:"))));
|
||||
|
|
@ -151,8 +151,7 @@ function workReportModelCheckLabelTypeFields($name){
|
|||
_click(_cell("labelforModel"));
|
||||
_click(_cell("Save"));
|
||||
workReportModelCheckLabelTypeFieldsValidationLabel();
|
||||
commonDelete("Labels", "labelforModel", 2);
|
||||
commonDeleteValidation("Label Type", "labelforModel");
|
||||
commonLabelDelete("labelforModel");
|
||||
}
|
||||
|
||||
function workReportModelCheckLabelTypeFieldsValidationName(){
|
||||
|
|
@ -165,24 +164,6 @@ function workReportModelCheckLabelTypeFieldsValidationLabel() {
|
|||
_assert(_isVisible(_div("The label must not null.")));
|
||||
}
|
||||
|
||||
/*
|
||||
* Label functions
|
||||
*/
|
||||
|
||||
function labelCreate($type, $name){
|
||||
commonCreate("Labels");
|
||||
labelForm($type, $name);
|
||||
commonSaveValidation("Label Type", $type);
|
||||
_log("Create a new label", "custom1");
|
||||
}
|
||||
|
||||
function labelForm($name, $labelName){
|
||||
_setValue(_textbox(0, _near(_span("Name"))), $name);
|
||||
_setValue(_textbox(0, _near(_span("New label"))), $labelName);
|
||||
_click(_cell("Add"));
|
||||
_click(_cell("Save"));
|
||||
}
|
||||
|
||||
/* test values */
|
||||
var $workReportModelName = "new";
|
||||
var $workReportModelName2 = "new2";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue