1

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.

Jacob
  • 11
  • 1

1 Answers1

1

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

Alexey Popov
  • 1,033
  • 1
  • 4
  • 12