Skip to content

Commit

Permalink
testAddQuestion
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson committed Jan 1, 2018
1 parent 575d562 commit b3c9304
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
10 changes: 10 additions & 0 deletions application/views/admin/survey/Question/question_view.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<?php
/**
* @var AdminController $this
* @var Question $oQuestion
*/

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('questionSummary',$oQuestion->qid);
?>

<div class='side-body <?php echo getSideBodyClass(true); ?>'>
<div class="pagetitle h3"><?php eT('Question summary'); ?> <small><em><?php echo $qrrow['title'];?></em> (ID: <?php echo $qid;?>)</small></div>
<div class="row">
Expand Down
31 changes: 23 additions & 8 deletions tests/controllers/CreateSurveyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public function testAddGroup(){
// Click "Add group".
self::findAndClick(WebDriverBy::cssSelector('#panel-1 .panel-body-link a'), 10);


// Fill in group title.
$groupname = self::findAndClick(WebDriverBy::id('group_name_en'));
$groupname->clear()->sendKeys('group1');
Expand All @@ -156,6 +155,29 @@ public function testAddGroup(){
// find tag and assert
$element = $this->findViewTag('editGroup');
$this->assertNotEmpty($element);

self::findAndClick(WebDriverBy::id('save-and-close-button'));
}

/**
* @throws \Exception
*/
public function testAddQuestion(){

// Click "Add question".
self::findAndClick(WebDriverBy::id('panel-1'));

// Add question title.
$questionCode = self::find(WebDriverBy::id('title'));
$questionCode->sendKeys('Q1');

// Click save.
self::findAndClick(WebDriverBy::id('save-button'));

// find tag and assert
$element = $this->findViewTag('questionSummary');
$this->assertNotEmpty($element);

}

/**
Expand All @@ -176,15 +198,8 @@ public function testTheRest(){
// In case quick actions are hidden, show them.
self::findAndClick(WebDriverBy::cssSelector('#survey-action-chevron i.fa-caret-down'));

// Click "Add question".
self::findAndClick(WebDriverBy::cssSelector('#panel-2 .panel-body-link a'),5);
return;

// Add question title.
self::findAndClick(WebDriverBy::id('title'));

// Click save.
self::findAndClick(WebDriverBy::id('save-button'));

// Click "Overview".
self::findAndClick(WebDriverBy::id('sidemenu_1_1'));
Expand Down

0 comments on commit b3c9304

Please sign in to comment.