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

There is no image in xcsummary report by using Xcode 9. #9

Open
vivianLiu-renyu opened this issue Nov 1, 2017 · 4 comments
Open

There is no image in xcsummary report by using Xcode 9. #9

vivianLiu-renyu opened this issue Nov 1, 2017 · 4 comments

Comments

@vivianLiu-renyu
Copy link

Hi ,
I upgraded Xcode to Xcode 9, and run xcsummary via below command

xcsummary -in path to Summary.plist -out path to result.html

Then there isn't any screenshot in report.
Is it cause by the different of image's format?

Thanks.
Vivian

@vivianLiu-renyu
Copy link
Author

After studying the code, I found that it really cause by the different of image's format.
I fixed it by changing the input image format from .png to .jpg and it did work.

Lines I've changed is down below. (Just 2 lines)

NSString *imageName = [NSString stringWithFormat:@"Screenshot_%@.png", activity.uuid.UUIDString];

NSString *localImageName = [NSString stringWithFormat:@"resources/Screenshot_%@.png", activity.uuid.UUIDString];

@Krivoblotsky
Copy link
Contributor

Thanks for the investigation, really appreciate it!
I think that we need to support both "png" and "jpeg", or even disregard image extension to be back compatible.
Could you please submit a pull request with your fix?

@vivianLiu-renyu
Copy link
Author

vivianLiu-renyu commented Nov 2, 2017

I've already submit a pull request with my fix. (#10)

@SpeedyNassir
Copy link

The above change is working, but Xcode 9 no more takes screen shot for success scenarios.

Latest addition of screenshot function, creates screenshots on .png format instead of .jpg, below
code takes screenshots and I am able to see the same in report navigator but not in xcsummary report with current master(.png)

let fullscreenShot = XCUIScreen.main.screenshot()
let fullSCreeshotAttachment = XCTAttachment(screenshot: fullscreenShot)
fullSCreeshotAttachment.lifetime = .keepAlways
self.test.add(fullSCreeshotAttachment)

So:
Xcode takes Automatic screenshot when test failure (.jpg format)
The Screenshot function takes screenshot where ever called (.png format)

Suggestion:
To Add only screenshot taken by latest screenshot function (.png format).
In order to add only failure screenshot in report the screenshot function can be called along with XCTFail

  func scrollToElement(element: XCUIElement) {
        var numberOfSwipes = 0
        while !element.isVisible && numberOfSwipes < 6 {
            numberOfSwipes += 1
            app.swipeUp()
        }
        if !element.isVisible {
            takeScreenshot()
            XCTFail("Element not visible after 30 swipes.")
        }
    }

Reason:
Xcode takes multiple screenshot when you use to scroll or wait functions(Due to scroll times or wait times) for failure scenarios, which makes report bigger in size and longer.

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