Run `prettier` on //scouting
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Idbb6011040f44d2b6c4158bf4c84a37818f258a5
diff --git a/scouting/scouting_test.ts b/scouting/scouting_test.ts
index 9a7ecc6..98e1d00 100644
--- a/scouting/scouting_test.ts
+++ b/scouting/scouting_test.ts
@@ -7,7 +7,7 @@
async function loadPage() {
await disableAlerts();
await browser.navigate().refresh();
- expect((await browser.getTitle())).toEqual('FRC971 Scouting Application');
+ expect(await browser.getTitle()).toEqual('FRC971 Scouting Application');
await disableAlerts();
}
@@ -15,9 +15,10 @@
// Protractor since they're not angular elements. We achieve this by checking
// an invisible checkbox that's off-screen.
async function disableAlerts() {
- await browser.executeAsyncScript(function(callback) {
- let block_alerts =
- document.getElementById('block_alerts') as HTMLInputElement;
+ await browser.executeAsyncScript(function (callback) {
+ let block_alerts = document.getElementById(
+ 'block_alerts'
+ ) as HTMLInputElement;
block_alerts.checked = true;
callback();
});
@@ -49,11 +50,16 @@
// Asserts that the n'th instance of a field on the "Submit and Review"
// screen has a specific value.
async function expectNthReviewFieldToBe(
- fieldName: string, n: number, expectedValue: string) {
- expect(await element.all(by.cssContainingText('li', `${fieldName}:`))
- .get(n)
- .getText())
- .toEqual(`${fieldName}: ${expectedValue}`);
+ fieldName: string,
+ n: number,
+ expectedValue: string
+) {
+ expect(
+ await element
+ .all(by.cssContainingText('li', `${fieldName}:`))
+ .get(n)
+ .getText()
+ ).toEqual(`${fieldName}: ${expectedValue}`);
}
// Sets a text field to the specified value.
@@ -62,7 +68,11 @@
// overwrite the text that is there. If we didn't hit CTRL-A to select all
// the text, we'd be appending to whatever is there already.
return element(by.id(id)).sendKeys(
- protractor.Key.CONTROL, 'a', protractor.Key.NULL, value);
+ protractor.Key.CONTROL,
+ 'a',
+ protractor.Key.NULL,
+ value
+ );
}
// Moves the nth slider left or right. A positive "adjustBy" value moves the
@@ -72,7 +82,7 @@
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;
+ adjustBy > 0 ? protractor.Key.ARROW_RIGHT : protractor.Key.ARROW_LEFT;
for (let i = 0; i < Math.abs(adjustBy); i++) {
await slider.sendKeys(key);
}
@@ -85,22 +95,26 @@
describe('The scouting web page', () => {
beforeAll(async () => {
await browser.get(browser.baseUrl);
- expect((await browser.getTitle())).toEqual('FRC971 Scouting Application');
+ expect(await browser.getTitle()).toEqual('FRC971 Scouting Application');
await disableAlerts();
// Import the match list before running any tests. Ideally this should be
// run in beforeEach(), but it's not worth doing that at this time. Our
// tests are basic enough not to require this.
- await element(by.cssContainingText('.nav-link', 'Import Match List'))
- .click();
+ await element(
+ by.cssContainingText('.nav-link', 'Import Match List')
+ ).click();
expect(await getHeadingText()).toEqual('Import Match List');
await setTextboxByIdTo('year', '2016');
await setTextboxByIdTo('event_code', 'nytr');
await element(by.buttonText('Import')).click();
- await browser.wait(EC.textToBePresentInElement(
+ await browser.wait(
+ EC.textToBePresentInElement(
element(by.css('.progress_message')),
- 'Successfully imported match list.'));
+ 'Successfully imported match list.'
+ )
+ );
});
it('should: show matches in chronological order.', async () => {
@@ -133,8 +147,9 @@
// Attempt to submit and validate the error.
await element(by.buttonText('Submit')).click();
- expect(await getErrorMessage())
- .toContain('Failed to find team 971 in match 3 in the schedule.');
+ expect(await getErrorMessage()).toContain(
+ 'Failed to find team 971 in match 3 in the schedule.'
+ );
});
// Make sure that each page on the Entry tab has both "Next" and "Back"
@@ -164,8 +179,9 @@
// Go backwards through the screens.
for (let i = 0; i < expectedOrder.length; i++) {
- expect(await getHeadingText())
- .toEqual(expectedOrder[expectedOrder.length - i - 1]);
+ expect(await getHeadingText()).toEqual(
+ expectedOrder[expectedOrder.length - i - 1]
+ );
if (i != expectedOrder.length - 1) {
await element(by.buttonText('Back')).click();
}
@@ -234,7 +250,8 @@
await element(by.buttonText('Submit')).click();
await browser.wait(
- EC.textToBePresentInElement(element(by.css('.header')), 'Success'));
+ EC.textToBePresentInElement(element(by.css('.header')), 'Success')
+ );
// TODO(phil): Make sure the data made its way to the database correctly.
});
@@ -251,18 +268,18 @@
// We expect 2 fully loaded images.
browser
- .executeAsyncScript(function(callback) {
- let images = document.getElementsByTagName('img');
- let numLoaded = 0;
- for (let i = 0; i < images.length; i += 1) {
- if (images[i].naturalWidth > 0) {
- numLoaded += 1;
- }
+ .executeAsyncScript(function (callback) {
+ let images = document.getElementsByTagName('img');
+ let numLoaded = 0;
+ for (let i = 0; i < images.length; i += 1) {
+ if (images[i].naturalWidth > 0) {
+ numLoaded += 1;
}
- callback(numLoaded);
- })
- .then(function(numLoaded) {
- expect(numLoaded).toBe(2);
- });
+ }
+ callback(numLoaded);
+ })
+ .then(function (numLoaded) {
+ expect(numLoaded).toBe(2);
+ });
});
});