草庐IT

Protractor

全部标签

javascript - 用 Protractor 测试悬停状态变化

无论我做什么,我都无法通过Protractor测试获得悬停状态功能。以下代码是半功能的..在Firefox中运行良好仅当我使用Chrome将区域滚动到View中时才有效。在PhantomJS中失败obj.getCssValue('color').then(function(color1){browser.actions().mouseMove(obj).perform().then(function(){obj.getCssValue('color').then(function(color2){expect(color1).not.toEqual(color2);});});

javascript - Protractor 中的 untrackOutstandingTimeouts 设置是什么?

在Protractor引用配置中,有untrackOutstandingTimeoutssetting提到://Protractorwilltrackoutstanding$timeoutsbydefault,andreportthemin//theerrormessageifProtractorfailstosynchronizewithAngularintime.//InordertodothisProtractorneedstodecorate$timeout.//CAUTION:Ifyourappdecorates$timeout,youmustturnonthisflag.T

javascript - 调试 Protractor 到 Angular 同步问题的规范方法

问题描述:我们最近在Protractor端到端测试中打开应用程序中的一个页面时遇到了这个臭名昭著的错误:Failed:TimedoutwaitingforasynchronousAngulartaskstofinishafter50seconds.ThismaybebecausethecurrentpageisnotanAngularapplication.这发生在我们的一个测试中的browser.get("/some/page/");调用上:describe("Test",function(){beforeEach(function(){browser.get("/some/page

javascript - Protractor 中的 RGB/RGBA 颜色值

故事:在我们的测试代码库的几个地方,我们断言不同的CSS值等于预期值。通常,这是与color、background-color、font相关的样式属性,或cursor。这个问题是关于处理颜色的。这是一个当前通过的工作测试示例:describe("AngularJShomepage",function(){beforeEach(function(){browser.get("https://angularjs.org/");});it("shouldshowablueDownloadbutton",function(){vardownloadButton=element(by.parti

javascript - 如何在 Angularjs Protractor 中使用全局函数?

我有大约20个规范文件,其中大部分使用在每个文件中重复的相同功能。我可以将全局函数放在每个spec文件都可以使用的conf.js文件中吗?我阅读了此页面http://stackoverflow.com/questions/21320400/protractor-angularjs-global-variables,但它不是很有帮助,我无法让它工作。我尝试在onPrepare中放置一个函数,但规范文件找不到它。我也试过global.viewByAds=function(){...};如果有人能帮助我,我将不胜感激! 最佳答案 你可以简

javascript - 从 ElementFinder 数组创建 ElementArrayFinder

这是Takeelementswhileaconditionevaluatestotrue(extendingElementArrayFinder)的后续问题特别是主题和@cvakiitho的回答。问题:执行以下代码后:vari=0;varel=element.all(by.css('ullia'));vartableItems=[];(functionloop(){el.get(i).getText().then(function(text){if(text){tableItems.push(el.get(i));i+=1;loop();}});}());tableItems将包含一组

javascript - 如何点击 Protractor 中的隐藏元素?

我有一个只有当我将鼠标悬停在它上面时才可见的元素。我编写了以下代码以将鼠标悬停在面板上,以便元素可见。ptor.actions().mouseMove(ptor.findElement(protractor.By.xpath('//*[@id="productapp"]/div/div/div[2]/div/div/div/div[2]/div/div/div/div[4]/table/thead/tr/th[2]'))).perform();ptor.element.all(by.tagName('i')).then(function(elm){elm[0].click();});现

javascript - 如何,可以说,在每次 Protractor 规范测试后重新启动或关闭浏览器

我正在为网络应用实现Protractor测试。我做了一些谷歌搜索,但我想出了zip,我希望我创建的每个规范在浏览器运行该特定规范文件中的所有测试后关闭浏览器,然后继续下一个-spec文件,等等我有诸如使用“beforeAll”和“afterAll”之类的东西,但Jasmine无法识别这些方法。指向正确方向的点会很棒!describe('稍后我会在这里放一些更有意义的东西:)',function(){//notsureifthismethodactuallyexistinJasmineafterAll(function(){//restartbrowserorsomethingofthe

javascript - 如何从 Protractor 测试发出 POST 请求?

我想在运行Protractor之前向数据库服务器发出一个POST请求(带有JSON负载)测试,以注入(inject)测试数据。如果可能的话,我该怎么做? 最佳答案 如果您只想填充数据库,则可以使用另一个库来运行POST请求。例如,您可以使用superagent在你的beforeEach中,像这样:varrequest=require("superagent");describe("Something",function(){beforeEach(function(done){request.post("http://localhos

javascript - Protractor 未连接到 DevTools

当我的页面从Protractor运行时,如何使用Chrome开发者工具来检查它?当我尝试打开devtools时,我从Protractor中收到此错误:UnknownError:disconnected:notconnectedtoDevTools(Sessioninfo:chrome=35.0.1916.114)(Driverinfo:chromedriver=2.10.267518,platform=Linux3.5.0-49-genericx86_64) 最佳答案 你不能,因为webdriver使用开发人员工具与chrome通信