1

I have a small suite of Protractor tests. In with the tests, I have some page object classes that extend from a common base class. In my protractor config, I have:

specs: [ './showcase/e2e/**/*.e2e-spec.ts' ] 

If I run Protractor with this config, all the tests run. But, if I try to run a single test, I run into an error.

I'm trying to run a specific test with this command:

protractor --specs showcase/e2e/app/components/dropdown/dropdown.e2e-spec.ts 

But then I get an error:

Error: TSError: ⨯ Unable to compile TypeScript showcase/e2e/shared/components/dropdown/dropdown.po.ts (3,32): Property 'setPrototypeOf' does not exist on type 'ObjectConstructor'. (2339) 

Here is the contents of dropdown.po.ts:

import { ExamplePage } from '../example.po'; export const COMPONENT_ID = 'dropdown'; export class DropdownPage extends ExamplePage { navigateTo() { this.navigateToComponentPage('dropdown'); } } 

There's got to be something I'm missing. Any idea why I get this error when I try to run a single test case, but no error when I run everything? I'm stumped.

1
  • It looks like you are using ecma6 when running the entire suite, but when you are running a single test, its target is not what you intend Commented Feb 2, 2018 at 21:48

3 Answers 3

1

You missed to specify protractor conf in command line:

protractor --specs showcase/e2e/app/components/dropdown/dropdown.e2e-spec.ts 

Correct one should be like:

protractor conf.js --specs showcase/e2e/app/components/dropdown/dropdown.e2e-spec.ts 
Sign up to request clarification or add additional context in comments.

1 Comment

I just tried that, specifying my config file, unfortunately I got the same error.
0

You should run *.js files instead of direct *.ts. Please use tsc for compiling your typescript code to javascript before running tests.

1 Comment

I don't think that's the problem. When I run all the tests together (which are all written in TypeScript), I don't get the error.
0

I found the necessary fix.

In this case, I needed to add the following to tsconfig.json:

"lib": [ "es2016", "dom" ] 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.