CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Using protractor helper with angular 5+

Open elena-dev-thought opened this issue 8 years ago • 5 comments

What are you trying to achieve?

Using protractor helper with angular 5+ & protractor 5.x

What do you get instead?

The config steps ask about Root element of AngularJS application & npm install -g protractor@^4.0.0

Details

Hi @DavertMik !

Aim to use codeceptJS and Protractor helpers with our angular 5+ project, but seems that the codeceptJS with Protractor helper works only with AngularJS and maximum Protractor 4. Is this right ? If yes, do you plan a "migration" of it?

  • CodeceptJS version: 1.1.8
  • NodeJS Version:
  • Operating System: macOS Sierra
  • Protractor

elena-dev-thought avatar May 04 '18 11:05 elena-dev-thought

Looks like the config information is outdated. We support the latest Protractor which is 5.3.

DavertMik avatar May 04 '18 22:05 DavertMik

And will it work with Angular 5? Or is AngularJS only ?

elena-dev-thought avatar May 04 '18 22:05 elena-dev-thought

Sure it should work with Angular 5 and probably 6 as it uses the official Protractor library developed especially for Angular apps

DavertMik avatar May 05 '18 22:05 DavertMik

Tried a lot of combinations and after deep dive into the code it looks like that it is not anymore compatible.

There are multiple problems:

  1. if a seleniumAddress is set protractor is using a hosted driver and not anymore browserstack -> codeceptjs sets a default localhost seleniumAddress
  2. the keys are renamed to browserstackUser and browserstackKey

but even after debugging and code in the libs i was not able to start it i end up with following error:

BrowserStack {
  config_: 
   { browser: 'chrome',
     url: '/',
     fullPageScreenshots: true,
     rootElement: 'portal-root',
     allScriptsTimeout: 10000,
     scriptTimeout: 10000,
     waitForTimeout: 30,
     windowSize: null,
     driver: 'browserstack',
     capabilities: 
      { 'browserstack.debug': 'true',
        'browserstack.local': true,
        'browserstack.networkLogs': 'true',
        'browserstack.console': 'verbose',
        'browserstack.selenium_version': '3.4.0',
        project: 'pcck',
        build: 'codecept-ct-dev',
        name: 'dev || login',
        acceptSslCerts: true,
        driver: 'browserstack',
        browserName: 'chrome' },
     angular: true,
     restart: false,
     manualStart: true,
     keepCookies: true,
     useBlockingProxy: false,
     browserstackUser: 'USER',
     browserstackKey: 'KEY',
     services: [ 'browserstack' ],
     browserstackLocal: true,
     logLevel: 'silent',
     coloredLogs: true },
  drivers_: [],
  bpRunner: 
   BlockingProxyRunner {
     config: 
      { browser: 'chrome',
        url: '/',
        fullPageScreenshots: true,
        rootElement: 'portal-root',
        allScriptsTimeout: 10000,
        scriptTimeout: 10000,
        waitForTimeout: 30,
        windowSize: null,
        driver: 'browserstack',
        capabilities: [Object],
        angular: true,
        restart: false,
        manualStart: true,
        keepCookies: true,
        useBlockingProxy: false,
        browserstackUser: 'USER',
        browserstackKey: 'KEY',
        services: [Array],
        browserstackLocal: true,
        logLevel: 'silent',
        coloredLogs: true } } }
 #core #smokeTest as an owner I login
(node:26045) UnhandledPromiseRejectionWarning: Error: The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
    at new ServiceBuilder (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/selenium-webdriver/chrome.js:191:13)
    at getDefaultService (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/selenium-webdriver/chrome.js:280:22)
    at Function.createSession (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/selenium-webdriver/chrome.js:700:44)
    at createDriver (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/selenium-webdriver/index.js:167:33)
    at Builder.build (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/selenium-webdriver/index.js:639:16)
    at BrowserStack.getNewDriver (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
    at Runner.createBrowser (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/protractor/built/runner.js:202:39)
    at Protractor._startBrowser (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/codeceptjs/lib/helper/Protractor.js:182:27)
    at ProtractorExtension._beforeSuite (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/apps/portal/e2e/configuration/protractor/protractor-extension_helper.js:23:34)
    at recorder.add (/Users/helen/workspace/pcck/monorepo/apps/my-porsche/node_modules/codeceptjs/lib/listener/helpers.js:21:69)
(node:26045) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26045) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
   Emitted | test.before
   [1] Queued | hook Protractor._before()
   [1] Queued | hook ProtractorExtension._before()

-> https://github.com/angular/protractor/blob/60cc0dcf539398865d7677ab68e49077fc4472a3/lib/driverProviders/index.ts#L35

elena-dev-thought avatar May 15 '18 21:05 elena-dev-thought

Hi @DavertMik is it like CodeceptJS with Protractor6 is still not available? Any plans to check this issue?

elena-dev-thought avatar Sep 05 '18 14:09 elena-dev-thought