【发布时间】:2021-09-19 06:48:16
【问题描述】:
我正在使用 Cypress 进行自动化测试。使用 Next.js 在 React 中构建的应用
测试在本地通过 cypress 打开和 cypress 运行但在 GitLab CI 中失败。
我访问 URL cy.visit('localhost:8000/cadastro/login/?next=/')
输入用户名cy.get('#id_username').type("username_here"),
输入密码cy.get('#id_password').type("password_here")
然后点击登录按钮cy.get('.btn').click()
一切正常,但是当页面进入应用程序并重新加载到localhost:8000/#/时,我验证了一条包含“你好,名字!”的消息,
cy.get('#dropdownMenuButton').contains(`Hello, ${firstName}`);
我从 CI runner 得到这个错误输出:
AssertionError: Timed out retrying after 4000ms: Expected to find element: `#dropdownMenuButton`, but never found it.
我尝试增加超时但不起作用
【问题讨论】:
-
您能否在您的 CI 中检查登录后显示的元素
Hello, ${firstName}
标签: gitlab continuous-integration gitlab-ci cypress gitlab-ci-runner