Skip to content

Commit

Permalink
Merge pull request #851 from TonisOrmisson/views-test
Browse files Browse the repository at this point in the history
Dev: add AdminViewsTest
  • Loading branch information
olleharstedt committed Nov 6, 2017
2 parents ada792b + 85101c0 commit b2266be
Show file tree
Hide file tree
Showing 61 changed files with 643 additions and 69 deletions.
2 changes: 2 additions & 0 deletions application/controllers/admin/assessments.php
Expand Up @@ -116,7 +116,9 @@ private function _showAssessments($iSurveyID, $action)

Yii::app()->loadHelper('admin/htmleditor');

// FIXME this must be in VIEWS!
$urls['output'] = '<div class="side-body ' . getSideBodyClass(false) . '">';
$urls['output'] .=viewHelper::getViewTestTag('surveyAssessments');
$urls['output'] .= '<h3>'.gT("Assessments").'</h3>';
$aData['asessementNotActivated'] = false;
if ($oSurvey->assessments!='Y')
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/export.php
Expand Up @@ -175,7 +175,7 @@ public function exportresults()
//FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT
if ($survey->isSaveTimings) {
//Append survey timings to the fieldmap array
$aFieldMap = createTimingsFieldMap($iSurveyID, 'full',false,false,$oSurvey->language);
$aFieldMap = createTimingsFieldMap($iSurveyID, 'full',false,false,$survey->language);
}
$iFieldCount = count($aFieldMap);

Expand Down
4 changes: 3 additions & 1 deletion application/controllers/admin/surveypermission.php
Expand Up @@ -50,8 +50,10 @@ public function index($iSurveyID)
$userList=getUserList('onlyuidarray'); // Limit the user list for the samegrouppolicy
App()->getClientScript()->registerPackage('jquery-tablesorter');
App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'surveypermissions.js');

// FIXME this HTML stuff MUST BE IN VIEWS!!
$surveysecurity = "<div id='edit-permission' class='side-body " . getSideBodyClass(false) . "'>";
$surveysecurity.= viewHelper::getViewTestTag('surveyPermissions');

$surveysecurity .="<h3>".gT("Survey permissions")."</h3>\n";
$surveysecurity .= '<div class="row"><div class="col-lg-12 content-right">';
$result2 = Permission::model()->getUserDetails($iSurveyID);
Expand Down
9 changes: 9 additions & 0 deletions application/helpers/viewHelper.php
Expand Up @@ -307,4 +307,13 @@ public static function getLanguageData($bOrderByNative=false,$sLanguageCode='en'
Yii::app()->loadHelper("surveytranslator");
return getLanguageData($bOrderByNative, $sLanguageCode );
}

/**
* Get a tag to help automated tests identify pages
* @param string $name unique view name
* @return string
*/
public static function getViewTestTag($name){
return CHtml::tag('div',['id'=>'action::'.$name,'style'=>'']);
}
}
4 changes: 4 additions & 0 deletions application/views/admin/authentication/login.php
Expand Up @@ -2,6 +2,10 @@
/**
* Login Form
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('login');

?>
<noscript>If you see this you have probably JavaScript deactivated. LimeSurvey does not work without Javascript being activated in the browser!</noscript>
<div class="container-fluid welcome">
Expand Down
7 changes: 7 additions & 0 deletions application/views/admin/checkintegrity/check_view.php
@@ -1,3 +1,10 @@
<?php
/* @var $dataProvider CActiveDataProvider */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('checkIntegrity');

?>
<div class="pagetitle h3"><?php eT("Check data integrity");?></div>

