Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
initial screenshots infrastructure (#490)
Browse files Browse the repository at this point in the history
* Added fastlane support, screenshot setup

* added documentation for taking screenshots

* use restmail email

* add a note about 3rd-party

* updated snapshothelper
  • Loading branch information
sashei committed Jun 26, 2018
1 parent a894615 commit 4fd1918
Show file tree
Hide file tree
Showing 14 changed files with 533 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@ xcuserdata
.DS_Store
lockbox-ios/binaries/
site/
fastlane/screenshots/
4 changes: 4 additions & 0 deletions Lockbox.xcodeproj/project.pbxproj
Expand Up @@ -74,6 +74,7 @@
7AA548BBE384D40397D26E9B /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA546C351E7D7C7DE3BEF0C /* RootView.swift */; };
7AA5493A70D5B26D3FF1808B /* StaticURLPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA545D5E7A7EB65733B8A8A /* StaticURLPresenter.swift */; };
7AA54A03CA11221087E4F9F8 /* Date+Spec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA545A802C0592A820AD230 /* Date+Spec.swift */; };
7AA54A18A8CB61CD8D086821 /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA54CF29E6B76D6894A841E /* SnapshotHelper.swift */; };
7AA54A58F7F289BAD2CE21C3 /* ErrorActionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA545A7472772984D517CB0 /* ErrorActionSpec.swift */; };
7AA54A743320656025DC5B3E /* ItemDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA547106248ADBADAF76239 /* ItemDetailCell.swift */; };
7AA54AA7964A1C95FDB7AA6E /* UserDefaults+Spec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AA546618500E909B1E98632 /* UserDefaults+Spec.swift */; };
Expand Down Expand Up @@ -329,6 +330,7 @@
7AA54C72B63B2B4C8200F3F8 /* RootPresenterSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootPresenterSpec.swift; sourceTree = "<group>"; };
7AA54C7A277D5D7C03F4F453 /* MainNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainNavigationController.swift; sourceTree = "<group>"; };
7AA54CDEA56C47263160AD0E /* Dispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dispatcher.swift; sourceTree = "<group>"; };
7AA54CF29E6B76D6894A841E /* SnapshotHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapshotHelper.swift; sourceTree = "<group>"; };
7AA54D3C8D454F79BD580AAF /* UserDefaults+.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserDefaults+.swift"; sourceTree = "<group>"; };
7AA54D4E439D76B910034E2A /* ErrorAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorAction.swift; sourceTree = "<group>"; };
7AA54DC6857783DACB5DA3EC /* ExternalWebsiteNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExternalWebsiteNavigationController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -489,6 +491,7 @@
2C2EC55620ADA85A00AF8C44 /* Info.plist */,
2C2EC56120ADAB1D00AF8C44 /* LockBoxScreenGraph.swift */,
2C2EC56320ADAB5400AF8C44 /* BaseTestCase.swift */,
7AA54CF29E6B76D6894A841E /* SnapshotHelper.swift */,
);
path = LockboxXCUITests;
sourceTree = "<group>";
Expand Down Expand Up @@ -1090,6 +1093,7 @@
2C2EC55520ADA85A00AF8C44 /* LockboxXCUITests.swift in Sources */,
2C2EC56420ADAB5400AF8C44 /* BaseTestCase.swift in Sources */,
2C2EC56220ADAB1D00AF8C44 /* LockBoxScreenGraph.swift in Sources */,
7AA54A18A8CB61CD8D086821 /* SnapshotHelper.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
90 changes: 90 additions & 0 deletions Lockbox.xcodeproj/xcshareddata/xcschemes/uispecs.xcscheme
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2C2EC55120ADA85A00AF8C44"
BuildableName = "LockboxXCUITests.xctest"
BlueprintName = "LockboxXCUITests"
ReferencedContainer = "container:Lockbox.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2C2EC55120ADA85A00AF8C44"
BuildableName = "LockboxXCUITests.xctest"
BlueprintName = "LockboxXCUITests"
ReferencedContainer = "container:Lockbox.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2C2EC55120ADA85A00AF8C44"
BuildableName = "LockboxXCUITests.xctest"
BlueprintName = "LockboxXCUITests"
ReferencedContainer = "container:Lockbox.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2C2EC55120ADA85A00AF8C44"
BuildableName = "LockboxXCUITests.xctest"
BlueprintName = "LockboxXCUITests"
ReferencedContainer = "container:Lockbox.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
4 changes: 4 additions & 0 deletions LockboxXCUITests/BaseTestCase.swift
Expand Up @@ -5,6 +5,8 @@
import MappaMundi
import XCTest

let CONTENT_SIZE = "UICTContentSizeCategoryL"

class BaseTestCase: XCTestCase {
var navigator: MMNavigator<LockboxUserState>!
let app = XCUIApplication()
Expand All @@ -18,6 +20,8 @@ class BaseTestCase: XCTestCase {
override func setUp() {
super.setUp()
continueAfterFailure = false
setupSnapshot(app)
app.launchArguments += [ "-UIPreferredContentSizeCategoryName", CONTENT_SIZE ]
app.launch()
setUpScreenGraph()
}
Expand Down
13 changes: 9 additions & 4 deletions LockboxXCUITests/LockboxXCUITests.swift
Expand Up @@ -10,6 +10,7 @@ let passwordTestAccountLogins = "FRCuQaPm"
class LockboxXCUITests: BaseTestCase {

func test1LoginWithSavedLogins() {
snapshot("01Welcome" + CONTENT_SIZE)
navigator.goto(Screen.FxASigninScreen)
waitforExistence(app.webViews.textFields["Email"])

Expand Down Expand Up @@ -45,8 +46,9 @@ class LockboxXCUITests: BaseTestCase {

// App should start showing the main page
// Instead of waiting we could pull down to refresh to force the logins appear and so the buttons are available
waitforExistence(app.buttons["Finish"])
app.buttons["Finish"].tap()
waitforExistence(app.buttons["finish.button"])
app.buttons["finish.button"].tap()
sleep(8)
waitforExistence(app.navigationBars["Firefox Lockbox"])
XCTAssertTrue(app.buttons["sorting.button"].exists)

Expand All @@ -55,6 +57,7 @@ class LockboxXCUITests: BaseTestCase {

XCTAssertTrue(app.navigationBars["Firefox Lockbox"].exists)
XCTAssertTrue(app.navigationBars.buttons["Settings"].exists)
snapshot("02EntryList" + CONTENT_SIZE)

// Go to Settings to disable the AutoLock
// This is a temporary workaround needed to run other tests after this one until defining a tearDown
Expand All @@ -81,6 +84,8 @@ class LockboxXCUITests: BaseTestCase {

func test2SettingsAccountUI() {
waitforExistence(app.navigationBars["Firefox Lockbox"])
snapshot("03Settings" + CONTENT_SIZE)

navigator.goto(Screen.AccountSettingsMenu)
waitforExistence(app.navigationBars["Account"])
// Some checks can be done here to be sure the Account UI is fine
Expand Down Expand Up @@ -131,8 +136,8 @@ class LockboxXCUITests: BaseTestCase {
// In small screens it is necessary to dismiss the keyboard
app.buttons["Done"].tap()
navigator.performAction(Action.FxATapOnSignInButton)
waitforExistence(app.buttons["Finish"])
app.buttons["Finish"].tap()
waitforExistence(app.buttons["finish.button"])
app.buttons["finish.button"].tap()
waitforExistence(app.navigationBars["Firefox Lockbox"])
}

Expand Down

0 comments on commit 4fd1918

Please sign in to comment.