Scouting App: Add Keyboard Shortcut tests
Add a test to scouting_test.ts that checks if switching between
note scouting text boxes with keyboard shortcuts (ex. ctrl + 1) works.
Signed-off-by: Filip Kujawa <filip.j.kujawa@gmail.com>
Change-Id: Iaecb1fe707f8784d8927ac9628d831062823efc2
diff --git a/scouting/scouting_test.ts b/scouting/scouting_test.ts
index 15a0509..93423f6 100644
--- a/scouting/scouting_test.ts
+++ b/scouting/scouting_test.ts
@@ -354,4 +354,41 @@
'Team Number'
);
});
+
+ it('should: switch note text boxes with keyboard shortcuts', 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 second team.
+ await element(by.id('add-team-button')).click();
+ await setTextboxByIdTo('team_number_notes', '1235');
+ await element(by.buttonText('Select')).click();
+
+ // Add third team.
+ await element(by.id('add-team-button')).click();
+ await setTextboxByIdTo('team_number_notes', '1236');
+ await element(by.buttonText('Select')).click();
+
+ for (let i = 1; i <= 3; i++) {
+ // Press Control + i
+ // Keyup Control for future actions.
+ browser
+ .actions()
+ .keyDown(protractor.Key.CONTROL)
+ .sendKeys(i.toString())
+ .keyUp(protractor.Key.CONTROL)
+ .perform();
+
+ // Expect text input to be focused.
+ expect(
+ await browser.driver.switchTo().activeElement().getAttribute('id')
+ ).toEqual('text-input-' + i);
+ }
+ });
});