From b70c8b4e1a4f3fd02aa105107695302c2dd46691 Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Thu, 26 Aug 2021 19:35:06 +0530 Subject: [PATCH 1/8] update code snippet for getSessionDetails executor --- sample_session_details_API.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sample_session_details_API.js b/sample_session_details_API.js index cfc4041..8bfd46f 100644 --- a/sample_session_details_API.js +++ b/sample_session_details_API.js @@ -41,9 +41,8 @@ const expect = require('chai').expect; * You can use all these details after your test has completed, to fetch logs or use any other Automate REST APIs */ const resp = await JSON.parse(await page.evaluate(_ => {}, `browserstack_executor: ${JSON.stringify({action: 'getSessionDetails'})}`)); - const jsonObj = await JSON.parse(resp); - console.log(jsonObj.hashed_id); // This gives the session ID of the running session - console.log(jsonObj); // This prints the entire JSON response. You can use any/all of the response attributes the way you like. + console.log(resp.hashed_id); // This gives the session ID of the running session + console.log(resp); // This prints the entire JSON response. You can use any/all of the response attributes the way you like. await browser.close(); })(); From c93fff494c5c73808aa505e4dfc77247146ed74a Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Mon, 11 Oct 2021 11:41:49 +0530 Subject: [PATCH 2/8] puppeteer URL change --- codeceptjs-example/codecept.conf.js | 2 +- google_search.js | 2 +- google_search_with_proxy.js | 2 +- local_test.js | 2 +- local_test_using_bindings.js | 2 +- parallel_test.js | 2 +- puppeteer-jest/jest-puppeteer.config.js | 2 +- sample_session_details_API.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/codeceptjs-example/codecept.conf.js b/codeceptjs-example/codecept.conf.js index 260baf2..b8025ba 100644 --- a/codeceptjs-example/codecept.conf.js +++ b/codeceptjs-example/codecept.conf.js @@ -21,7 +21,7 @@ exports.config = { helpers: { Puppeteer: { chrome: { - browserWSEndpoint: `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}` + browserWSEndpoint: `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}` } } }, diff --git a/google_search.js b/google_search.js index beb55f1..6178fde 100644 --- a/google_search.js +++ b/google_search.js @@ -15,7 +15,7 @@ const expect = require('chai').expect; }; const browser = await puppeteer.connect({ browserWSEndpoint: - `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}`, + `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}`, }); /* diff --git a/google_search_with_proxy.js b/google_search_with_proxy.js index 1687ee4..23819f8 100644 --- a/google_search_with_proxy.js +++ b/google_search_with_proxy.js @@ -22,7 +22,7 @@ bootstrap(); }; const browser = await puppeteer.connect({ browserWSEndpoint: - `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}`, + `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}`, }); /* diff --git a/local_test.js b/local_test.js index 60f5dd2..b1bba33 100644 --- a/local_test.js +++ b/local_test.js @@ -16,7 +16,7 @@ const expect = require('chai').expect; }; const browser = await puppeteer.connect({ browserWSEndpoint: - `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}`, + `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}`, }); /* diff --git a/local_test_using_bindings.js b/local_test_using_bindings.js index 2a61137..9190a02 100644 --- a/local_test_using_bindings.js +++ b/local_test_using_bindings.js @@ -54,7 +54,7 @@ async function testFn() { // Use `.connect()` to initiate an Automate session on BrowserStack const browser = await puppeteer.connect({ - browserWSEndpoint: `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}`, + browserWSEndpoint: `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}`, }); // BrowserStack specific code ends here diff --git a/parallel_test.js b/parallel_test.js index 4047182..fcd06c2 100644 --- a/parallel_test.js +++ b/parallel_test.js @@ -7,7 +7,7 @@ const main = async (cap) => { cap['browserstack.accessKey'] = process.env.BROWSERSTACK_ACCESS_KEY || 'YOUR_ACCESS_KEY'; const browser = await puppeteer.connect({ - browserWSEndpoint:`wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(cap))}`, + browserWSEndpoint:`wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(cap))}`, }); const page = await browser.newPage(); diff --git a/puppeteer-jest/jest-puppeteer.config.js b/puppeteer-jest/jest-puppeteer.config.js index 67ac70a..0c72026 100644 --- a/puppeteer-jest/jest-puppeteer.config.js +++ b/puppeteer-jest/jest-puppeteer.config.js @@ -33,6 +33,6 @@ const caps_edge = { module.exports = { connect: { - browserWSEndpoint: `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps_chrome))}`, + browserWSEndpoint: `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps_chrome))}`, } } diff --git a/sample_session_details_API.js b/sample_session_details_API.js index 8bfd46f..7df882b 100644 --- a/sample_session_details_API.js +++ b/sample_session_details_API.js @@ -15,7 +15,7 @@ const expect = require('chai').expect; }; const browser = await puppeteer.connect({ browserWSEndpoint: - `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}`, + `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}`, }); /* From 2f07e1929f9615ee57204888671bf10c43c3db1f Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Mon, 8 Nov 2021 11:56:51 +0530 Subject: [PATCH 3/8] removed pvt beta note from readme --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index c1c7f9f..11894ca 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,7 @@ This guide walks you through running a sample Puppeteer test on BrowserStack and ## Pre-requisites -You need BrowserStack credentials to be able to run Puppeteer tests and also you need to be included in the Beta group so that we can enable Puppeteer access for you in our infra while the integration is in closed-beta. - -If you have already been included in the beta group, proceed ahead. Else, you can [reach out to support](https://www.browserstack.com/contact#technical-support) to get included in the beta group. - -You have to replace `YOUR_USERNAME` and `YOUR_ACCESS_KEY` in the sample scripts in this repository with your BrowserStack credentials which can be found in your [Account Settings](https://www.browserstack.com/accounts/settings) page. +You need BrowserStack credentials to be able to run Puppeteer tests. You have to replace `YOUR_USERNAME` and `YOUR_ACCESS_KEY` in the sample scripts in this repository with your BrowserStack credentials which can be found in your [Account Settings](https://www.browserstack.com/accounts/settings) page. **Alternatively, you can set the environment variables `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` with your credentials and all the scripts in this repository should work fine** From 0954a9024fbf034afdc3bcef3efa9218ac0a2f81 Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Wed, 10 Nov 2021 15:39:10 +0530 Subject: [PATCH 4/8] Fix: changed codeceptjs sample code --- codeceptjs-example/login_test.js | 11 -- codeceptjs-example/package-lock.json | 230 ++++++++++++++++++--------- codeceptjs-example/package.json | 2 +- codeceptjs-example/react_app_test.js | 12 ++ 4 files changed, 165 insertions(+), 90 deletions(-) delete mode 100644 codeceptjs-example/login_test.js create mode 100644 codeceptjs-example/react_app_test.js diff --git a/codeceptjs-example/login_test.js b/codeceptjs-example/login_test.js deleted file mode 100644 index 0e7df27..0000000 --- a/codeceptjs-example/login_test.js +++ /dev/null @@ -1,11 +0,0 @@ -Feature('login'); - -Scenario('Login on GitHub', ({ I }) => { - I.amOnPage('https://github.com'); - I.click('Sign in', '//html/body/div[1]/header'); - I.see('Sign in to GitHub', 'h1'); - I.fillField('Username or email address', 'something@totest.com'); - I.fillField('Password', '123456'); - I.click('Sign in'); - I.see('Incorrect username or password.', '.flash-error'); -}); diff --git a/codeceptjs-example/package-lock.json b/codeceptjs-example/package-lock.json index 2ae473c..6b32ad0 100644 --- a/codeceptjs-example/package-lock.json +++ b/codeceptjs-example/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@babel/parser": { - "version": "7.14.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.7.tgz", - "integrity": "sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA==" + "version": "7.16.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.3.tgz", + "integrity": "sha512-dcNwU1O4sx57ClvLBVFbEgx0UZWfd0JQX5X6fxFRCLHelFBGXFfSz6Y0FAq2PEwUqlqLkdVjVr4VASEOuUnLJw==" }, "@codeceptjs/configure": { "version": "0.6.2", @@ -78,6 +78,11 @@ "jsonfile": "^4.0.0", "universalify": "^0.1.0" } + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" } } }, @@ -129,15 +134,15 @@ } }, "array.prototype.map": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.3.tgz", - "integrity": "sha512-nNcb30v0wfDyIe26Yif3PcV1JXQp4zEeEfupG7L4SRjnD6HLbO5b2a7eVSba53bOx4YCHYMBHt+Fp4vYstneRA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.4.tgz", + "integrity": "sha512-Qds9QnX7A0qISY7JT5WuJO0NJPE9CMlC6JzHQfhpqAAQQzufVRoeH7EzUY5GcPTx72voG8LV/5eo+b8Qi8hmhA==", "requires": { - "call-bind": "^1.0.0", + "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1", + "es-abstract": "^1.19.0", "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.5" + "is-string": "^1.0.7" } }, "arrify": { @@ -146,11 +151,11 @@ "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" }, "axios": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", - "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "requires": { - "follow-redirects": "^1.10.0" + "follow-redirects": "^1.14.0" } }, "balanced-match": { @@ -239,9 +244,9 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -313,9 +318,9 @@ } }, "codeceptjs": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/codeceptjs/-/codeceptjs-3.0.7.tgz", - "integrity": "sha512-YtIhxfkgASI+mTvpxRYFiBUu2lXCNQXMKp8D9RWiYBT4sX3885yUU4FVIhFfpUaOeOUxDDkyUQRP9odW1boAiA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/codeceptjs/-/codeceptjs-3.1.3.tgz", + "integrity": "sha512-HKQ9jmeIGi2LU5sfpYJtAYeBw5cfkgdfBDF+P4mMcysKSIcxxJ94Az8J6OeJRFuwUYlBvlxi/YaZ2sHm+F9XDA==", "requires": { "@codeceptjs/configure": "^0.6.2", "@codeceptjs/helper": "^1.0.2", @@ -347,7 +352,8 @@ "promise-retry": "^1.1.1", "requireg": "^0.2.2", "resq": "^1.10.0", - "sprintf-js": "^1.1.1" + "sprintf-js": "^1.1.1", + "uuid": "^8.3.2" } }, "color-convert": { @@ -485,21 +491,25 @@ "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=" }, "es-abstract": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.3.tgz", - "integrity": "sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.3", - "is-string": "^1.0.6", - "object-inspect": "^1.10.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", "string.prototype.trimend": "^1.0.4", @@ -638,9 +648,9 @@ "integrity": "sha512-M9XSagc92ejQhi+7kjpFPAO59xKbGRsbOg/9dfwSj84DfzB0pj+Q81DVD1pKr084Xf2oICwUNI0pCvGORmD9zg==" }, "follow-redirects": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz", - "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==" + "version": "1.14.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", + "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==" }, "fs-constants": { "version": "1.0.0", @@ -696,6 +706,15 @@ "pump": "^3.0.0" } }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "gherkin": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/gherkin/-/gherkin-5.1.0.tgz", @@ -722,9 +741,9 @@ } }, "graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" }, "growl": { "version": "1.10.5", @@ -754,6 +773,14 @@ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } + }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -874,18 +901,32 @@ } } }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, "is-arguments": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.0.tgz", - "integrity": "sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "requires": { - "call-bind": "^1.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" } }, "is-bigint": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.2.tgz", - "integrity": "sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "requires": { + "has-bigints": "^1.0.1" + } }, "is-binary-path": { "version": "2.1.0", @@ -896,11 +937,12 @@ } }, "is-boolean-object": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.1.tgz", - "integrity": "sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", "requires": { - "call-bind": "^1.0.2" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" } }, "is-buffer": { @@ -909,14 +951,17 @@ "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" }, "is-callable": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", - "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==" }, "is-date-object": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.4.tgz", - "integrity": "sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-extglob": { "version": "2.1.1", @@ -929,9 +974,9 @@ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "requires": { "is-extglob": "^2.1.1" } @@ -952,9 +997,12 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" }, "is-number-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.5.tgz", - "integrity": "sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw==" + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-plain-obj": { "version": "1.1.0", @@ -962,12 +1010,12 @@ "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" }, "is-regex": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.3.tgz", - "integrity": "sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "requires": { "call-bind": "^1.0.2", - "has-symbols": "^1.0.2" + "has-tostringtag": "^1.0.0" } }, "is-set": { @@ -975,10 +1023,18 @@ "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==" }, + "is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==" + }, "is-string": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz", - "integrity": "sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-symbol": { "version": "1.0.4", @@ -988,6 +1044,14 @@ "has-symbols": "^1.0.2" } }, + "is-weakref": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", + "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "requires": { + "call-bind": "^1.0.0" + } + }, "isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", @@ -999,9 +1063,9 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, "iterate-iterator": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", - "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.2.tgz", + "integrity": "sha512-t91HubM4ZDQ70M9wqp+pcNpu8OyJ9UAtXntT/Bcsvp5tZMnz9vRa+IunKXeI8AnfZMTv0jNuVEmGeLSMjVvfPw==" }, "iterate-value": { "version": "1.0.2", @@ -1024,9 +1088,9 @@ }, "dependencies": { "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1126,9 +1190,9 @@ } }, "mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==" }, "mimic-fn": { "version": "1.2.0", @@ -1699,15 +1763,25 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" }, "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", + "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==" }, "sprintf-js": { "version": "1.1.2", @@ -1877,9 +1951,9 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" }, "which": { "version": "2.0.2", diff --git a/codeceptjs-example/package.json b/codeceptjs-example/package.json index c14d903..471e025 100644 --- a/codeceptjs-example/package.json +++ b/codeceptjs-example/package.json @@ -9,7 +9,7 @@ "author": "Sourav Kundu", "license": "ISC", "dependencies": { - "codeceptjs": "^3.0.7", + "codeceptjs": "^3.1.3", "puppeteer": "^10.1.0" } } diff --git a/codeceptjs-example/react_app_test.js b/codeceptjs-example/react_app_test.js new file mode 100644 index 0000000..c4e6db0 --- /dev/null +++ b/codeceptjs-example/react_app_test.js @@ -0,0 +1,12 @@ +Feature('React Apps'); + +Scenario('try react app', ({ I }) => { + I.amOnPage('https://ahfarmer.github.io/calculator/'); + I.click('7'); + I.seeElement({ react: 't', props: { name: '5' } }); + I.click('button', { react: 't', props: { name: '2' } }); + I.click('button', { react: 't', props: { name: '+' } }); + I.click('button', { react: 't', props: { name: '9' } }); + I.click('button', { react: 't', props: { name: '=' } }); + I.seeElement({ react: 't', props: { value: '81' } }); +}); From 91078d2fef796c4aa486244cf6503c6085af90ab Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:17:31 +0530 Subject: [PATCH 5/8] changed google.comn to duckduckgo --- codeceptjs-example/{react_app_test.js => login_test.js} | 0 google_search.js => first_test.js | 9 +++++---- parallel_test.js | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) rename codeceptjs-example/{react_app_test.js => login_test.js} (100%) rename google_search.js => first_test.js (82%) diff --git a/codeceptjs-example/react_app_test.js b/codeceptjs-example/login_test.js similarity index 100% rename from codeceptjs-example/react_app_test.js rename to codeceptjs-example/login_test.js diff --git a/google_search.js b/first_test.js similarity index 82% rename from google_search.js rename to first_test.js index 6178fde..1431f5f 100644 --- a/google_search.js +++ b/first_test.js @@ -15,22 +15,23 @@ const expect = require('chai').expect; }; const browser = await puppeteer.connect({ browserWSEndpoint: - `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}`, + `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}`, }); /* * 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 { From 3224c0f7fc1f96ee145da794983de419ff04d5a7 Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:23:13 +0530 Subject: [PATCH 6/8] added /puppeteer to hub url --- first_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/first_test.js b/first_test.js index 1431f5f..5bc98b1 100644 --- a/first_test.js +++ b/first_test.js @@ -15,7 +15,7 @@ const expect = require('chai').expect; }; const browser = await puppeteer.connect({ browserWSEndpoint: - `wss://cdp.browserstack.com?caps=${encodeURIComponent(JSON.stringify(caps))}`, + `wss://cdp.browserstack.com/puppeteer?caps=${encodeURIComponent(JSON.stringify(caps))}`, }); /* From d237ad906ab29696d45382e5fa4a2cb14099a51e Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:24:41 +0530 Subject: [PATCH 7/8] chore: double quotes added instead of single --- first_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/first_test.js b/first_test.js index 5bc98b1..28932a8 100644 --- a/first_test.js +++ b/first_test.js @@ -31,7 +31,7 @@ const expect = require('chai').expect; const title = await page.title(''); console.log(title); try { - expect(title).toEqual( 'BrowserStack at DuckDuckGo', '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 { From b361aeab773f1b125be9ee20bab7d33c1b71c8ca Mon Sep 17 00:00:00 2001 From: sourav-kundu <66624530+sourav-kundu@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:26:10 +0530 Subject: [PATCH 8/8] chore: removed duplicate file --- codeceptjs-example/login_test.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 codeceptjs-example/login_test.js diff --git a/codeceptjs-example/login_test.js b/codeceptjs-example/login_test.js deleted file mode 100644 index c4e6db0..0000000 --- a/codeceptjs-example/login_test.js +++ /dev/null @@ -1,12 +0,0 @@ -Feature('React Apps'); - -Scenario('try react app', ({ I }) => { - I.amOnPage('https://ahfarmer.github.io/calculator/'); - I.click('7'); - I.seeElement({ react: 't', props: { name: '5' } }); - I.click('button', { react: 't', props: { name: '2' } }); - I.click('button', { react: 't', props: { name: '+' } }); - I.click('button', { react: 't', props: { name: '9' } }); - I.click('button', { react: 't', props: { name: '=' } }); - I.seeElement({ react: 't', props: { value: '81' } }); -});