Skip to content

Autocompletion for TypeScript does not work if I("Actor") has extensions in IntelliJ IDEA Ultimate #3056

@frixatrix

Description

@frixatrix

What are you trying to achieve?

Auto-complete in Intellij IDEA Ultimate for codeceptjs/typescript/puppeteer/mochawesome setup when "Actor"(I) is extended with custom steps file.
I did extension as described here: https://codecept.io/pageobjects/#actor

What do you get instead?

Auto-complete stoops working for parent methods and for custom ones.

STR

Example done with https://github.com/codeceptjs/typescript-boilerplate

I commented out in loginPage.ts method link:

  // async link () {
  //   await I.waitForVisible(this.locator)
  // }

and added same code to steps_file.ts

export = function (): any {
  return actor({
    // Define custom steps here, use 'this' to access default methods of I.
    // It is recommended to place a general 'login' function here.
	link: async function (): Promise<void> {
		  await this.waitForVisible(this.locator)
	  }
  });
};

Then added include to codeceptjs.conf.js:

  include: {
	I: 'steps_file.ts',

Then run codeceptjs def .

> codeceptjs def .
TypeScript Definitions provide autocompletion in Visual Studio Code and other IDEs
Definitions were generated in steps.d.ts

Then opened Typescript_Example_test.ts
And pointer mouse on any methods called from 'I'.

Result:

0 methods of I available for TS for autocomplete.

Screenshot 2021-09-30 at 15 33 04
Screenshot 2021-09-30 at 15 33 09
Screenshot 2021-09-30 at 15 33 14
Screenshot 2021-09-30 at 15 33 24

And if I don't do those changes - everything works as expected:

Screenshot 2021-09-30 at 15 34 05
Screenshot 2021-09-30 at 15 34 10

Details

  • CodeceptJS version: 3.0.0
  • NodeJS Version:14.15.1
  • Operating System:MacOSX
  • puppeteer
  • Configuration file:
require('ts-node/register')
const { setHeadlessWhen } = require('@codeceptjs/configure');
const { bootstrap } = require('./presettings.ts');

// turn on headless mode when running with HEADLESS=true environment variable
// HEADLESS=true npx codecept run
setHeadlessWhen(process.env.HEADLESS);

exports.config = {
  tests: './tests/**_test.ts',
  output: './output',
  helpers: {
    // Playwright: {
    //   url: 'https://github.com',
    //   show: false,
    //   windowSize: '1200x900',
    //   browser: 'chromium'
    // },
	  Puppeteer: {
		  url: './',
		  basicAuth: { username: 'user', password: 'pass' },
		  show: true,
		  windowSize: '1280x900',
		  waitForNavigation: "networkidle0"
	  },
    CustomHelper: {
      require: './CustomHelper.ts'
    }
  },
  bootstrap,
  include: {
	// I: 'steps_file.ts',
    loginPage: './loginPage.ts',
    homePage: './homePage.ts'
  },
  name: 'typescript-boilerplate',
  plugins: {
    retryFailedStep: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions