diff --git a/google_search.js b/first_test.js similarity index 88% rename from google_search.js rename to first_test.js index 6178fde..28932a8 100644 --- a/google_search.js +++ b/first_test.js @@ -22,15 +22,16 @@ const expect = require('chai').expect; * BrowserStack specific code ends here */ const page = await browser.newPage(); - await page.goto('https://www.google.com/ncr'); - const element = await page.$('[aria-label="Search"]'); + + await page.goto('https://www.duckduckgo.com'); + const element = await page.$('[name="q"]'); await element.click(); await element.type('BrowserStack'); await element.press('Enter'); const title = await page.title(''); console.log(title); try { - expect(title).to.equal("BrowserStack - Google Search", 'Expected page title is incorrect!'); + expect(title).toEqual("BrowserStack at DuckDuckGo", 'Expected page title is incorrect!'); // following line of code is responsible for marking the status of the test on BrowserStack as 'passed'. You can use this code in your after hook after each test await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'Title matched'}})}`); } catch { diff --git a/parallel_test.js b/parallel_test.js index fcd06c2..163227f 100644 --- a/parallel_test.js +++ b/parallel_test.js @@ -11,15 +11,15 @@ const main = async (cap) => { }); const page = await browser.newPage(); - await page.goto('https://www.google.com/ncr'); - const element = await page.$('[aria-label="Search"]'); + await page.goto('https://www.duckduckgo.com'); + const element = await page.$('[name="q"]'); await element.click(); await element.type('BrowserStack'); await element.press('Enter'); const title = await page.title(''); console.log(title); try { - expect(title).to.equal("BrowserStack - Google Search", 'Expected page title is incorrect!'); + expect(title).to.equal("BrowserStack at DuckDuckGo", 'Expected page title is incorrect!'); // following line of code is responsible for marking the status of the test on BrowserStack as 'passed'. You can use this code in your after hook after each test await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'setSessionStatus',arguments: {status: 'passed',reason: 'Title matched'}})}`); } catch {