question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript codecept.conf.ts autoLogin Parameter 'I' implicitly has an 'any' type.

See original GitHub issue

What are you trying to achieve?

Use autoLogin with the typescript-boilerplate and autoLogin plugin including the proxy object “I”.

What do you get instead?

image

Provide test source code if related

This is my repro project:

typescript-boilerplate.zip

It is the typescript-boilerplate, with the autoLogin config added from the official documentation here.

Details

  • CodeceptJS version: 3.3.3 (same issue with v. 3.3.4)
  • NodeJS Version: 16.10.0
  • Operating System: Windows 10
  • playwright
  • Configuration file:
require('ts-node/register')
const { setHeadlessWhen } = require('@codeceptjs/configure');


// 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'
    },
    CustomHelper: {
      require: './CustomHelper.ts'
    }
  },
  bootstrapAll: require('./presettings.ts').bootstrapAll,
  bootstrap: require('./presettings.ts').bootstrap,
  teardownAll: require('./presettings').teardownAll,
  teardown: require('./presettings').teardown,
  include: {
    loginPage: './loginPage.ts',
    homePage: './homePage.ts'
  },
  name: 'typescript-boilerplate',
  plugins: {
    autoLogin: {
      enabled: true,
      saveToFile: true,
      inject: 'loginAs', // use `loginAs` instead of login
      users: {
        user: {
          login: (I) => {
             I.amOnPage('/login');
             I.fillField('email', 'user@site.com');
             I.fillField('password', '123456');
             I.click('Login');
          },
          check: (I) => {
             I.amOnPage('/');
             I.see('User', '.navbar');
          },
        },
        admin: {
          login: (I) => {
             I.amOnPage('/login');
             I.fillField('email', 'admin@site.com');
             I.fillField('password', '123456');
             I.click('Login');
          },
          check: (I) => {
             I.amOnPage('/');
             I.see('Admin', '.navbar');
          },
        },
      }
    },
    retryFailedStep: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    }
  }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DavertMikcommented, Aug 22, 2022

Good point. Config file was not actually parsed as TS file so you got this error.

This should be resolved in 3.3.5 where config file can be written in pure TS.

Please update once it is released

0reactions
DavertMikcommented, Aug 23, 2022

@nicostubi

For example, here the documentation describes the process for an Actor implemented in JavaScript. But not in TypeScript.

You are right, and to be honest I could not find any good TypeScript way to customize actor as we do in JS. So in 3.3.5 when you create a TS project there will be no custom actor created. You should use PageObjects instead.

So currently this limitation still there but not a critical one.

Probably some internal API should be changed to make it work fluently in TypeScript

Read more comments on GitHub >

github_iconTop Results From Across the Web

parameter implicitly has an 'any' type - Stack Overflow
First, to make typescript tolerate parameters without declaring their type, edit the tsconfig.json // disable this rule: // "strict": true, ...
Read more >
Parameter 'X' implicitly has an 'any' type in TypeScript
The "Parameter 'X' implicitly has an 'any' type" error occurs when a function's parameter has an implicit type of `any`. To solve the...
Read more >
How to use the autoLogin() plugin with TypeScript testing #3105
I'm trying to use the autoLogin plugin within a TypeScript test suite. I copied the examples from the documentation, but it doesn't seem...
Read more >
A Fix To Typescript TS7006: Parameter 'xxxx' Implicitly Has An ...
In this article, you will learn about a fix to Typescript TS7006: Parameter 'xxxx' Implicitly Has An 'Any' Type.
Read more >
Releases - CodeceptJS
Added TS types for helpers config: Playwright; Puppeteer; WebDriver; REST. Added TypeScript option for installation via codeceptjs init to initialize new ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found