Scouting App: Add test for note scouting
Add a protractor test to scouting_test.ts to test if you can add notes and select
keywords for multiple teams.
Signed-off-by: Filip Kujawa <filip.j.kujawa@gmail.com>
Change-Id: I0e9f167a1875cdadd8da723121ac7e9c27ac9f9f
diff --git a/scouting/scouting_test.ts b/scouting/scouting_test.ts
index a34d98c..e54a237 100644
--- a/scouting/scouting_test.ts
+++ b/scouting/scouting_test.ts
@@ -322,4 +322,36 @@
await element(by.buttonText('Flip')).click();
}
});
+
+ it('should: submit note scouting for multiple teams', async () => {
+ // Navigate to Notes Page.
+ await loadPage();
+ await element(by.cssContainingText('.nav-link', 'Notes')).click();
+ expect(await element(by.id('page-title')).getText()).toEqual('Notes');
+
+ // Add first team.
+ await setTextboxByIdTo('team_number_notes', '1234');
+ await element(by.buttonText('Select')).click();
+
+ // Add note and select keyword for first team.
+ expect(await element(by.id('team-key-1')).getText()).toEqual('1234');
+ await element(by.id('text-input-1')).sendKeys('Good Driving');
+ await element(by.id('Good Driving_0')).click();
+
+ // Navigate to add team selection and add another team.
+ await element(by.id('add-team-button')).click();
+ await setTextboxByIdTo('team_number_notes', '1235');
+ await element(by.buttonText('Select')).click();
+
+ // Add note and select keyword for second team.
+ expect(await element(by.id('team-key-2')).getText()).toEqual('1235');
+ await element(by.id('text-input-2')).sendKeys('Bad Driving');
+ await element(by.id('Bad Driving_1')).click();
+
+ // Submit Notes.
+ await element(by.buttonText('Submit')).click();
+ expect(await element(by.id('team_number_label')).getText()).toEqual(
+ 'Team Number'
+ );
+ });
});
diff --git a/scouting/www/notes/notes.ng.html b/scouting/www/notes/notes.ng.html
index af48fd9..8170801 100644
--- a/scouting/www/notes/notes.ng.html
+++ b/scouting/www/notes/notes.ng.html
@@ -1,8 +1,10 @@
-<h2>Notes</h2>
+<h2 id="page-title">Notes</h2>
<ng-container [ngSwitch]="section">
<div *ngSwitchCase="'TeamSelection'">
- <label class="label" for="team_number_notes">Team Number</label>
+ <label id="team_number_label" class="label" for="team_number_notes">
+ Team Number
+ </label>
<input
[(ngModel)]="teamNumberSelection"
type="number"
@@ -26,11 +28,12 @@
<!--X Symbol-->
</button>
</div>
- <div><h3>{{team.teamNumber}}</h3></div>
+ <div><h3 id="team-key-{{i+1}}">{{team.teamNumber}}</h3></div>
</div>
<div class="">
<textarea
class="text-input"
+ id="text-input-{{i+1}}"
[(ngModel)]="newData[i].notesData"
></textarea>
</div>
@@ -86,10 +89,22 @@
</div>
<div class="d-flex flex-row justify-content-center pt-2">
<div>
- <button class="btn btn-secondary" (click)="addTeam()">Add team</button>
+ <button
+ id="add-team-button"
+ class="btn btn-secondary"
+ (click)="addTeam()"
+ >
+ Add team
+ </button>
</div>
<div>
- <button class="btn btn-success" (click)="submitData()">Submit</button>
+ <button
+ id="submit-button"
+ class="btn btn-success"
+ (click)="submitData()"
+ >
+ Submit
+ </button>
</div>
</div>
</div>