MOBILE-4176 grades: Test viewing grades

main
Noel De Martin 2022-11-16 12:16:36 +01:00
parent 36dfd856bb
commit 7661208862
5 changed files with 81 additions and 6 deletions

View File

@ -107,6 +107,7 @@ export class CoreSite {
'3.10': 2020110900, '3.10': 2020110900,
'3.11': 2021051700, '3.11': 2021051700,
'4.0': 2022041900, '4.0': 2022041900,
'4.1': 2022111100, // @todo [4.1] replace with right value when released. Using a tmp value to be able to test new things.
}; };
// Possible cache update frequencies. // Possible cache update frequencies.

View File

@ -27,7 +27,7 @@
</thead> </thead>
<tbody> <tbody>
<ng-container *ngFor="let row of rows"> <ng-container *ngFor="let row of rows">
<tr *ngIf="!useLegacyLayout && row.itemtype === 'leader'"> <tr *ngIf="row.itemtype === 'leader'">
<td [attr.rowspan]="row.rowspan" class="core-grades-table-leader"></td> <td [attr.rowspan]="row.rowspan" class="core-grades-table-leader"></td>
</tr> </tr>
<tr [attr.role]="row.expandable && showSummary ? 'button row' : 'row'" <tr [attr.role]="row.expandable && showSummary ? 'button row' : 'row'"
@ -35,10 +35,9 @@
[attr.aria-label]="rowAriaLabel(row)" [attr.aria-controls]="row.detailsid" [attr.aria-label]="rowAriaLabel(row)" [attr.aria-controls]="row.detailsid"
(ariaButtonClick)="row.expandable && showSummary && toggleRow(row)" [class]="row.rowclass" (ariaButtonClick)="row.expandable && showSummary && toggleRow(row)" [class]="row.rowclass"
[class.core-grades-grade-clickable]="row.expandable && showSummary" [id]="'grade-'+row.id" [class.core-grades-grade-clickable]="row.expandable && showSummary" [id]="'grade-'+row.id"
*ngIf="useLegacyLayout || row.itemtype !== 'leader'"> *ngIf="row.itemtype !== 'leader'">
<ng-container *ngIf="row.itemtype"> <ng-container *ngIf="row.itemtype">
<td *ngIf="!useLegacyLayout && row.itemtype == 'category'" class="core-grades-table-category" <td *ngIf="row.itemtype == 'category'" class="core-grades-table-category" [attr.rowspan]="row.rowspan">
[attr.rowspan]="row.rowspan">
</td> </td>
<th class="core-grades-table-gradeitem ion-text-start" [attr.colspan]="row.colspan"> <th class="core-grades-table-gradeitem ion-text-start" [attr.colspan]="row.colspan">
<ion-icon *ngIf="row.expandable && showSummary" aria-hidden="true" slot="start" name="fas-chevron-right" <ion-icon *ngIf="row.expandable && showSummary" aria-hidden="true" slot="start" name="fas-chevron-right"

View File

@ -54,8 +54,8 @@ export class CoreGradesCoursePage implements AfterViewInit, OnDestroy {
rows?: CoreGradesFormattedTableRow[]; rows?: CoreGradesFormattedTableRow[];
totalColumnsSpan?: number; totalColumnsSpan?: number;
withinSplitView?: boolean; withinSplitView?: boolean;
useLegacyLayout?: boolean; // Whether to use the layout before 4.1.
protected useLegacyLayout?: boolean; // Whether to use the layout before 4.1.
protected fetchSuccess = false; protected fetchSuccess = false;
constructor( constructor(

View File

@ -1,5 +1,5 @@
@app @javascript @app @javascript
Feature: Test grades navigation Feature: Grades navigation
Background: Background:
Given the following "users" exist: Given the following "users" exist:

View File

@ -0,0 +1,75 @@
@app @javascript
Feature: View grades
Background:
Given the following "users" exist:
| username | firstname | lastname |
| student1 | Student | first |
And the following "scales" exist:
| name | scale |
| Scale | Good, Bad |
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Category 1 | C1 |
| Category 2 | C1 |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Outcome | outcome | C1 | Scale |
And the following "grade items" exist:
| gradecategory | itemname | course | grademin | grademax |
| Category 1 | Item 1.1 | C1 | 60 | 80 |
| Category 1 | Item 1.2 | C1 | 10 | 90 |
| Category 2 | Item 2.1 | C1 | 0 | 100 |
And the following "activities" exist:
| gradecategory | name | course | activity | idnumber | grade | gradepass |
| Category 1 | Assignment 1 | C1 | assign | assign1 | 100 | 50 |
| Category 1 | Assignment 2 | C1 | assign | assign2 | 100 | 50 |
And the following "grade items" exist:
| gradecategory | itemname | course | outcome |
| Category 1 | Outcome | C1 | outcome |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Item 1.1 | student1 | 70 |
| Item 1.2 | student1 | 20 |
| Item 2.1 | student1 | 40 |
| Assignment 1 | student1 | 80 |
| Assignment 2 | student1 | 35 |
| Outcome | student1 | 1 |
And the following config values are set as admin:
| enableoutcomes | 1 |
Scenario: View individual grades and the grade report
Given I entered the course "Course 1" as "student1" in the app
When I press "Assignment 1" in the app
And I press "Information" in the app
Then I should find "80" within "Gradebook" "ion-list" in the app
When I press "Close" in the app
And I press the back button in the app
And I press "Assignment 2" in the app
And I press "Information" in the app
Then I should find "35" within "Gradebook" "ion-list" in the app
When I press "Close" in the app
And I press the back button in the app
And I press "Grades" in the app
Then I should find "Category 1" in the app
And I should find "70" within "Item 1.1" "tr" in the app
And I should find "20" within "Item 1.2" "tr" in the app
And I should find "80" within "Assignment 1" "tr" in the app
And I should find "Pass" within "Assignment 1" "tr" in the app
And I should find "35" within "Assignment 2" "tr" in the app
And I should find "Fail" within "Assignment 2" "tr" in the app
And I should find "Good" within "Outcome" "tr" in the app
And I should find "205" within "Category 1 total" "tr" in the app
And I should find "Category 2" in the app
And I should find "40" within "Item 2.1" "tr" in the app
And I should find "40" within "Category 2 total" "tr" in the app
And I should find "245" within "Course total" "tr" in the app