我已经制作了一个 React 应用程序,它一切正常,我现在正在使用 Cypress 编写一些端到端的测试。
React 应用程序都在同一个 url 上工作,它没有任何路由,并且来自应用程序内部的 api 调用是通过单击按钮来处理的。
该应用程序的基础是最终用户选择一些选项,然后按过滤器查看依赖于所选选项的一些图表。
cy.get('button').contains('Filter').click()
Run Code Online (Sandbox Code Playgroud)
当在 cypress 中按下按钮时,它会运行 3 个按预期返回的 api 调用,但是查看 cypress 文档没有简单的方法,除非我使用cy.wait(15000)不理想的内联,因为有时它们返回得更快,有时它们返回速度较慢,具体取决于所选选项。
编辑 1 我试过使用服务器和路由:
cy.server({ method: 'GET' });
cy.route('/endpoint1*').as('one')
cy.route('/endpoint2*').as('two')
cy.route('/endpoint3*').as('three')
cy.get('button').contains('Filter').click()
cy.wait(['@one', '@two', '@three'], { responseTimeout: 15000 })
Run Code Online (Sandbox Code Playgroud)
这给了我错误:
CypressError: Timed out retrying: cy.wait() timed out waiting 5000ms for the 1st request to the route: 'one'. No request ever occurred.
Run Code Online (Sandbox Code Playgroud)
经过进一步调查
更改responseTimeout为 只是timeout修复了错误。
cy.server({ method: 'GET' });
cy.route('/endpoint1*').as('one')
cy.route('/endpoint2*').as('two')
cy.route('/endpoint3*').as('three')
cy.get('button').contains('Filter').click()
cy.wait(['@one', …Run Code Online (Sandbox Code Playgroud) 新错误
让应用程序工作(加载但声明谷歌播放服务设置不正确).看一下它所说的显示器E/ViewRootImpl: sendUserActionEvent() mView == null
在尝试奖励成就时还会看到以下内容:
07-19 20:51:42.696 16515-16515/com.gfaiers.hangman E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.gfaiers.hangman, PID: 16515
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.common.api.GoogleApiClient.isConnected()' on a null object reference
at com.gfaiers.hangman.HangmanActivity.endGameQuestion(HangmanActivity.java:842)
at com.gfaiers.hangman.HangmanActivity$2.run(HangmanActivity.java:682)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Run Code Online (Sandbox Code Playgroud)
Tldr:
回答
在底部经常更新
在我开始之前; 我是Android开发的新手,这是我第一次这样做 - 想象我知道的很少!我已经坚持了几天并且已经做了很多关于它的阅读 - 主要是关于那些非常相似并且说同样事情的文章.而且,我能说的所有这些文章都过时了?
我见过这些
我一开始就一直摔倒......经过另一天,我还有一点...... …
我一直在做一个刽子手游戏来自学Java.我已进入框架的主体.
this.add(new PaintSurface(), BorderLayout.CENTER);
Run Code Online (Sandbox Code Playgroud)
我有:
private class PaintSurface extends JComponent {
Shape found = null;
public PaintSurface(){
JOptionPane.showMessageDialog(null, "Repainting");
Shape s;
msgbox("LL: " + intLivesLost);
switch(intLivesLost){
//draw the Hanged man
case 10:
//Face + KILL
case 9:
//2nd Arm
case 8:
//1st Arm
case 7:
//2nd Leg
case 6:
//1st Leg
case 5:
//Body
case 4:
//Head
shapes.add(s);
case 3:
//Horizontal Bar
s = new Line2D.Float(100, 450, 250, 450);
shapes.add(s);
//Rope
s = new Line2D.Float(250, 450, 250, 500);
shapes.add(s);
case …Run Code Online (Sandbox Code Playgroud) java ×2
android ×1
cypress ×1
eclipse ×1
firebase ×1
google-api ×1
javascript ×1
reactjs ×1
repaint ×1