<div class="row" style="margin-bottom: 100px">
Expand Down
10 changes: 10 additions & 0 deletions application/views/admin/dataentry/content_view.php
@@ -1,3 +1,13 @@
<?php
/**
* @var $this AdminController
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('dataEntryView');

?>

<!-- content_view.php -->

<!-- explanation -->
Expand Down
Expand Up @@ -7,8 +7,12 @@
App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'emailtemplates.js');
App()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . 'popup-dialog.css');
$count=0;
?>

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyEmailTemplates');


?>
<script type='text/javascript'>
var sReplaceTextConfirmation='<?php eT("This will replace the existing text. Continue?","js"); ?>';
var sKCFinderLanguage='<?php echo sTranslateLangCode2CK(App()->language); ?>';
Expand Down
5 changes: 5 additions & 0 deletions application/views/admin/export/exportresults_view.php
@@ -1,7 +1,12 @@
<?php
/**
* Export result view
* @var AdminController $this
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('exportResults');

?>
<script type="text/javascript">
var sMsgColumnCount = '<?php eT("%s of %s columns selected",'js'); ?>';
Expand Down
10 changes: 10 additions & 0 deletions application/views/admin/export/spss_view.php
@@ -1,3 +1,13 @@
<?php
/**
* Export results to SPSS view
* @var AdminController $this
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('exportSpss');

?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<h3><?php eT("Export response data to SPSS");?></h3>
<?php echo CHtml::form(array("admin/export/sa/exportspss/sid/{$surveyid}/"), 'post', array('id'=>'exportspss', 'class'=>''));?>
Expand Down
5 changes: 4 additions & 1 deletion application/views/admin/export/statistics_view.php
Expand Up @@ -4,8 +4,11 @@
* @var AdminController $this
* @var Survey $oSurvey
*/
?>

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('statisticsIndex');

?>
<!-- Javascript variables -->
<?php $this->renderPartial('/admin/export/statistics_subviews/_statistics_view_scripts', array('sStatisticsLanguage'=>$sStatisticsLanguage, 'surveyid'=>$surveyid, 'showtextinline'=>$showtextinline)) ; ?>

Expand Down
@@ -1,3 +1,10 @@
<?php
/* @var $this AdminController */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('expressionsConditions2Relevance');
?>

<?php
$data = LimeExpressionManager::UnitTestConvertConditionsToRelevance();
echo count($data) . " question(s) in your database contain conditions. Below is the mapping of question ID number to generated relevance equation<br/>";
Expand Down
8 changes: 8 additions & 0 deletions application/views/admin/expressions/test/functions.php
@@ -1,3 +1,11 @@
<?php
/* @var $this AdminController */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('expressionsFunctions');

?>

<?php
echo ExpressionManager::ShowAllowableFunctions();
?>
8 changes: 8 additions & 0 deletions application/views/admin/expressions/test/navigation_test.php
@@ -1,3 +1,11 @@
<?php
/* @var $this AdminController */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('expressionsNavigationTest');
?>


<?php
if (count($_POST) == 0) {

Expand Down
7 changes: 7 additions & 0 deletions application/views/admin/expressions/test/relevance.php
@@ -1,3 +1,10 @@
<?php
/* @var $this AdminController */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('expressionsRelevance');
?>

<?php
LimeExpressionManager::UnitTestRelevance();
?>
@@ -1,3 +1,11 @@
<?php
/* @var $this AdminController */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('expressionsStrings');

?>

<?php
LimeExpressionManager::UnitTestProcessStringContainingExpressions();
?>
Expand Up @@ -5,6 +5,9 @@
* @var Survey $oSurvey
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyLogicFile');

$fullPage = (isset($surveyid))?false:true;
?>

Expand All @@ -18,7 +21,6 @@
<div class="col-lg-12 content-right">



<?php
// if (count($_GET) > 0) {
// foreach ($_GET as $key=>$val) {
Expand Down
8 changes: 8 additions & 0 deletions application/views/admin/expressions/test_view.php
@@ -1,3 +1,11 @@
<?php
/* @var $this AdminController */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('expressionsTest');

?>

<table class="table table-striped ">
<thead>
<tr>
Expand Down
10 changes: 9 additions & 1 deletion application/views/admin/globalSettings_view.php
@@ -1,5 +1,13 @@
<?php
App()->getClientScript()->registerPackage('jquery-selectboxes');
/**
* @var $tgis AdminController
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('globalsettings');

App()->getClientScript()->registerPackage('jquery-selectboxes');

?>
<script type="text/javascript">
var msgCantRemoveDefaultLanguage = '<?php eT("You can't remove the default language.",'js'); ?>';
Expand Down
9 changes: 9 additions & 0 deletions application/views/admin/labels/editlabel_view.php
@@ -1,3 +1,9 @@
<?php
/**
* @var $tgis AdminController
*/
?>

<script type="text/javascript">
var sImageURL = '';
var duplicatelabelcode='<?php eT('Error: You are trying to use duplicate label codes.','js'); ?>';
Expand All @@ -7,6 +13,9 @@

<div class="col-lg-12 list-surveys">
<h3><?php if ($action == "newlabelset") { eT("Create or import new label set(s)");} else {eT("Edit label set"); } ?></h3>
<?=// DO NOT REMOVE This is for automated testing to validate we see that page
viewHelper::getViewTestTag('createLabelSets');?>


<div class="row">
<div class="col-lg-12 content-right">
Expand Down
7 changes: 6 additions & 1 deletion application/views/admin/labels/labelsets_view.php
Expand Up @@ -3,8 +3,13 @@
* This file render the list of label sets
* It use the Label Sets model getAllRecords method to build the data provider.
*
* @var $model obj the LabelSets model
* @var $this AdminController
* @var LabelSet $model the LabelSets model
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('viewLabelSets');

?>
<?php $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);?>
<div class="col-lg-12">
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/pluginmanager/index.php
Expand Up @@ -9,7 +9,7 @@

