Skip to content

Commit

Permalink
Merge pull request #54 from makeen-project/fixes/E2ETest-cases-fixes
Browse files Browse the repository at this point in the history
[Makeen] [E2E] Added xcov code coverage tool & Fixed E2E test cases
  • Loading branch information
dochiana authored Oct 12, 2023
2 parents 9a9c9ce + 38c70ca commit bc5d7c7
Show file tree
Hide file tree
Showing 33 changed files with 3,351 additions and 69 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/test-ios-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
name: Run E2E Tests for iOS
on:
workflow_dispatch:
push:
branches:
- main
- "**_main"
pull_request:
branches: [main]
jobs:
test-iOS:
name: Test iOS App
runs-on: macos-13
runs-on: macos-13-xl
steps:
- uses: actions/checkout@v2

- name: Select xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.3"

- name: Setup Bundler
working-directory: ./LocationServices
run: |
Expand Down Expand Up @@ -45,7 +40,7 @@ jobs:

- name: Run tests on iPhone
working-directory: ./LocationServices
run: bundle exec fastlane run_e2e_tests device:"iPhone 14"
run: bundle exec fastlane run_e2e_tests device:"iPhone 12,OS=16.4"

- name: Upload test results
uses: actions/upload-artifact@v3
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Select xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
version: "14.3"

- name: Setup Bundler
working-directory: ./LocationServices
run: |
Expand Down
2 changes: 2 additions & 0 deletions LocationServices/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ amplifytools.xcconfig
.secret-*
**.sample
#amplify-do-not-edit-end
xcov_output/
test_output/
97 changes: 97 additions & 0 deletions LocationServices/.xcovignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Exclude all dependencies
- Frameworks/
- SnapKit
- SnapKit/

# Exclude all files ending by "View.swift"
- .*View.swift
- .*Views.swift
- .*Cell.swift
- .*VC.swift
- .*Builder.swift
- .*Service.swift
- .*Coordinator.swift

- LocationServicesTests/
- LocationServicesUITests/
- Resources/
- Views/

- StringConstants.swift
- UIViewController+Extension.swift
- LSUserLocationHeadingArrowLayer.swift
- UITapGestureRecognizer+Extensions.swift
- GeofenceServiceable.swift
- ExplorePresentation.swift
- UITableView+Extension.swift
- TabBarCoordinatorConstants.swift
- MapviewOverlayItems.swift
- Sequence+Extension.swift
- NetworkCore.swift
- TrackingHistoryViewModel.swift
- Endpoint.swift
- RoutingServiceable.swift
- ImageAnnotation.swift
- ExploreMapStyleCellViewModel.swift
- LSUserLocationHeadingBeamLayer.swift
- AddGeofenceNameTextField.swift
- TrackingServiceable.swift
- UIDevice+Extensions.swift
- ResetPasswordViewModel.swift
- AmazonLocationButton.swift
- BottomSheetTransitioningDelegate.swift
- PlacesEndpoint.swift
- TrackingDashboard.swift
- HTTPClient.swift
- AddGeofenceMessageTextField.swift
- Textfield+Extension.swift
- AmazonLocationLabel.swift
- BottomSheetController.swift
- AuthActionsHelper.swift
- PostLoginViewModel.swift
- UnitSceneViewModel.swift
- SettingsViewModel.swift
- UIImageView+Extension.swift
- GeofenceAnnotation.swift
- ErrorHandler.swift
- SideBarViewModel.swift
- LocationServiceable.swift
- UIApplication+Extension.swift
- AlertPresenter.swift
- SearchPresentation.swift
- MGLMapViewDelegate+Extension.swift
- SearchCellViewModel.swift
- GeofenceDataModel.swift
- KeyboardObserver.swift
- AppDelegate.swift
- SearchTextField.swift
- AWSEndpoint+Extension.swift
- SplashViewModel.swift
- MapStyleTypes+Image.swift
- MapStyleTypes.swift61.90%
- UIStackView+Extensions.swift62.50%
- ExploreMapStyleViewModel.swift64.71%
- MapFloatingViewHandler.swift68.63%
- LocationServicesCustomFonts.swift71.43%
- POICardViewModel.swift
- UIStackView+Extensions.swift
- ExploreMapStyleViewModel.swift
- MapStyleTypes.swift
- SceneDelegate.swift
- MapFloatingViewHandler.swift
- LocationServicesCustomFonts.swift
- ExploreContracts.swift
- Locale+Extension.swift
- LargeTitleLabel.swift
- LoginViewModel.swift
- AWSSignatureDelegate.swift
- LocationManager.swift
- GeneralHelper.swift
- UISplitViewController+Extension.swift
- DataProviderViewModel.swift
- NavigationViewModel.swift

