Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screenshot step cannot cap image #60

Closed
andychan06 opened this issue Jul 8, 2022 · 14 comments
Closed

screenshot step cannot cap image #60

andychan06 opened this issue Jul 8, 2022 · 14 comments

Comments

@andychan06
Copy link

andychan06 commented Jul 8, 2022

问题描述 / Describe the bug
screenshot step succeed, but no image can be found. Also the time of screenshot in report shows 00:00:00.000

问题复现步骤 / To Reproduce

  1. use Background with more than 2 steps
  2. screenshot in Scenario
  3. find screenshot

预期结果 / Expected behavior
image should be found

截图 / Screenshots
111

环境信息 / Environment (please complete the following information):

  • Device: [Pixel 4A]
  • OS: [Android 12]

Additional context

@andychan06
Copy link
Author

seems like /default/screen.py:

if len(scenario.steps) > step_index >= 0:

this guard makes screenshot not run?

@xiaoxiaocaiiao
Copy link
Collaborator

cannot repro please share the run log. By the way do you find the msg "[screen_link_to_behave]" in the run log?

@andychan06
Copy link
Author

[screen_link_to_behave]

cannot find this message.

my test example from ctrip:

  # language: en
 Feature: flybirds test feature-android click

  Background: 
      When start app[ctrip.android.view]
      And page rendering complete appears element[text=机票]

   Scenario: test click--click position
     And  click position[580,1200]
     And  wait[5]seconds
     Then screenshot
     Then close app

And the result
Screenshot 2022-07-11 at 3 06 34 PM

And the print log
log.txt

There is nothing captured in the screenshot folder.

@xiaoxiaocaiiao
Copy link
Collaborator

xiaoxiaocaiiao commented Jul 11, 2022

een..., it seems that only before step hook is run, but screen step logical is skiped, please debug as below pic:
image

run script please use( "./features/test/android/base_en_click.feature --format=json -o report/1ae9c606-8943-48ec-b0cb-b3e02239fb13/report.json --define screenShotDir=cmVwb3J0LzFhZTljNjA2LTg5NDMtNDhlYy1iMGNiLWIzZTAyMjM5ZmIxMy9zY3JlZW5zaG90 --define run_at=bG9jYWw= --no-color --no-capture --no-capture-stderr" ) and tell me what happen here.

@andychan06
Copy link
Author

een..., it seems that only before step hook is run, but screen step logical is skiped, please debug as blow pic: image

run script please use( "./features/test/android/base_en_click.feature --format=json -o report/1ae9c606-8943-48ec-b0cb-b3e02239fb13/report.json --define screenShotDir=cmVwb3J0LzFhZTljNjA2LTg5NDMtNDhlYy1iMGNiLWIzZTAyMjM5ZmIxMy9zY3JlZW5zaG90 --define run_at=bG9jYWw= --no-color --no-capture --no-capture-stderr" ) and tell me what heppen here.

The problem cannot be reproduced using the demo Ctrip project with my testing feature?

@xiaoxiaocaiiao
Copy link
Collaborator

xiaoxiaocaiiao commented Jul 11, 2022

yes, we are used same demo, i cannot repro on windows os. maybe only mac os has this issue, i will try latter. by the way please report the issue also atthed the machine os.

@andychan06
Copy link
Author

yes, we are used same demo, i cannot repro on windows os. maybe only mac os has this issue, i will try latter. by the way please report the issue also atthed the machine os.

yes, I am using macOS. Btw sorry I may need more time to setup Python from your screenshot configs as I have no experience doing this.

@andychan06
Copy link
Author

tried your suggestion.
reproduce.txt

Please have a look

@xiaoxiaocaiiao
Copy link
Collaborator

tried your suggestion. reproduce.txt

Please have a look
when you complete my suggestion, you can hold on the below code when debug the test case, and see what happen here.
seems like /default/screen.py:

if len(scenario.steps) > step_index >= 0:

this guard makes screenshot not run?

@andychan06
Copy link
Author

yes, the if statement guards the screenshot

Screenshot 2022-07-12 at 11 07 13 AM

 # language: en
 Feature: flybirds test feature-android click

  Background: 
      When start app[ctrip.android.view]
      And page rendering complete appears element[text=机票]

   Scenario: test click--click position
     And  click position[580,1200]
     And  wait[5]seconds
     Then screenshot
     Then close app

@xiaoxiaocaiiao
Copy link
Collaborator

xiaoxiaocaiiao commented Jul 12, 2022

yes, the if statement guards the screenshot

Screenshot 2022-07-12 at 11 07 13 AM

 # language: en
 Feature: flybirds test feature-android click

  Background: 
      When start app[ctrip.android.view]
      And page rendering complete appears element[text=机票]

   Scenario: test click--click position
     And  click position[580,1200]
     And  wait[5]seconds
     Then screenshot
     Then close app

use the workaround : add background to scenario。 i will try to run it and find the final solution。

@andychan06
Copy link
Author

Thanks @xiaoxiaocaiiao, I have used the workaround already.

Look forward to hearing any update.

@xiaoxiaocaiiao
Copy link
Collaborator

Thanks @xiaoxiaocaiiao, I have used the workaround already.

Look forward to hearing any update.
fix in latest build.

@andychan06
Copy link
Author

Thanks @xiaoxiaocaiiao, I have used the workaround already.
Look forward to hearing any update.
fix in latest build.

@xiaoxiaocaiiao thanks for the update. Tested the latest build & confirm it is fixed.

@clgwlg clgwlg closed this as completed Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants