【问题标题】:Jenkins Job not execute Protractor tests good詹金斯工作不执行量角器测试好
【发布时间】:2018-09-21 13:59:06
【问题描述】:

我有量角器测试,我在本地的 VS 代码中使用 protractor protractor.conf.js --suite full 的命令测试运行测试。 VS 代码运行 chrome 实例并很好地执行了测试。 之后,我为量角器测试设置了 Jenkins 工作。我的步骤:

  • 从 BitBucket 拉取代码
  • 执行windows命令npm install
  • 执行windows命令node_modules\.bin\ng e2e --webdriver-update

Jenkins 在http://localhost:49156/ ** 上打开了 chrome 浏览器并开始进行 Protractor 测试。 在 Chrome 浏览器上,我的测试可以通过ID,HTML,text 找到元素,但是当需要单击元素时,我有这个错误[31m- [39m[31mFailed: element not interactable。 这是控制台输出:

[15:37:51] W/element - more than one element found for locator by.buttonText("Create") - the first result will be used
  Creating configuration for 
    [31m× Creating default configuration [39m
      [31m- [39m[31mFailed: element not interactable
        (Session info: chrome=69.0.3497.100)
        (Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.2.9200 x86_64)[39m
        (Session info: chrome=69.0.3497.100)
        (Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.2.9200 x86_64)
          at Object.checkLegacyResponse (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\error.js:546:15)
          at parseHttpResponse (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\http.js:509:13)
          at doSend.then.response (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\http.js:441:30)
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:189:7)
      From: Task: WebElement.click()

这是量角器测试:

it('Creating default configuration 2000 ', () => {
        _home.get2000Configuration().click();
        _descriptionModal.buttonStartCreate().click();
        for (let i = 0; i < 4; i++) {
            _wizardModal.buttonNext().click();
        }
        _descriptionModal.buttonCreate().click();
        expect(_configurationView.getBaImage().isDisplayed()).toBe(true).then(function (result) {
            expect(_configurationView.getNeb().count()).toBe(2);
            expect(_configurationView.getmage().count()).toBe(2);
            expect(_configurationView.getEngineImage().isDisplayed()).toBe(true);
        });
    });

【问题讨论】:

  • 如果您的页面是响应式的,请考虑 jenkins 上的浏览​​器具有小屏幕尺寸,这会导致以不同布局打开同一页面。

标签: jenkins protractor


【解决方案1】:

检查您发布的错误堆栈我可以看到:

[15:37:51] W/element - more than one element found for locator by.buttonText("Create") - the first result will be used

我的猜测是,这个“创建”文本有多个按钮,您的代码会丢失。例如,我建议检查按钮名称并确保只有一个具有此“创建”标签。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-05
    • 2016-05-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多