Unexpected function expression
15 driver.get('http://www.google.com');
16 var searchBox = driver.findElement(webdriver.By.name('q'));
17 searchBox.sendKeys('selenium node automation');
18 searchBox.getAttribute('value').then(function (value) {19 assert.equal(value, 'selenium node automation');20 });21 driver.quit();
22 });
23});
Unexpected function expression
8 webdriver = require('selenium-webdriver');
9// This is just a simple test to see if selenium can communicate with chrome.
10describe('Verify setup with Google Search', function () {
11 it('test case should work', function () {12 var driver = new webdriver.Builder()13 .withCapabilities(webdriver.Capabilities.chrome())14 .build();15 driver.get('http://www.google.com');16 var searchBox = driver.findElement(webdriver.By.name('q'));17 searchBox.sendKeys('selenium node automation');18 searchBox.getAttribute('value').then(function (value) {19 assert.equal(value, 'selenium node automation');20 });21 driver.quit();22 });23});
Unexpected function expression
7var assert = require('assert'),
8 webdriver = require('selenium-webdriver');
9// This is just a simple test to see if selenium can communicate with chrome.
10describe('Verify setup with Google Search', function () {11 it('test case should work', function () {12 var driver = new webdriver.Builder()13 .withCapabilities(webdriver.Capabilities.chrome())14 .build();15 driver.get('http://www.google.com');16 var searchBox = driver.findElement(webdriver.By.name('q'));17 searchBox.sendKeys('selenium node automation');18 searchBox.getAttribute('value').then(function (value) {19 assert.equal(value, 'selenium node automation');20 });21 driver.quit();22 });23});
Unexpected function expression
12 // eslint-disable-next-line no-unused-vars
13 let vars;
14
15 beforeEach(async function () {16 driver = new webdriver.Builder()17 .withCapabilities(webdriver.Capabilities.chrome())18 .build();19 vars = {};20 });21 afterEach(async function () {
22 await driver.quit();
23 });
Unexpected function expression
18 .build();
19 vars = {};
20 });
21 afterEach(async function () {22 await driver.quit();23 });24 jest.setTimeout(60000);
25 it('Makes an empty donation 2', async function () {
26 // Test name: Makes an empty donation 2
Unexpected function expression
7const { By } = require('selenium-webdriver'),
8 webdriver = require('selenium-webdriver');
9
10describe('Makes an empty donation 2', function () {11 let driver;12 // eslint-disable-next-line no-unused-vars13 let vars;1415 beforeEach(async function () {16 driver = new webdriver.Builder()17 .withCapabilities(webdriver.Capabilities.chrome())18 .build();19 vars = {};20 });21 afterEach(async function () {22 await driver.quit();23 });24 jest.setTimeout(60000);25 it('Makes an empty donation 2', async function () {26 // Test name: Makes an empty donation 227 // Step # | name | target | value28 // 1 | open | / |29 await driver.get('http://localhost:3000/');30 // 2 | setWindowSize | 1920x1080 |31 await driver.manage().window().setRect({ width: 1920, height: 1080 });32 // 3 | click | xpath=//div[@id='__next']/div/main/div/div[2]/div/div/div[3]/form/div/div[5]/select |33 await driver34 .findElement(35 By.xpath(36 "//div[@id='__next']/div/main/div/div[2]/div/div/div[3]/form/div/div[5]/select"37 )38 )39 .click();40 // 4 | click | xpath=//select |41 await driver.findElement(By.xpath('//select')).click();42 // 5 | select | xpath=//html/body/div[2]/div/main/div[1]/div[2]/div/div/div[3]/form/div/div[5]/select/option[2] | label=$543 {44 const dropdown = await driver.findElement(45 By.xpath(46 '/html/body/div[1]/div/main/div[1]/div[2]/div/div/div[3]/form/div/div[5]/select/option[2]'47 )48 );49 await dropdown.findElement(By.xpath("//option[. = '$5']")).click();50 }51 // 6 | click | xpath=//form/div/button |52 await driver.findElement(By.css('.btn-accent:nth-child(7)')).click();53 // 7 | webdriverChooseOkOnVisibleConfirmation | xpath=//body/div[4]/div/div |54 // await driver.switchTo().alert().accept();55 });56});
Unexpected function expression
22 await driver.quit();
23 });
24 jest.setTimeout(60000);
25 it('Makes an empty donation 2', async function () {26 // Test name: Makes an empty donation 227 // Step # | name | target | value28 // 1 | open | / |29 await driver.get('http://localhost:3000/');30 // 2 | setWindowSize | 1920x1080 |31 await driver.manage().window().setRect({ width: 1920, height: 1080 });32 // 3 | click | xpath=//div[@id='__next']/div/main/div/div[2]/div/div/div[3]/form/div/div[5]/select |33 await driver34 .findElement(35 By.xpath(36 "//div[@id='__next']/div/main/div/div[2]/div/div/div[3]/form/div/div[5]/select"37 )38 )39 .click();40 // 4 | click | xpath=//select |41 await driver.findElement(By.xpath('//select')).click();42 // 5 | select | xpath=//html/body/div[2]/div/main/div[1]/div[2]/div/div/div[3]/form/div/div[5]/select/option[2] | label=$543 {44 const dropdown = await driver.findElement(45 By.xpath(46 '/html/body/div[1]/div/main/div[1]/div[2]/div/div/div[3]/form/div/div[5]/select/option[2]'47 )48 );49 await dropdown.findElement(By.xpath("//option[. = '$5']")).click();50 }51 // 6 | click | xpath=//form/div/button |52 await driver.findElement(By.css('.btn-accent:nth-child(7)')).click();53 // 7 | webdriverChooseOkOnVisibleConfirmation | xpath=//body/div[4]/div/div |54 // await driver.switchTo().alert().accept();55 });56});
Unexpected function expression
6//
7import { Builder, By } from 'selenium-webdriver';
8
9describe('Makes an empty donation', function () {10 jest.setTimeout(60000);11 let driver;12 // eslint-disable-next-line no-unused-vars13 let vars;14 beforeEach(async function () {15 driver = await new Builder().forBrowser('chrome').build();16 vars = {};17 });18 afterEach(async function () {19 await driver.quit();20 });21 it('Makes an empty donation', async function () {22 // Test name: Makes an empty donation23 // Step # | name | target | value24 // 1 | open | / |25 await driver.get('http://localhost:3000/');26 // 2 | setWindowSize | 1920x1080 |27 await driver.manage().window().setRect({ width: 1920, height: 1080 });28 // 3 | click | xpath=//form/div/button |29 await driver.findElement(By.xpath('//form/div/button')).click();30 });31});
Unexpected function expression
18 afterEach(async function () {
19 await driver.quit();
20 });
21 it('Makes an empty donation', async function () {22 // Test name: Makes an empty donation23 // Step # | name | target | value24 // 1 | open | / |25 await driver.get('http://localhost:3000/');26 // 2 | setWindowSize | 1920x1080 |27 await driver.manage().window().setRect({ width: 1920, height: 1080 });28 // 3 | click | xpath=//form/div/button |29 await driver.findElement(By.xpath('//form/div/button')).click();30 });31});
Unexpected function expression
15 driver = await new Builder().forBrowser('chrome').build();
16 vars = {};
17 });
18 afterEach(async function () {19 await driver.quit();20 });21 it('Makes an empty donation', async function () {
22 // Test name: Makes an empty donation
23 // Step # | name | target | value
Unexpected function expression
11 let driver;
12 // eslint-disable-next-line no-unused-vars
13 let vars;
14 beforeEach(async function () {15 driver = await new Builder().forBrowser('chrome').build();16 vars = {};17 });18 afterEach(async function () {
19 await driver.quit();
20 });
Unexpected function expression
7import { Builder, By, until } from 'selenium-webdriver';
8import assert from 'assert';
9
10describe('Make a donation', function () { 11 jest.setTimeout(60000); 12 let driver; 13 // eslint-disable-next-line no-unused-vars 14 let vars; 15 beforeEach(async function () { 16 driver = await new Builder().forBrowser('chrome').build(); 17 vars = {}; 18 }); 19 afterEach(async function () { 20 await driver.quit(); 21 }); 22 it('Make a donation', async function () { 23 // Test name: Make a donation 24 // Step # | name | target | value 25 // 1 | open | / | 26 await driver.get('http://localhost:3000/'); 27 // 2 | setWindowSize | 1920x1080 | 28 await driver.manage().window().setRect({ width: 1920, height: 1080 }); 29 // 3 | click | xpath=//input | 30 await driver.findElement(By.xpath('//input')).click(); 31 // 4 | click | xpath=//label[contains(.,'People of Color in Need')] | 32 await driver 33 .findElement(By.xpath("//label[contains(.,'People of Color in Need')]")) 34 .click(); 35 // 5 | click | xpath=//label[contains(.,'Immigrants in Need')] | 36 await driver 37 .findElement(By.xpath("//label[contains(.,'Immigrants in Need')]")) 38 .click(); 39 // 6 | click | xpath=//label[contains(.,'Seniors in Need')] | 40 await driver 41 .findElement(By.xpath("//label[contains(.,'Seniors in Need')]")) 42 .click(); 43 // Apply timeout for 10 seconds 44 await driver.manage().setTimeouts({ implicit: 10000 }); 45 // 7 | click | xpath=//select | 46 await driver.findElement(By.xpath('//select')).click(); 47 // 8 | select | css=#amount and xpath=//option[. = '$5'] | label=$5 48 { 49 const dropdown = await driver.findElement(By.css('#amount')); 50 await dropdown.findElement(By.xpath("//option[. = '$5']")).click(); 51 } 52 // 9 | click | xpath=//form/div/button[2] | 53 await driver.findElement(By.xpath('//form/div/button[2]')).click(); 54 // 10 | click | xpath=//input[@id='email'] | 55 await driver.findElement(By.xpath("//input[@id='email']")).click(); 56 // 11 | type | xpath=//input[@id='email'] | [email protected] 57 await driver 58 .findElement(By.xpath("//input[@id='email']")) 59 .sendKeys('[email protected]'); 60 // 12 | click | xpath=//div[@id='cardNumber-fieldset']/div/div/div/span/input | 61 await driver 62 .findElement( 63 By.xpath("//div[@id='cardNumber-fieldset']/div/div/div/span/input") 64 ) 65 .click(); 66 // 13 | type | xpath=//fieldset/div/div/div/div/span/input | 6011 1111 1111 1117 67 await driver 68 .findElement(By.xpath('//fieldset/div/div/div/div/span/input')) 69 .sendKeys('6011 1111 1111 1117'); 70 // 14 | type | xpath=//div[@id='cardNumber-fieldset']/div[2]/div/div/span/input | 11 / 26 71 await driver 72 .findElement( 73 By.xpath("//div[@id='cardNumber-fieldset']/div[2]/div/div/span/input") 74 ) 75 .sendKeys('11 / 26'); 76 // 15 | type | xpath=//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input | 123 77 await driver 78 .findElement( 79 By.xpath("//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input") 80 ) 81 .sendKeys('123'); 82 // 16 | type | xpath=//div[3]/div/div/div/div/div[2]/div/div/div/div/span/input | Francisco 83 await driver 84 .findElement( 85 By.xpath('//div[3]/div/div/div/div/div[2]/div/div/div/div/span/input') 86 ) 87 .sendKeys('Francisco'); 88 // 17 | click | xpath=//div[3]/div/div/span/input | 89 await driver.findElement(By.xpath('//div[3]/div/div/span/input')).click(); 90 // 18 | click | xpath=//div[@id='root']/div/div/div[2]/div/div[2]/form/div[2]/div[2]/button/div[3] | 91 await driver 92 .findElement( 93 By.xpath( 94 "//div[@id='root']/div/div/div[2]/div/div[2]/form/div[2]/div[2]/button/div[3]" 95 ) 96 ) 97 .click(); 98 // 19 | waitForElementPresent | xpath=//h1[contains(.,'Thank You!')] | 60000 99 await driver.wait(100 until.elementLocated(By.xpath("//h1[contains(.,'Thank You!')]")),101 60000102 );103 // 20 | assertText | //*[@id="__next"]/html/body/div/div[1]/div/div/h1 | Thank You!104 assert(105 (await driver106 .findElement(107 By.xpath('//*[@id="__next"]/html/body/div/div[1]/div/div/h1')108 )109 .getText()) == 'Thank You!'110 );111 });112});
Unexpected function expression
19 afterEach(async function () {
20 await driver.quit();
21 });
22 it('Make a donation', async function () { 23 // Test name: Make a donation 24 // Step # | name | target | value 25 // 1 | open | / | 26 await driver.get('http://localhost:3000/'); 27 // 2 | setWindowSize | 1920x1080 | 28 await driver.manage().window().setRect({ width: 1920, height: 1080 }); 29 // 3 | click | xpath=//input | 30 await driver.findElement(By.xpath('//input')).click(); 31 // 4 | click | xpath=//label[contains(.,'People of Color in Need')] | 32 await driver 33 .findElement(By.xpath("//label[contains(.,'People of Color in Need')]")) 34 .click(); 35 // 5 | click | xpath=//label[contains(.,'Immigrants in Need')] | 36 await driver 37 .findElement(By.xpath("//label[contains(.,'Immigrants in Need')]")) 38 .click(); 39 // 6 | click | xpath=//label[contains(.,'Seniors in Need')] | 40 await driver 41 .findElement(By.xpath("//label[contains(.,'Seniors in Need')]")) 42 .click(); 43 // Apply timeout for 10 seconds 44 await driver.manage().setTimeouts({ implicit: 10000 }); 45 // 7 | click | xpath=//select | 46 await driver.findElement(By.xpath('//select')).click(); 47 // 8 | select | css=#amount and xpath=//option[. = '$5'] | label=$5 48 { 49 const dropdown = await driver.findElement(By.css('#amount')); 50 await dropdown.findElement(By.xpath("//option[. = '$5']")).click(); 51 } 52 // 9 | click | xpath=//form/div/button[2] | 53 await driver.findElement(By.xpath('//form/div/button[2]')).click(); 54 // 10 | click | xpath=//input[@id='email'] | 55 await driver.findElement(By.xpath("//input[@id='email']")).click(); 56 // 11 | type | xpath=//input[@id='email'] | [email protected] 57 await driver 58 .findElement(By.xpath("//input[@id='email']")) 59 .sendKeys('[email protected]'); 60 // 12 | click | xpath=//div[@id='cardNumber-fieldset']/div/div/div/span/input | 61 await driver 62 .findElement( 63 By.xpath("//div[@id='cardNumber-fieldset']/div/div/div/span/input") 64 ) 65 .click(); 66 // 13 | type | xpath=//fieldset/div/div/div/div/span/input | 6011 1111 1111 1117 67 await driver 68 .findElement(By.xpath('//fieldset/div/div/div/div/span/input')) 69 .sendKeys('6011 1111 1111 1117'); 70 // 14 | type | xpath=//div[@id='cardNumber-fieldset']/div[2]/div/div/span/input | 11 / 26 71 await driver 72 .findElement( 73 By.xpath("//div[@id='cardNumber-fieldset']/div[2]/div/div/span/input") 74 ) 75 .sendKeys('11 / 26'); 76 // 15 | type | xpath=//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input | 123 77 await driver 78 .findElement( 79 By.xpath("//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input") 80 ) 81 .sendKeys('123'); 82 // 16 | type | xpath=//div[3]/div/div/div/div/div[2]/div/div/div/div/span/input | Francisco 83 await driver 84 .findElement( 85 By.xpath('//div[3]/div/div/div/div/div[2]/div/div/div/div/span/input') 86 ) 87 .sendKeys('Francisco'); 88 // 17 | click | xpath=//div[3]/div/div/span/input | 89 await driver.findElement(By.xpath('//div[3]/div/div/span/input')).click(); 90 // 18 | click | xpath=//div[@id='root']/div/div/div[2]/div/div[2]/form/div[2]/div[2]/button/div[3] | 91 await driver 92 .findElement( 93 By.xpath( 94 "//div[@id='root']/div/div/div[2]/div/div[2]/form/div[2]/div[2]/button/div[3]" 95 ) 96 ) 97 .click(); 98 // 19 | waitForElementPresent | xpath=//h1[contains(.,'Thank You!')] | 60000 99 await driver.wait(100 until.elementLocated(By.xpath("//h1[contains(.,'Thank You!')]")),101 60000102 );103 // 20 | assertText | //*[@id="__next"]/html/body/div/div[1]/div/div/h1 | Thank You!104 assert(105 (await driver106 .findElement(107 By.xpath('//*[@id="__next"]/html/body/div/div[1]/div/div/h1')108 )109 .getText()) == 'Thank You!'110 );111 });112});
Unexpected function expression
16 driver = await new Builder().forBrowser('chrome').build();
17 vars = {};
18 });
19 afterEach(async function () { 20 await driver.quit(); 21 }); 22 it('Make a donation', async function () {
23 // Test name: Make a donation
24 // Step # | name | target | value
Unexpected function expression
12 let driver;
13 // eslint-disable-next-line no-unused-vars
14 let vars;
15 beforeEach(async function () { 16 driver = await new Builder().forBrowser('chrome').build(); 17 vars = {}; 18 }); 19 afterEach(async function () {
20 await driver.quit();
21 });
Unexpected function expression
19 afterEach(async function () {
20 await driver.quit();
21 });
22 it('Hot meal learn more', async function () {23 // Test name: Hot meal learn more24 // Step # | name | target | value25 // 1 | open | / |26 await driver.get('http://localhost:3000/');27 // 2 | setWindowSize | 1920x1080 |28 await driver.manage().window().setRect({ width: 1920, height: 1080 });29 // 3 | click | xpath=//button[contains(.,'Learn More')] |30 await driver31 .findElement(By.xpath("//button[contains(.,'Learn More')]"))32 .click();33 // 4 | assertText | xpath=//h1/div | Free Food Boxes for Hungry Families. Every Saturday!34 assert(35 (await driver.findElement(By.xpath('//h1/div')).getText()) ==36 'Free Food Boxes for Hungry Families. Every Saturday!'37 );38 });39});
Unexpected function expression
16 driver = await new Builder().forBrowser('chrome').build();
17 vars = {};
18 });
19 afterEach(async function () {20 await driver.quit();21 });22 it('Hot meal learn more', async function () {
23 // Test name: Hot meal learn more
24 // Step # | name | target | value
Unexpected function expression
12 let driver;
13 // eslint-disable-next-line no-unused-vars
14 let vars;
15 beforeEach(async function () {16 driver = await new Builder().forBrowser('chrome').build();17 vars = {};18 });19 afterEach(async function () {
20 await driver.quit();
21 });
Unexpected function expression
7import { Builder, By } from 'selenium-webdriver';
8import assert from 'assert';
9
10describe('Hot meal learn more', function () {11 jest.setTimeout(60000);12 let driver;13 // eslint-disable-next-line no-unused-vars14 let vars;15 beforeEach(async function () {16 driver = await new Builder().forBrowser('chrome').build();17 vars = {};18 });19 afterEach(async function () {20 await driver.quit();21 });22 it('Hot meal learn more', async function () {23 // Test name: Hot meal learn more24 // Step # | name | target | value25 // 1 | open | / |26 await driver.get('http://localhost:3000/');27 // 2 | setWindowSize | 1920x1080 |28 await driver.manage().window().setRect({ width: 1920, height: 1080 });29 // 3 | click | xpath=//button[contains(.,'Learn More')] |30 await driver31 .findElement(By.xpath("//button[contains(.,'Learn More')]"))32 .click();33 // 4 | assertText | xpath=//h1/div | Free Food Boxes for Hungry Families. Every Saturday!34 assert(35 (await driver.findElement(By.xpath('//h1/div')).getText()) ==36 'Free Food Boxes for Hungry Families. Every Saturday!'37 );38 });39});
Unexpected function expression
7import { Builder, By, until } from 'selenium-webdriver';
8import assert from 'assert';
9
10describe('Hot meal donate', function () { 11 var webdriver = require('selenium-webdriver'); 12 13 var driver = new webdriver.Builder() 14 .withCapabilities(webdriver.Capabilities.chrome()) 15 .build(); 16 17 jest.setTimeout(60000); 18 // eslint-disable-next-line no-unused-vars 19 let vars; 20 beforeEach(async function () { 21 driver = await new Builder().forBrowser('chrome').build(); 22 vars = {}; 23 }); 24 afterEach(async function () { 25 await driver.quit(); 26 }); 27 it('Hot meal donate', async function () { 28 // Test name: Hot meal donate 29 // Step # | name | target | value 30 // 1 | open | / | 31 await driver.get('http://localhost:3000/'); 32 // 2 | setWindowSize | 1920x1080 | 33 await driver.manage().window().setRect({ width: 1920, height: 1080 }); 34 // 3 | click | xpath=//div[@id='__next']/div/main/div[2]/div/div/div/div/div/div/button | 35 await driver 36 .findElement( 37 By.xpath( 38 "//div[@id='__next']/div/main/div[2]/div/div/div/div/div/div/button" 39 ) 40 ) 41 .click(); 42 // Apply timeout for 10 seconds 43 await driver.manage().setTimeouts({ implicit: 10000 }); 44 // 4 | click | xpath=//div[@id='email-fieldset']/div/div/div/div/span/input | 45 await driver 46 .findElement( 47 By.xpath("//div[@id='email-fieldset']/div/div/div/div/span/input") 48 ) 49 .click(); 50 // 5 | type | xpath=//div[@id='email-fieldset']/div/div/div/div/span/input | [email protected] 51 await driver 52 .findElement( 53 By.xpath("//div[@id='email-fieldset']/div/div/div/div/span/input") 54 ) 55 .sendKeys('[email protected]'); 56 // 6 | click | xpath=//div[@id='cardNumber-fieldset']/div/div/div/span/input | 57 await driver 58 .findElement( 59 By.xpath("//div[@id='cardNumber-fieldset']/div/div/div/span/input") 60 ) 61 .click(); 62 // 7 | type | xpath=//fieldset/div/div/div/div/span/input | 6011 1111 1111 1117 63 await driver 64 .findElement(By.xpath('//fieldset/div/div/div/div/span/input')) 65 .sendKeys('6011 1111 1111 1117'); 66 // 8 | type | xpath=//div[2]/div/div/span/input | 11 / 26 67 await driver 68 .findElement(By.xpath('//div[2]/div/div/span/input')) 69 .sendKeys('11 / 26'); 70 // 9 | type | xpath=//div[@id='billingName-fieldset']/div/div/div/span/input | Francisco 71 await driver 72 .findElement( 73 By.xpath("//div[@id='billingName-fieldset']/div/div/div/span/input") 74 ) 75 .sendKeys('Francisco'); 76 // 10 | click | xpath=//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input | 77 await driver 78 .findElement( 79 By.xpath("//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input") 80 ) 81 .click(); 82 // 11 | type | xpath=//div[3]/div/div/span/input | 123 83 await driver 84 .findElement(By.xpath('//div[3]/div/div/span/input')) 85 .sendKeys('123'); 86 // 12 | click | xpath=//button/div[3] | 87 await driver.findElement(By.xpath('//button/div[3]')).click(); 88 // 13 | waitForElementPresent | xpath=//h1[contains(.,'Thank You!')] | 60000 89 await driver.wait( 90 until.elementLocated(By.xpath("//h1[contains(.,'Thank You!')]")), 91 60000 92 ); 93 // 14 | assertText | //*[@id="__next"]/html/body/div/div[1]/div/div/h1 | Thank You! 94 assert( 95 (await driver 96 .findElement( 97 By.xpath('//*[@id="__next"]/html/body/div/div[1]/div/div/h1') 98 ) 99 .getText()) == 'Thank You!'100 );101 });102});
Unexpected function expression
24 afterEach(async function () {
25 await driver.quit();
26 });
27 it('Hot meal donate', async function () { 28 // Test name: Hot meal donate 29 // Step # | name | target | value 30 // 1 | open | / | 31 await driver.get('http://localhost:3000/'); 32 // 2 | setWindowSize | 1920x1080 | 33 await driver.manage().window().setRect({ width: 1920, height: 1080 }); 34 // 3 | click | xpath=//div[@id='__next']/div/main/div[2]/div/div/div/div/div/div/button | 35 await driver 36 .findElement( 37 By.xpath( 38 "//div[@id='__next']/div/main/div[2]/div/div/div/div/div/div/button" 39 ) 40 ) 41 .click(); 42 // Apply timeout for 10 seconds 43 await driver.manage().setTimeouts({ implicit: 10000 }); 44 // 4 | click | xpath=//div[@id='email-fieldset']/div/div/div/div/span/input | 45 await driver 46 .findElement( 47 By.xpath("//div[@id='email-fieldset']/div/div/div/div/span/input") 48 ) 49 .click(); 50 // 5 | type | xpath=//div[@id='email-fieldset']/div/div/div/div/span/input | [email protected] 51 await driver 52 .findElement( 53 By.xpath("//div[@id='email-fieldset']/div/div/div/div/span/input") 54 ) 55 .sendKeys('[email protected]'); 56 // 6 | click | xpath=//div[@id='cardNumber-fieldset']/div/div/div/span/input | 57 await driver 58 .findElement( 59 By.xpath("//div[@id='cardNumber-fieldset']/div/div/div/span/input") 60 ) 61 .click(); 62 // 7 | type | xpath=//fieldset/div/div/div/div/span/input | 6011 1111 1111 1117 63 await driver 64 .findElement(By.xpath('//fieldset/div/div/div/div/span/input')) 65 .sendKeys('6011 1111 1111 1117'); 66 // 8 | type | xpath=//div[2]/div/div/span/input | 11 / 26 67 await driver 68 .findElement(By.xpath('//div[2]/div/div/span/input')) 69 .sendKeys('11 / 26'); 70 // 9 | type | xpath=//div[@id='billingName-fieldset']/div/div/div/span/input | Francisco 71 await driver 72 .findElement( 73 By.xpath("//div[@id='billingName-fieldset']/div/div/div/span/input") 74 ) 75 .sendKeys('Francisco'); 76 // 10 | click | xpath=//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input | 77 await driver 78 .findElement( 79 By.xpath("//div[@id='cardNumber-fieldset']/div[3]/div/div/span/input") 80 ) 81 .click(); 82 // 11 | type | xpath=//div[3]/div/div/span/input | 123 83 await driver 84 .findElement(By.xpath('//div[3]/div/div/span/input')) 85 .sendKeys('123'); 86 // 12 | click | xpath=//button/div[3] | 87 await driver.findElement(By.xpath('//button/div[3]')).click(); 88 // 13 | waitForElementPresent | xpath=//h1[contains(.,'Thank You!')] | 60000 89 await driver.wait( 90 until.elementLocated(By.xpath("//h1[contains(.,'Thank You!')]")), 91 60000 92 ); 93 // 14 | assertText | //*[@id="__next"]/html/body/div/div[1]/div/div/h1 | Thank You! 94 assert( 95 (await driver 96 .findElement( 97 By.xpath('//*[@id="__next"]/html/body/div/div[1]/div/div/h1') 98 ) 99 .getText()) == 'Thank You!'100 );101 });102});
Unexpected function expression
21 driver = await new Builder().forBrowser('chrome').build();
22 vars = {};
23 });
24 afterEach(async function () { 25 await driver.quit(); 26 }); 27 it('Hot meal donate', async function () {
28 // Test name: Hot meal donate
29 // Step # | name | target | value
Unexpected function expression
17 jest.setTimeout(60000);
18 // eslint-disable-next-line no-unused-vars
19 let vars;
20 beforeEach(async function () { 21 driver = await new Builder().forBrowser('chrome').build(); 22 vars = {}; 23 }); 24 afterEach(async function () {
25 await driver.quit();
26 });
Unexpected function expression
19 afterEach(async function () {
20 await driver.quit();
21 });
22 it('email', async function () {23 // Test name: email24 // Step # | name | target | value25 // 1 | open | / |26 await driver.get('http://localhost:3000/');27 // 2 | setWindowSize | 1792x1016 |28 await driver.manage().window().setRect({ width: 1792, height: 1016 });29 // 3 | click | linkText=Give Your Time |30 await driver.findElement(By.linkText('Give Your Time')).click();31 // 4 | click | css=.btn:nth-child(1) |32 await driver.findElement(By.css('.btn:nth-child(1)')).click();33 // 5 | assertText | css=.btn:nth-child(1) | Donate34 assert(35 (await driver.findElement(By.css('.btn:nth-child(1)')).getText()) ==36 'Donate'37 );38 });39});
Unexpected function expression
16 driver = await new Builder().forBrowser('chrome').build();
17 vars = {};
18 });
19 afterEach(async function () {20 await driver.quit();21 });22 it('email', async function () {
23 // Test name: email
24 // Step # | name | target | value
Description
It is recommended to use arrow functions as callbacks.
Arrow functions can be an attractive alternative to function expressions for callbacks or function arguments.
For example, arrow functions are automatically bound to their surrounding scope/context. This provides an alternative to the pre-ES6 standard of explicitly binding function expressions to achieve similar behavior.
Additionally, arrow functions are:
less verbose, and easier to reason about.
bound lexically regardless of where or when they are invoked.
Bad Practice
func(function(a) { return a; }); // ERROR
// prefer: func(a => a)
func(function() { return this.a; }.bind(this)); // ERROR
// prefer: func(() => this.a)
Recommended
// arrow function callback
func(a => a); // OK
// generator as callback
func(function*() { yield; }); // OK
// function expression not used as callback or function argument
var funcVar = function func(a) { return a; }; // OK
// unbound function expression callback
func(function() { return this.a; }); // OK
// recursive named function callback
func(function recursiveFunc(n) { return n && n + recursiveFunc(n - 1); }); // OK