diff --git a/application/helpers/viewHelper.php b/application/helpers/viewHelper.php index 02c2095fdce..95ab0fb8cb6 100644 --- a/application/helpers/viewHelper.php +++ b/application/helpers/viewHelper.php @@ -302,10 +302,15 @@ public static function getLanguageData($bOrderByNative = false, $sLanguageCode = /** * Get a tag to help automated tests identify pages * @param string $name unique view name + * @param string $model_id * @return string */ - public static function getViewTestTag($name) + public static function getViewTestTag($name,$model_id = null) { - return sprintf('', $name); + $modelTag = null; + if($model_id){ + $modelTag = sprintf('model_id="%s"', $model_id); + } + return sprintf('', $name, $modelTag); } } diff --git a/application/views/admin/survey/QuestionGroups/editGroup_view.php b/application/views/admin/survey/QuestionGroups/editGroup_view.php index 4415c1c26c9..15c427d66b7 100644 --- a/application/views/admin/survey/QuestionGroups/editGroup_view.php +++ b/application/views/admin/survey/QuestionGroups/editGroup_view.php @@ -1,6 +1,15 @@ gid); + +echo PrepareEditorScript(false, $this); +$count = 0; ?>
diff --git a/application/views/admin/survey/surveySummary_view.php b/application/views/admin/survey/surveySummary_view.php index 5260de9d61b..b93cc49e549 100644 --- a/application/views/admin/survey/surveySummary_view.php +++ b/application/views/admin/survey/surveySummary_view.php @@ -7,8 +7,7 @@ $count= 0; // DO NOT REMOVE This is for automated testing to validate we see that page -echo viewHelper::getViewTestTag('surveySummary'); -echo ''; +echo viewHelper::getViewTestTag('surveySummary',$oSurvey->primaryKey); //TODO : move to controller $templates = Template::getTemplateListWithPreviews(); diff --git a/tests/controllers/CreateSurveyTest.php b/tests/controllers/CreateSurveyTest.php index 8a08c471075..36886bafe71 100644 --- a/tests/controllers/CreateSurveyTest.php +++ b/tests/controllers/CreateSurveyTest.php @@ -96,8 +96,7 @@ public function testCreateSurvey() $element = $this->findViewTag('surveySummary'); $this->assertNotEmpty($element); - $idTag = self::find(WebDriverBy::id('survey_id'),5); - $sid = intval($idTag->getAttribute('survey_id')); + $sid = intval($element->getAttribute('model_id')); $survey = \Survey::model()->findByPk($sid); if($survey){ self::$survey = $survey; @@ -153,6 +152,14 @@ public function testAddGroup(){ // Click save. self::findAndClick(WebDriverBy::id('save-button')); + $element = $this->findViewTag('editGroup'); + $this->assertNotEmpty($element); + + $sid = intval($element->getAttribute('model_id')); + $survey = \Survey::model()->findByPk($sid); + if($survey){ + self::$survey = $survey; + } }