Protractor how to run login test script first

前端 未结 1 958
别那么骄傲
别那么骄傲 2021-02-06 09:00

I am trying to test an Angular Single Page application with protractor. I need to run the login script first. Only then I can move to other routes since there is a check for tok

1条回答
  •  天命终不由人
    2021-02-06 09:56

    As highlighted in the Protractor FAQs, you can specify your login code in the onPrepare section of your conf file. Here is an example.

    You can also achieve this in beforeAll but that adds unnecessary overhead to your test scripts. Altering the localStorage is possible, but not in the spirit of e2e testing since a lot can go wrong wrt LS, and you will end up wondering if it is your app or your LS modification code that caused this.

    0 讨论(0)
提交回复
热议问题