Changeset c263588 in iPeer


Ignore:
Timestamp:
2013-06-05T15:27:40-07:00 (6 years ago)
Author:
mwytang <michael.tang@…>
Branches:
3.1.x, dev, master
Children:
59ecdef
Parents:
4901d1f
Message:

updated system tests including student_rubric

I have fixed rubrics view, which complained about an invalid variable
$event that is only used in the rubric evaluation form. I have also
updated some of the system tests to reflect minor changes made to
the interface.

I have added some new tests to student_rubric to reflect the changes
made. This include the new warning messages and unanswered likert
questions being marked red.

Location:
app
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • app/tests/cases/system/add_mixeval.test.php

    r4901d1f rc263588  
    3737        $this->assertEqual($title, 'Mixed Evaluations');
    3838       
    39         $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Add Mix Evaluation')->click();
     39        $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Add Mixed Evaluation')->click();
    4040        $title = $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, "h1.title")->text();
    4141        $this->assertEqual($title, 'Mixed Evaluations > Add');
  • app/tests/cases/system/home.test.php

    r4901d1f rc263588  
    22require_once('system_base.php');
    33
    4 class addEventTestCase extends SystemBaseTestCase
     4class homeTestCase extends SystemBaseTestCase
    55{   
    66    public function startCase()
  • app/tests/cases/system/student_rubric.test.php

    r4901d1f rc263588  
    7373        $pending = $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'div[class="eventSummary pending"]')->text();
    7474        // check that there is at least one pending event
    75         $this->assertEqual(substr($pending, -20), 'Pending Events Total');
     75        $this->assertEqual(substr($pending, -22), 'Pending Event(s) Total');
    7676        $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Rubric Evaluation')->click();
    7777       
    7878        // check saving answers alert
    7979        $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Home')->click();
    80         $this->session->dismiss_alert();
     80        $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Rubric Evaluation')->click();
    8181       
    8282        $comments = $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'font[color="red"]');
    83         $this->assertEqual($comments->text(), 'Must');
     83        $this->assertEqual($comments->text(), 'Required');
    8484       
    8585        // check penalty note
     
    9191        $this->assertTrue($submit->attribute('disabled'));
    9292       
     93        // check the questions are not in red
     94        $ques1 = $this->session->element(PHPWebDriver_WebDriverBy::ID, '6criteria1');
     95        $ques2 = $this->session->element(PHPWebDriver_WebDriverBy::ID, '6criteria2');
     96        $ques3 = $this->session->element(PHPWebDriver_WebDriverBy::ID, '6criteria3');
     97        $this->assertFalse($ques1->attribute('color'));
     98        $this->assertFalse($ques2->attribute('color'));
     99        $this->assertFalse($ques3->attribute('color'));
     100       
    93101        // Alex Student
    94102        $header = $this->session->element(PHPWebDriver_WebDriverBy::ID, 'panel6Header');
    95103        $this->assertEqual($header->text(), 'Alex Student - (click to expand)');
    96104        $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'input[onclick="document.evalForm.selected_lom_6_1.value=4;"]')->click();
    97         $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'input[onclick="document.evalForm.selected_lom_6_2.value=5;"]')->click();
    98105        $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'input[onclick="document.evalForm.selected_lom_6_3.value=5;"]')->click();
    99106        $comments = $this->session->elements(PHPWebDriver_WebDriverBy::NAME, '6comments[]');
    100         $comments[0]->sendKeys('participated lots');
    101107        $comments[1]->sendKeys('very co-operative');
    102108        $comments[2]->sendKeys('very punctual');
     
    104110        $this->session->element(PHPWebDriver_WebDriverBy::NAME, '6')->click();
    105111       
     112        // check that only the second ques is marked red
     113        $ques1 = $this->session->element(PHPWebDriver_WebDriverBy::ID, '6criteria1');
     114        $ques2 = $this->session->element(PHPWebDriver_WebDriverBy::ID, '6criteria2');
     115        $ques3 = $this->session->element(PHPWebDriver_WebDriverBy::ID, '6criteria3');
     116        $this->assertFalse($ques1->attribute('color'));
     117        $this->assertEqual($ques2->attribute('color'), 'red');
     118        $this->assertFalse($ques3->attribute('color'));
     119        // warning message
     120        $msg = $this->session->element(PHPWebDriver_WebDriverBy::ID, '6likert');
     121        $this->assertEqual($msg->text(), 'Please complete all the questions marked red before saving.');
     122       
     123        // answer question 2 + save
     124        $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'input[onclick="document.evalForm.selected_lom_6_2.value=5;"]')->click();
     125        $this->session->element(PHPWebDriver_WebDriverBy::NAME, '6')->click();
     126        $w = new PHPWebDriver_WebDriverWait($this->session);
     127        $session = $this->session;
     128        $w->until(
     129            function($session) {
     130                return count($session->elements(PHPWebDriver_WebDriverBy::ID, "flashMessage"));
     131            }
     132        );
     133        $msg = $this->session->element(PHPWebDriver_WebDriverBy::ID, 'flashMessage')->text();
     134        $expect = 'Your evaluation has been saved, but some comments are missing and you still '.
     135            'have to submit the evaluation with the Submit button below.';
     136        $this->assertEqual($msg, $expect);
     137        $this->session->open($this->session->url()); // clear message by refreshing the page
     138
     139        // fill in first comment
     140        $comment = $this->session->element(PHPWebDriver_WebDriverBy::NAME, '6comments[]');
     141        $comment->sendKeys('participated lots');
     142        $this->session->element(PHPWebDriver_WebDriverBy::NAME, '6')->click();
     143        $w->until(
     144            function($session) {
     145                return count($session->elements(PHPWebDriver_WebDriverBy::ID, "flashMessage"));
     146            }
     147        );
     148        $msg = $this->session->element(PHPWebDriver_WebDriverBy::ID, 'flashMessage')->text();
     149        $expect = 'Your evaluation has been saved, but you still have to submit the evaluation with the Submit button below.';
     150        $this->assertEqual($msg, $expect);
     151
    106152        // check the evaluation for Alex is saved
    107153        $header = $this->session->element(PHPWebDriver_WebDriverBy::ID, 'panel6Header');
     
    133179        $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'input[value="Submit to Complete the Evaluation"]')->click();
    134180
    135         $w = new PHPWebDriver_WebDriverWait($this->session);
    136         $session = $this->session;
    137181        $w->until(
    138182            function($session) {
     
    154198        $comments[0]->sendKeys('very active in the group');
    155199        $comments[1]->clear();
    156         $comments[1]->sendKeys('easy to work with');
    157200        $comments[2]->clear();
    158201        $comments[2]->sendKeys('hands in their work on time');
     
    161204        $this->session->element(PHPWebDriver_WebDriverBy::NAME, '6')->click();
    162205       
     206        $w = new PHPWebDriver_WebDriverWait($this->session);
     207        $session = $this->session;
     208        $w->until(
     209            function($session) {
     210                return count($session->elements(PHPWebDriver_WebDriverBy::ID, "flashMessage"));
     211            }
     212        );
     213        $msg = $this->session->element(PHPWebDriver_WebDriverBy::ID, 'flashMessage')->text();
     214        $this->assertEqual($msg, 'Your evaluation has been saved, but some comments are missing.');
     215        $this->session->open($this->session->url());
     216
     217        $comments = $this->session->elements(PHPWebDriver_WebDriverBy::NAME, '6comments[]');
     218        $comments[1]->sendKeys('easy to work with');
     219        $this->session->element(PHPWebDriver_WebDriverBy::NAME, '6')->click();
     220        $w->until(
     221            function($session) {
     222                return count($session->elements(PHPWebDriver_WebDriverBy::ID, "flashMessage"));
     223            }
     224        );
     225        $msg = $this->session->element(PHPWebDriver_WebDriverBy::ID, 'flashMessage')->text();
     226        $this->assertEqual($msg, 'Your evaluation has been saved.');
     227       
    163228        $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Home')->click();
    164         $this->session->accept_alert();
    165229       
    166230        $this->secondStudent();
     
    662726        // check Ed's results
    663727        $this->session->open($this->url);
    664         $this->session->accept_alert();
    665728        $this->logoutLogin('redshirt0001');
    666729        $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Rubric Evaluation')->click();
  • app/tests/cases/system/student_simple.test.php

    r4901d1f rc263588  
    7575        $pending = $this->session->element(PHPWebDriver_WebDriverBy::CSS_SELECTOR, 'div[class="eventSummary pending"]')->text();
    7676        // check that there is at least one pending event
    77         $this->assertEqual(substr($pending, -20), 'Pending Events Total');
     77        $this->assertEqual(substr($pending, -22), 'Pending Event(s) Total');
    7878       
    7979        $this->session->element(PHPWebDriver_WebDriverBy::LINK_TEXT, 'Simple Evaluation')->click();
  • app/views/elements/rubrics/ajax_rubric_view.ctp

    r4901d1f rc263588  
    77isset($user)? $userId = $user['id'] : $userId = '';
    88isset($user['Evaluation'])? $evaluation = $user['Evaluation'] : $evaluation = null;
    9 $reqCom = $event['Event']['com_req'] ? '<br><font color="red">('.__('required', true).')</font>' : '';
     9$reqCom = isset($event) && $event['Event']['com_req'] ? '<br><font color="red">('.__('required', true).')</font>' : '';
    1010?>
    1111<table class="standardtable">
Note: See TracChangeset for help on using the changeset viewer.