我无法在 Protractor for Angularjs 中进行非常简单的添加和获取 cookie 测试。这是测试块:
describe("Homepage", function () {
var ptor;
beforeEach(function () {
ptor = protractor.getInstance();
browser.get('/');
ptor.manage().addCookie("test", "testValue");
});
it('should have cookie with name test and value textValue', function () {
ptor.manage().getCookie("test").then(function(data){
expect(data.value).toBe("testValue");
});
});
});
该测试失败并说数据为空。如果我打印getCookies()
它会打印所有的 cookie 但测试 cookie 不会在那里。真的很感激这方面的一些帮助!谢谢!