Jacob
Jacob

Reputation: 11

Testcafe: Is there a way to maximize window from testcafe configuration file?

I am new to testcafe. I do not want to use maximizeWindow() over and over inside every test. Is there a way to have this feature to be used as part of the configuration file? Or a better solution that will prevent me using it inside every test.

Upvotes: 1

Views: 282

Answers (1)

Alexey Popov
Alexey Popov

Reputation: 1047

You can use global hooks from the 1.19.0 TestCafe version. Add them to the config file. For example:

module.exports = {
  hooks: {
    test: {
      before: async (t) => {
        await t.maximizeWindow();
      },
    },
  },
};

You can find more information on this feature in the documentation: https://testcafe.io/documentation/402638/reference/configuration-file#hooks

Upvotes: 1

Related Questions