Remove an item from localStorage in a protractor test

前端 未结 4 1082
旧时难觅i
旧时难觅i 2020-12-10 05:49

I am trying to remove an entry in the localStorage from a protractor test

describe(\'The feature\', function() {

  beforeEach(function() {
    browser.execu         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 06:29

    Another potential solution is to put any state clearing in an afterEach, which will run after any test is run: (see https://github.com/angular/protractor/issues/188)

    afterEach(function() {
        browser.executeScript('window.sessionStorage.clear();');
        browser.executeScript('window.localStorage.clear();');
    });
    

提交回复
热议问题