# Commenting partial code coverage files due to some code is not able to covered in unit test cases. Need refactoring
- GeofenceDashboardViewModel.swift
- TrackingViewModel.swift
- ExploreViewModel.swift
1 change: 1 addition & 0 deletions LocationServices/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "https://rubygems.org"

gem "fastlane"
gem "xcov"
10 changes: 10 additions & 0 deletions LocationServices/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ GEM
simctl (1.6.10)
CFPropertyList
naturally
slack-notifier (2.4.0)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
Expand All @@ -203,10 +204,18 @@ GEM
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
xcov (1.8.1)
fastlane (>= 2.141.0, < 3.0.0)
multipart-post
slack-notifier
terminal-table
xcodeproj
xcresult (~> 0.2.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
xcresult (0.2.1)

PLATFORMS
arm64-darwin-22
Expand All @@ -216,6 +225,7 @@ PLATFORMS

DEPENDENCIES
fastlane
xcov

BUNDLED WITH
2.2.27
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:LocationServices.xcodeproj",
"identifier" : "963EBF4E29AF92F5001961F2",
"name" : "LocationServicesTests"
}
},
{
"skippedTests" : [
"AWSConnectUITests\/testConnectAWSAccount()",
"AWSConnectUITests\/testConnectAWSAccountFromGeofence()",
"AWSConnectUITests\/testConnectAWSAccountFromTracking()",
"AWSConnectUITests\/testSignInAWSAccount()",
"GeofenceUITests\/testAddGeofence()",
"GeofenceUITests\/testDeleteGeofence()",
"GeofenceUITests\/testEditGeofence()",
"MapUITests\/testMapAppearance()",
"MapUITests\/testMapMaxZoomIn()",
"MapUITests\/testMapMaxZoomOut()",
"TrackingUITests\/testStartTracking()",
"TrackingUITests\/testStartTrackingHistoryStarted()",
"TrackingUITests\/testStopTracking()",
"TrackingUITests\/testTrackingNotifyEnteredGeofence()"
],
"target" : {
"containerPath" : "container:LocationServices.xcodeproj",
"identifier" : "8AB3F18F29C8A1C3008FDF37",
Expand Down
2 changes: 2 additions & 0 deletions LocationServices/LocationServices.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@
F17BE2AF29F819C2001A4ADF /* SearchViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewModelTests.swift; sourceTree = "<group>"; };
F18BD5092AC481DA008FD008 /* AWSLoginServiceMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AWSLoginServiceMock.swift; sourceTree = "<group>"; };
F19616BD2AC45E530070172F /* GeofenceDashboardViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeofenceDashboardViewModelTests.swift; sourceTree = "<group>"; };
F1B060962AD0209C0020CD8C /* LocationServicesUITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = LocationServicesUITests.xctestplan; sourceTree = "<group>"; };
F1B2388229EFD402001E2066 /* DirectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DirectionViewModelTests.swift; sourceTree = "<group>"; };
F1B2388429F011C5001E2066 /* POICardViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = POICardViewModelTests.swift; sourceTree = "<group>"; };
F1B2388629F01B88001E2066 /* AboutViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewModelTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1323,6 +1324,7 @@
AD2AF023292E892000149904 = {
isa = PBXGroup;
children = (
F1B060962AD0209C0020CD8C /* LocationServicesUITests.xctestplan */,
F1021F4A2A1B864400B84312 /* LocationServicesUnitTests.xctestplan */,
F1F8063229D7683E002BDF85 /* TrackingSimulateLocation.xctestplan */,
8A60E81E29D3272100F40DC8 /* LocationServices.xctestplan */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AD2AF02B292E892000149904"
BuildableName = "LocationServices.app"
BlueprintName = "LocationServices"
ReferencedContainer = "container:LocationServices.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Test"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:LocationServices.xcodeproj/LocationServices.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:TrackingSimulateLocation.xctestplan">
</TestPlanReference>
</TestPlans>
</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">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AD2AF02B292E892000149904"
BuildableName = "LocationServices.app"
BlueprintName = "LocationServices"
ReferencedContainer = "container:LocationServices.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AD2AF02B292E892000149904"
BuildableName = "LocationServices.app"
BlueprintName = "LocationServices"
ReferencedContainer = "container:LocationServices.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct ViewsIdentifiers {
static let routingButton = "RoutingButton"
static let closeButton = "CloseButton"
static let imageAnnotationView = "ImageAnnotationView"
static let bottomGrabberView = "BottomGrabberView"
static let sideBarTableView = "SideBarTableView"
}

struct Explore {
Expand Down Expand Up @@ -121,5 +123,6 @@ struct ViewsIdentifiers {
static let trackingStoppedLabel = "TrackingStoppedLabel"
static let deleteTrackingDataButton = "DeleteTrackingDataButton"
static let trackingAnnotationImage = "TrackingAnnotationImage"
static let trackingHistoryScrollView = "TrackingHistoryScrollView"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class SplitViewTrackingMapCoordinator: Coordinator {
let controller = TrackingDashboardBuilder.create()
controller.delegate = self
controller.trackingHistoryHandler = { [weak self] in
self?.showTrackingHistory()
self?.showTrackingHistory(isTrackingActive: true)
}
return controller
}()
Expand Down Expand Up @@ -86,6 +86,9 @@ extension SplitViewTrackingMapCoordinator: TrackingNavigationDelegate {
guard splitViewController.viewController(for: .secondary) == secondaryController else { return }
supplementaryNavigationController?.setViewControllers([controller],
animated: true)

// Starting tracking by default when tapping on Enable tracking button
NotificationCenter.default.post(name: Notification.updateStartTrackingButton, object: nil, userInfo: ["state": isTrackingActive])
}

func showMapStyleScene() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ extension UIViewController {

func createGrabberView() -> UIView {
let grabberView = UIView()
grabberView.accessibilityIdentifier = ViewsIdentifiers.General.bottomGrabberView
grabberView.backgroundColor = .systemGray4
grabberView.layer.cornerRadius = 2.5
grabberView.translatesAutoresizingMaskIntoConstraints = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,13 @@ final class AddGeofenceVC: UIViewController {
case .success:
self?.sentGeofenceRefreshNotification = true
NotificationCenter.default.post(name: Notification.geofenceAdded, object: nil, userInfo: ["model": self?.cacheSaveModel as Any])
self?.delegate?.dismissCurrentBottomSheet(geofences: self?.viewModel.activeGeofencesLists ?? [], shouldDashboardShow: true)
if(UIDevice.current.userInterfaceIdiom == .phone){
self?.delegate?.dismissCurrentBottomSheet(geofences: self?.viewModel.activeGeofencesLists ?? [], shouldDashboardShow: true)
}
else {
self?.closeScreen()
}

case .failure(let error):
let model = AlertModel(title: StringConstant.error, message: error.localizedDescription, cancelButton: nil)
self?.showAlert(model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class SideBarVC: UIViewController {

let tableView: UITableView = {
var tableView = UITableView()
tableView.accessibilityIdentifier = ViewsIdentifiers.General.sideBarTableView
return tableView
}()

Expand Down
Loading

0 comments on commit bc5d7c7

Please sign in to comment.