首页 > 解决方案 > 在 Circle CI 上运行时机器人测试失败

问题描述

当我在本地运行我的机器人测试时一切都很好。我有一个非常基本的 Scala Play 项目,其中包含几个 html 页面。该项目使用 bitbucket,使用 Circle Ci 构建并使用 Docker 映像。我的Dockerfile看起来像这样......

FROM circleci/python:2.7-stretch-browsers

USER root

RUN pip install --upgrade pip && \
    pip install --upgrade robotframework robotframework-httplibrary robotframework-seleniumlibrary requests robotframework-requests python-jose robotframework-jsonlibrary naked

这是我的 .robot 文件...

*** Settings ***
Documentation  This is some basic info about the whole suite
Library  SeleniumLibrary

*** Variables ***


*** Test Cases ***
User must login to visit landing page
    [Documentation]  This is some basic information about the test
    [Tags]  Smoke
    Open Browser  http://localhost:9000  headlesschrome
    #Open Browser  http://localhost:9000  chrome
    Wait Until Page Contains  The Login and Authentication App!
    Sleep  2s
    Click Link  Continue
    Wait Until Page Contains  User Login
    Sleep  1s
    Input Text  username  geoff
    Sleep  1s
    Input Text  password  123
    Sleep  2s
    Click Button  Login
    Sleep  2s
    Wait Until Page Contains  Landing Page!
    Sleep  2s
    Click Link  logout
    Wait Until Page Contains  You are logged out.
    Sleep  2s
    Close Browser

*** Keywords ***

圆ci端有2个台阶。构建(包括 3 个单元测试)并运行机器人测试。构建很好,但机器人测试失败了。这是Circlci的输出...

==============================================================================
User must login to visit landing page :: This is some basic inform... .User must login to visit landing page :: This is some basic inform... | FAIL |
Text 'The Login and Authentication App!' did not appear in 5 seconds.
------------------------------------------------------------------------------
Amazon :: This is some basic info about the whole suite               | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /root/project/output.xml
Log:     /root/project/log.html
Report:  /root/project/report.html
Exited with code 1

我怀疑 CircleCi 和 headlesschrome 存在一些问题。我尝试过使用不同的 Docker 镜像来安装很多 Chrome 的东西,但公平地说,感觉就像是在黑暗中刺伤。任何有关如何解决此问题的想法将不胜感激。

标签: robotframeworkcircleci

解决方案


推荐阅读