?>
<?php $pageSize = intval(Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize'])); ?>

z
<div class="pagetitle h3"><?php eT('Plugin manager'); ?></div>
<div style="width: 75%; margin: auto;">
<div id="ls_action_changestate_form_container">
Expand Down
4 changes: 4 additions & 0 deletions application/views/admin/quotas/newquota_view.php
Expand Up @@ -3,6 +3,10 @@
/* @var string $lang */
/* @var Quota $oQuota */
/* @var QuotaLanguageSetting[] $aQuotaLanguageSettings */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('addQuota');

?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class='col-lg-8'>
Expand Down
3 changes: 3 additions & 0 deletions application/views/admin/quotas/viewquotas_view.php
Expand Up @@ -12,8 +12,11 @@
/* @var Quota $oQuota The last Quota as base for Massive edits */
/* @var QuotaLanguageSetting[] $aQuotaLanguageSettings The last Quota LanguageSettings */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyQuotas');

?>

<!-- To update grid when pageSize is changed -->
<script type="text/javascript">
$(document).ready(function() {
Expand Down
5 changes: 5 additions & 0 deletions application/views/admin/responses/browseindex_view.php
@@ -1,7 +1,12 @@
<?php
/**
* @var $this AdminController
* Response Summary view
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyResponsesIndex');

?>
<div class='side-body <?php echo getSideBodyClass(true); ?>'>
<h3><?php eT("Response summary"); ?></h3>
Expand Down
9 changes: 9 additions & 0 deletions application/views/admin/responses/listResponses_view.php
@@ -1,3 +1,12 @@
<?php
/**
* @var $this AdminController
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyResponsesBrowse');

?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<h3><?php eT('Survey responses'); ?></h3>

Expand Down
3 changes: 3 additions & 0 deletions application/views/admin/super/welcome.php
Expand Up @@ -3,6 +3,9 @@
* The welcome page is the home page
* TODO : make a recursive function, taking any number of box in the database, calculating how much rows are needed.
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('index');
?>

<?php
Expand Down
4 changes: 4 additions & 0 deletions application/views/admin/survey/Question/editQuestion_view.php
Expand Up @@ -2,6 +2,10 @@
/* @var $this AdminController */
/* @var QuestionGroup $oQuestionGroup */
/* @var Survey $oSurvey */

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('addQuestion');

?>
<?php PrepareEditorScript(true, $this); ?>
<?php $this->renderPartial("./survey/Question/question_subviews/_ajax_variables", $ajaxDatas); ?>
Expand Down
@@ -1,7 +1,12 @@
<?php
/**
* Add a group to survey
* @var AdminController $this
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('addQuestionGroup');

?>

<!-- addGroup -->
Expand Down
@@ -1,7 +1,11 @@
<?php
/**
* Import a group view
* @var AdminController $this
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('importQuestionGroup');
?>

<div id='edit-survey-text-element' class='side-body <?php echo getSideBodyClass(false); ?>'>
Expand Down
Expand Up @@ -7,8 +7,11 @@
*/

$templateData['oSurvey'] = $oSurvey;
?>

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('surveyGeneralSettings');

?>
<script type="text/javascript">
var formId = '<?=$entryData['name']?>';
</script>
Expand Down

0 comments on commit b2266be

Please sign in to comment.