Testcafe throwing an error when run in azure pipeline "Error in Role initializer - Role cannot be switched while another role is being initialized."

Viewed 61

The error is intermittent when running in the pipeline. Initially we were running with concurrency 4 and never had this issue cropped up. We have tried with concurrency set to 1 as well but no help Before initialising the role used await t.useRole(Role.anonymous());

So that the user is logged out internally before taking another role. However the problem still persist. Also we have added skip js errors But still the problem exists.

Error:

❌ - Error in Role initializer -
Role cannot be switched while another role is being initialized.
⠀
Browser: Chrome 103.0.5060.134 / Linux 0.0
⠀
⠀   16 |      `The role '${userName}' does not exist. Existing roles: ${Object.keys(
⠀   17 |        ROLES
⠀   18 |      ).join(", ")}`
⠀   19 |    );
⠀   20 |  }
⠀ > 21 |  await t.useRole(Role.anonymous());
⠀   22 |  await t.wait(2000);
⠀   23 |  await t.useRole(role);
⠀   24 |}
⠀   25 |

Looking forward some suggestions please.

Also we tried without t.useRole(Role.anonymous()); but did not help

0 Answers
Related