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
Automated framed screenshots #28
Conversation
circleci seems to be getting the following error, which I'm not getting on my local machine
|
// - Audio tab home | ||
// - Local Network tab home | ||
// - Video tab home | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This header comment does not follow the format of the project, specially regarding the license part. Please check an existing file as reference.
|
||
override func tearDown() { | ||
super.tearDown() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this method be removed?
// | ||
// Screenshots taken | ||
// - Video playback (Jellyfish) | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, this header comment does not follow the project format
|
||
override func tearDown() { | ||
super.tearDown() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I think this method could be removed
// | ||
// Created by Mike Choi on 3/30/18. | ||
// Copyright © 2018 VideoLAN. All rights reserved. | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Podfile
Outdated
@@ -23,6 +23,7 @@ def iOS_pods | |||
pod 'MediaLibraryKit-prod' | |||
pod 'MobileVLCKit', '3.0.2' | |||
pod 'GTMAppAuth' | |||
pod 'SimulatorStatusMagic', :configurations => ['Debug'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is adding the dependency to the main application targets increasing their bundle sizes. Could it be possible to define it only in the uitests target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving pod 'SimulatorStatusMagic'
to target 'VLC for iOSUITests'
won't allow VLCAppDelegate.m
to import the module, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct! @dcordero correct me if I'm wrong here please.
I think instead of importing it directly you have an extension on Appdelegate for the tests and that extension is only part of the testmodule. You would also not need the debug configuration that way. Though I'm not sure how that works with classmethods. I would take a look at Artsys App here
Great work, the screenshots look awesome !!! I have added a few comments here and there |
The error in circleci means that XCTest is been imported from an Application target. Are the those new swift files included in the test target or the app target? That could be the reason of the error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks already soooo great!! I had some inline comments. I can't wait until this is ready to be merged! :D
Btw for screenshotting we got the permission to use the following files :
https://www.youtube.com/watch?v=ba62uuv-5Dc
https://www.youtube.com/watch?v=6NDYf3RZ1eY
I'm not sure how this would work exactly but there is a way to have these videos (after downloading them from youtube)in the User Directory. That way we actually have files in the Video and Audio tab respectively. This should probably be part of an additional PR though :)
.gitignore
Outdated
@@ -10,7 +10,6 @@ xcuserdata | |||
# Fastlane | |||
fastlane/report.xml | |||
fastlane/Preview.html | |||
fastlane/screenshots |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the fastlane docs it's recommended to not store the screenshots in the repository
https://docs.fastlane.tools/best-practices/source-control/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make modifications based on this guide!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome that's even better! Great find :)
Podfile
Outdated
@@ -23,6 +23,7 @@ def iOS_pods | |||
pod 'MediaLibraryKit-prod' | |||
pod 'MobileVLCKit', '3.0.2' | |||
pod 'GTMAppAuth' | |||
pod 'SimulatorStatusMagic', :configurations => ['Debug'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct! @dcordero correct me if I'm wrong here please.
I think instead of importing it directly you have an extension on Appdelegate for the tests and that extension is only part of the testmodule. You would also not need the debug configuration that way. Though I'm not sure how that works with classmethods. I would take a look at Artsys App here
|
||
class VLCiOSTestMenu: XCTestCase { | ||
let app = XCUIApplication() | ||
let moreTab = XCUIApplication().tabBars.buttons.element(boundBy: 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to get the tab by localized title instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no localizable string for this :(
I think the "More" tab is using Apple's built-in localized strings.
} | ||
|
||
func localizedString(key: String) -> String { | ||
let localizationBundle = Bundle(path: Bundle(for: VLCiOSTestMenu.self).path(forResource: deviceLanguage, ofType: ".lproj")!)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force unwrap is not great. How do you feel about making the tests fail if the localization file can't be loaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally it should be enough to load the bundle once for every language. That would speed up the test
} | ||
|
||
func testNavigationToVideoTab() { | ||
app.tabBars.buttons["Video"].tap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no localizable string ?
func localizedString(key: String) -> String { | ||
let localizationBundle = Bundle(path: Bundle(for: VLCiOSTestMenu.self).path(forResource: deviceLanguage, ofType: ".lproj")!)! | ||
let result = NSLocalizedString(key, bundle: localizationBundle, comment: "") | ||
return result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seeing that this is used here as well it might be even good to have a testhelpers method ? We should definitely not duplicate the code here
fastlane/Snapfile
Outdated
@@ -0,0 +1,13 @@ | |||
devices([ | |||
"iPhone X", | |||
"iPhone 8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will need all the devices :D
fastlane/Snapfile
Outdated
languages([ | ||
"en", | ||
"de", | ||
"fr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will also need all the languages that we support. And yes I know this will take forever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To create the framed screenshots, we need localized keyword.string
and title.string
for each language. Maybe this should be a progressive effort once we officially decide on what text to put on the framed screenshots??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely let's just ask Louis!
} | ||
} | ||
|
||
// Please don't remove the lines below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm expecting that you double checked and understood this file btw :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should switch to the accessibility element identifiers. that will resolve the bundle and localization issues. Also the simulator magic only as part of the Testtarget and adding it in the setup for the tests should resolve the import conundrum
XCUIDevice.shared.orientation = .portrait | ||
setupSnapshot(app) | ||
helper = TestHelper(lang: deviceLanguage, target: VLCiOSTestMenu.self) | ||
app.launch() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This here would actually be a better place for the status magic (but remember to disable it again in tearDown()).
VLC for iOSUITests/TestHelper.swift
Outdated
import XCTest | ||
|
||
struct TestHelper { | ||
let localizationBundle: Bundle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something that I didn't think about in my earlier review but that a friend pointed out is to use accessibility element identifiers. They don’t need to be localized! Since we need to make the app accessibility friendly anyway this will kill two birds with one stone :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it looks like none of the elements in the app has its accessibilityIdentifier
set. How should we go about this? Update every single element's accessibilityIdentifier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes exactly. It needs to be added
helper.tap(tabDescription: audio, app: app) | ||
XCTAssertNotNil(app.navigationBars[audio]) | ||
|
||
snapshot("audio_tab") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw could we separate the Unit Tests from the snapshot taking?
d5bb0a6
to
6956146
Compare
.gitignore
Outdated
fastlane/test_output | ||
|
||
fastlane/screenshots/*/*.png | ||
fastlane/screenshots/screenshots.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will you hate me if I ask for an alphabetically ordered .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at all
7276bcc
to
8978eaf
Compare
looks already better. Could you use the accessibilityidentifier on the tabbaritems and other views as well? We need to avoid all use of the localization bundle otherwise renaming a tab would lead to failing tests for no reason |
"iPad Pro (12.9-inch)", | ||
"iPad Pro (12.9-inch) (2nd generation)", | ||
"iPad Pro (10.5-inch)" | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tests fail on iPad btw but the more tab will disappear anyway soon. And one more question. What are the screenshots doing for a language that is not defined? can we make sure that it uses the screenshots from the English version? |
@carolanitz Right now, |
83c49b1
to
d25f37f
Compare
the merge conflicts just need to be resolved and I think this is good to go |
7036aee
to
5b19e9c
Compare
Fixed all the merge conflicts! |
Perfect status bar displays 100% battery life and 9:41 as the time. This allows for consistent, and perfect screenshoting, 100% of the time
To take framed screenshots, run `fastlane screenshots` Note that the list of supported devices and languages is random for now.
Notice that screenshots for fastlane are taken in the test file by calling `snapshot("IMG_NAME")`
Note that only German, French, and English have been added so far. Design/content for the framed screenshots are BASIC and NEEDS IMPROVEMENT.
iOS test cases are now compatible with both iPhone and iPad.
Note that a new target has been created in the Podfile specifically for iOS UITests.
Fixed bugs regarding change of localization during screenshoting
Note that string literals are being used all over the project to create identifiers. A new file containing all identifier literals should be created in the future.
Fastlane does not support default langauges. Therefore, in order to generate screenshots for all languages, default English keyword.strings and title.strings have been copied for all langauges.
All commits have been squashed! |
@@ -3431,7 +3408,6 @@ | |||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; | |||
CLANG_ANALYZER_NONNULL = YES; | |||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | |||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carolanitz, this fixes the misconfigured in the xcodeproj problem that you discovered!
Major feat in this PR are
fastlane screenshots
with localizationI wasn't sure which screens to capture and what kind of text to put in the frames but here's what I came up with. Here's some demo screenshots in German; thanks to Google Translate😃