scouting: Add "defense received" and "comments" to the database
This patch makes it so the webserver saves the "defense received" and
"comment" fields to the database.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I3a76518095f7b38360b5c43ae3a117215244c3da
diff --git a/scouting/scouting_test.ts b/scouting/scouting_test.ts
index 84824ff..6fab5fc 100644
--- a/scouting/scouting_test.ts
+++ b/scouting/scouting_test.ts
@@ -65,6 +65,18 @@
protractor.Key.CONTROL, 'a', protractor.Key.NULL, value);
}
+// Moves the nth slider left or right. A positive "adjustBy" value moves the
+// slider to the right. A negative value moves the slider to the left.
+//
+// negative/left <--- 0 ---> positive/right
+async function adjustNthSliderBy(n: number, adjustBy: number) {
+ const slider = element.all(by.css('input[type=range]')).get(n);
+ const key = adjustBy > 0 ? protractor.Key.ARROW_RIGHT : protractor.Key.ARROW_LEFT;
+ for (let i = 0; i < Math.abs(adjustBy); i++) {
+ await slider.sendKeys(key);
+ }
+}
+
describe('The scouting web page', () => {
beforeAll(async () => {
await browser.get(browser.baseUrl);
@@ -128,9 +140,12 @@
expect(await getHeadingText()).toEqual('Climb');
await element(by.id('high')).click();
+ await setTextboxByIdTo("comment", "A very useful comment here.");
await element(by.buttonText('Next')).click();
expect(await getHeadingText()).toEqual('Other');
+ await adjustNthSliderBy(0, 3);
+ await adjustNthSliderBy(1, 1);
await element(by.id('no_show')).click();
await element(by.id('mechanically_broke')).click();
await element(by.buttonText('Next')).click();
@@ -155,10 +170,11 @@
// Validate Climb.
await expectReviewFieldToBe('Level', 'High');
+ await expectReviewFieldToBe('Comments', 'A very useful comment here.');
// Validate Other.
- await expectReviewFieldToBe('Defense Played On Rating', '0');
- await expectReviewFieldToBe('Defense Played Rating', '0');
+ await expectReviewFieldToBe('Defense Played On Rating', '3');
+ await expectReviewFieldToBe('Defense Played Rating', '1');
await expectReviewFieldToBe('No show', 'true');
await expectReviewFieldToBe('Never moved', 'false');
await expectReviewFieldToBe('Battery died', 'false');