More testing code
This commit is contained in:
parent
fda9af2552
commit
a0b7c0f052
@ -49,7 +49,6 @@
|
|||||||
7A49F4AF27D4061A00AEAAE0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7A49F4AD27D4061A00AEAAE0 /* LaunchScreen.storyboard */; };
|
7A49F4AF27D4061A00AEAAE0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7A49F4AD27D4061A00AEAAE0 /* LaunchScreen.storyboard */; };
|
||||||
7A49F4BA27D4061B00AEAAE0 /* AutoCat2Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A49F4B927D4061B00AEAAE0 /* AutoCat2Tests.swift */; };
|
7A49F4BA27D4061B00AEAAE0 /* AutoCat2Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A49F4B927D4061B00AEAAE0 /* AutoCat2Tests.swift */; };
|
||||||
7A49F4C427D4061B00AEAAE0 /* AutoCat2UITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A49F4C327D4061B00AEAAE0 /* AutoCat2UITests.swift */; };
|
7A49F4C427D4061B00AEAAE0 /* AutoCat2UITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A49F4C327D4061B00AEAAE0 /* AutoCat2UITests.swift */; };
|
||||||
7A49F4C627D4061B00AEAAE0 /* AutoCat2UITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A49F4C527D4061B00AEAAE0 /* AutoCat2UITestsLaunchTests.swift */; };
|
|
||||||
7A49F4DB27D4064500AEAAE0 /* AutoCatCore.docc in Sources */ = {isa = PBXBuildFile; fileRef = 7A49F4DA27D4064500AEAAE0 /* AutoCatCore.docc */; };
|
7A49F4DB27D4064500AEAAE0 /* AutoCatCore.docc in Sources */ = {isa = PBXBuildFile; fileRef = 7A49F4DA27D4064500AEAAE0 /* AutoCatCore.docc */; };
|
||||||
7A49F4E127D4064500AEAAE0 /* AutoCatCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A49F4D727D4064500AEAAE0 /* AutoCatCore.framework */; };
|
7A49F4E127D4064500AEAAE0 /* AutoCatCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A49F4D727D4064500AEAAE0 /* AutoCatCore.framework */; };
|
||||||
7A49F4E927D4064500AEAAE0 /* AutoCatCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A49F4D927D4064500AEAAE0 /* AutoCatCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
7A49F4E927D4064500AEAAE0 /* AutoCatCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A49F4D927D4064500AEAAE0 /* AutoCatCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
@ -72,6 +71,8 @@
|
|||||||
7A558AB027FA3CCF001A18EE /* SettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A558AA527FA3CCF001A18EE /* SettingsTests.swift */; };
|
7A558AB027FA3CCF001A18EE /* SettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A558AA527FA3CCF001A18EE /* SettingsTests.swift */; };
|
||||||
7A558AB127FA3CCF001A18EE /* ApiTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A558AA627FA3CCF001A18EE /* ApiTests.swift */; };
|
7A558AB127FA3CCF001A18EE /* ApiTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A558AA627FA3CCF001A18EE /* ApiTests.swift */; };
|
||||||
7A9F2AC327E71531006492A9 /* ACTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A9F2AC227E71531006492A9 /* ACTabBarController.swift */; };
|
7A9F2AC327E71531006492A9 /* ACTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A9F2AC227E71531006492A9 /* ACTabBarController.swift */; };
|
||||||
|
7ABAB2E427FDF7BC00553691 /* check_success.json in Resources */ = {isa = PBXBuildFile; fileRef = 7ABAB2E327FDF7BC00553691 /* check_success.json */; };
|
||||||
|
7ABAB2E627FDF83100553691 /* GenericMethodMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABAB2E527FDF83100553691 /* GenericMethodMock.swift */; };
|
||||||
7AE32D6427F05F89004EF6E0 /* VehicleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE32D6327F05F89004EF6E0 /* VehicleCell.swift */; };
|
7AE32D6427F05F89004EF6E0 /* VehicleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE32D6327F05F89004EF6E0 /* VehicleCell.swift */; };
|
||||||
7AE32D6627F063A1004EF6E0 /* UIEdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE32D6527F063A1004EF6E0 /* UIEdgeInsets.swift */; };
|
7AE32D6627F063A1004EF6E0 /* UIEdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE32D6527F063A1004EF6E0 /* UIEdgeInsets.swift */; };
|
||||||
7AE32D6927F06536004EF6E0 /* CoreDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE32D6827F06536004EF6E0 /* CoreDataSource.swift */; };
|
7AE32D6927F06536004EF6E0 /* CoreDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE32D6827F06536004EF6E0 /* CoreDataSource.swift */; };
|
||||||
@ -178,7 +179,6 @@
|
|||||||
7A49F4B927D4061B00AEAAE0 /* AutoCat2Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCat2Tests.swift; sourceTree = "<group>"; };
|
7A49F4B927D4061B00AEAAE0 /* AutoCat2Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCat2Tests.swift; sourceTree = "<group>"; };
|
||||||
7A49F4BF27D4061B00AEAAE0 /* AutoCat2UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AutoCat2UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
7A49F4BF27D4061B00AEAAE0 /* AutoCat2UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AutoCat2UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
7A49F4C327D4061B00AEAAE0 /* AutoCat2UITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCat2UITests.swift; sourceTree = "<group>"; };
|
7A49F4C327D4061B00AEAAE0 /* AutoCat2UITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCat2UITests.swift; sourceTree = "<group>"; };
|
||||||
7A49F4C527D4061B00AEAAE0 /* AutoCat2UITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCat2UITestsLaunchTests.swift; sourceTree = "<group>"; };
|
|
||||||
7A49F4D727D4064500AEAAE0 /* AutoCatCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AutoCatCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
7A49F4D727D4064500AEAAE0 /* AutoCatCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AutoCatCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
7A49F4D927D4064500AEAAE0 /* AutoCatCore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AutoCatCore.h; sourceTree = "<group>"; };
|
7A49F4D927D4064500AEAAE0 /* AutoCatCore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AutoCatCore.h; sourceTree = "<group>"; };
|
||||||
7A49F4DA27D4064500AEAAE0 /* AutoCatCore.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = AutoCatCore.docc; sourceTree = "<group>"; };
|
7A49F4DA27D4064500AEAAE0 /* AutoCatCore.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = AutoCatCore.docc; sourceTree = "<group>"; };
|
||||||
@ -205,6 +205,8 @@
|
|||||||
7A558AAE27FA3CCF001A18EE /* MockURLProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockURLProtocol.swift; sourceTree = "<group>"; };
|
7A558AAE27FA3CCF001A18EE /* MockURLProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockURLProtocol.swift; sourceTree = "<group>"; };
|
||||||
7A558AAF27FA3CCF001A18EE /* ApiMethodMockProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiMethodMockProtocol.swift; sourceTree = "<group>"; };
|
7A558AAF27FA3CCF001A18EE /* ApiMethodMockProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiMethodMockProtocol.swift; sourceTree = "<group>"; };
|
||||||
7A9F2AC227E71531006492A9 /* ACTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ACTabBarController.swift; sourceTree = "<group>"; };
|
7A9F2AC227E71531006492A9 /* ACTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ACTabBarController.swift; sourceTree = "<group>"; };
|
||||||
|
7ABAB2E327FDF7BC00553691 /* check_success.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = check_success.json; sourceTree = "<group>"; };
|
||||||
|
7ABAB2E527FDF83100553691 /* GenericMethodMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericMethodMock.swift; sourceTree = "<group>"; };
|
||||||
7AE32D6327F05F89004EF6E0 /* VehicleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VehicleCell.swift; sourceTree = "<group>"; };
|
7AE32D6327F05F89004EF6E0 /* VehicleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VehicleCell.swift; sourceTree = "<group>"; };
|
||||||
7AE32D6527F063A1004EF6E0 /* UIEdgeInsets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEdgeInsets.swift; sourceTree = "<group>"; };
|
7AE32D6527F063A1004EF6E0 /* UIEdgeInsets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEdgeInsets.swift; sourceTree = "<group>"; };
|
||||||
7AE32D6827F06536004EF6E0 /* CoreDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataSource.swift; sourceTree = "<group>"; };
|
7AE32D6827F06536004EF6E0 /* CoreDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataSource.swift; sourceTree = "<group>"; };
|
||||||
@ -416,7 +418,6 @@
|
|||||||
children = (
|
children = (
|
||||||
7A2B6CD827FCED6D00519F1E /* Extensions */,
|
7A2B6CD827FCED6D00519F1E /* Extensions */,
|
||||||
7A49F4C327D4061B00AEAAE0 /* AutoCat2UITests.swift */,
|
7A49F4C327D4061B00AEAAE0 /* AutoCat2UITests.swift */,
|
||||||
7A49F4C527D4061B00AEAAE0 /* AutoCat2UITestsLaunchTests.swift */,
|
|
||||||
);
|
);
|
||||||
path = AutoCat2UITests;
|
path = AutoCat2UITests;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -501,6 +502,7 @@
|
|||||||
children = (
|
children = (
|
||||||
7A558AA927FA3CCF001A18EE /* LoginMethodMock.swift */,
|
7A558AA927FA3CCF001A18EE /* LoginMethodMock.swift */,
|
||||||
7A558AAA27FA3CCF001A18EE /* ApiMethodMock.swift */,
|
7A558AAA27FA3CCF001A18EE /* ApiMethodMock.swift */,
|
||||||
|
7ABAB2E527FDF83100553691 /* GenericMethodMock.swift */,
|
||||||
);
|
);
|
||||||
path = Mocks;
|
path = Mocks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -508,6 +510,7 @@
|
|||||||
7A558AAB27FA3CCF001A18EE /* Responses */ = {
|
7A558AAB27FA3CCF001A18EE /* Responses */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
7ABAB2E327FDF7BC00553691 /* check_success.json */,
|
||||||
7A558AAC27FA3CCF001A18EE /* login_success.json */,
|
7A558AAC27FA3CCF001A18EE /* login_success.json */,
|
||||||
);
|
);
|
||||||
path = Responses;
|
path = Responses;
|
||||||
@ -770,6 +773,7 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
7ABAB2E427FDF7BC00553691 /* check_success.json in Resources */,
|
||||||
7A36E55F27FB5A2C0025AACB /* login_success.json in Resources */,
|
7A36E55F27FB5A2C0025AACB /* login_success.json in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -828,7 +832,6 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
7A49F4C627D4061B00AEAAE0 /* AutoCat2UITestsLaunchTests.swift in Sources */,
|
|
||||||
7A2B6CD727FCED0500519F1E /* XCUIApplication.swift in Sources */,
|
7A2B6CD727FCED0500519F1E /* XCUIApplication.swift in Sources */,
|
||||||
7A49F4C427D4061B00AEAAE0 /* AutoCat2UITests.swift in Sources */,
|
7A49F4C427D4061B00AEAAE0 /* AutoCat2UITests.swift in Sources */,
|
||||||
);
|
);
|
||||||
@ -846,6 +849,7 @@
|
|||||||
7A49F4DB27D4064500AEAAE0 /* AutoCatCore.docc in Sources */,
|
7A49F4DB27D4064500AEAAE0 /* AutoCatCore.docc in Sources */,
|
||||||
7A49F50227D406C300AEAAE0 /* StorageService.swift in Sources */,
|
7A49F50227D406C300AEAAE0 /* StorageService.swift in Sources */,
|
||||||
7A49F4FE27D406BA00AEAAE0 /* AnyEncodable.swift in Sources */,
|
7A49F4FE27D406BA00AEAAE0 /* AnyEncodable.swift in Sources */,
|
||||||
|
7ABAB2E627FDF83100553691 /* GenericMethodMock.swift in Sources */,
|
||||||
7A49F51227D406CB00AEAAE0 /* VName.swift in Sources */,
|
7A49F51227D406CB00AEAAE0 /* VName.swift in Sources */,
|
||||||
7A1D80E827F30399007BD64F /* VModel.swift in Sources */,
|
7A1D80E827F30399007BD64F /* VModel.swift in Sources */,
|
||||||
7A49F51127D406CB00AEAAE0 /* PlateNumber.swift in Sources */,
|
7A49F51127D406CB00AEAAE0 /* PlateNumber.swift in Sources */,
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class VehicleCell: UITableViewCell {
|
|||||||
let view = PlateView(frame: .zero)
|
let view = PlateView(frame: .zero)
|
||||||
view.fontSize = 48
|
view.fontSize = 48
|
||||||
view.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
view.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
|
view.accessibilityIdentifier = "plateView"
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@ -133,11 +133,13 @@ class PNKeyboard: UIView, UIInputViewAudioFeedback, PNButtonDelegate {
|
|||||||
let letters: [PNButton] = Constants.pnLettersMap.keys.sorted().map { letter in
|
let letters: [PNButton] = Constants.pnLettersMap.keys.sorted().map { letter in
|
||||||
let button = PNButton(letter: letter)
|
let button = PNButton(letter: letter)
|
||||||
button.delegate = self
|
button.delegate = self
|
||||||
|
button.accessibilityIdentifier = String(letter) + "_button"
|
||||||
return button
|
return button
|
||||||
}
|
}
|
||||||
let digits: [PNButton] = [1,2,3,4,5,6,7,8,9,0].map { digit in
|
let digits: [PNButton] = [1,2,3,4,5,6,7,8,9,0].map { digit in
|
||||||
let button = PNButton(digit: digit)
|
let button = PNButton(digit: digit)
|
||||||
button.delegate = self
|
button.delegate = self
|
||||||
|
button.accessibilityIdentifier = String(digit) + "_button"
|
||||||
return button
|
return button
|
||||||
}
|
}
|
||||||
let backspace = PNButton(imageName: "delete.left", type: .backspace)
|
let backspace = PNButton(imageName: "delete.left", type: .backspace)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class PlateView: UIView {
|
|||||||
var number: PlateNumber? {
|
var number: PlateNumber? {
|
||||||
didSet {
|
didSet {
|
||||||
self.layoutSubviews()
|
self.layoutSubviews()
|
||||||
|
self.accessibilityLabel = number?.asString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class CheckController: UIViewController {
|
|||||||
view.number = PlateNumber("")
|
view.number = PlateNumber("")
|
||||||
view.onChange = onNumberChanged
|
view.onChange = onNumberChanged
|
||||||
view.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
view.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
|
view.accessibilityIdentifier = "plateView"
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ class CheckController: UIViewController {
|
|||||||
let button = ACButton(title: "Check", onTap: check)
|
let button = ACButton(title: "Check", onTap: check)
|
||||||
button.isEnabled = false
|
button.isEnabled = false
|
||||||
button.contentEdgeInsets = .init(top: 0, left: 8, bottom: 0, right: 8)
|
button.contentEdgeInsets = .init(top: 0, left: 8, bottom: 0, right: 8)
|
||||||
|
button.accessibilityIdentifier = "checkButton"
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class HistoryController: UIViewController {
|
|||||||
let cellIdentifier = String(describing: VehicleCell.self)
|
let cellIdentifier = String(describing: VehicleCell.self)
|
||||||
table.register(VehicleCell.self, forCellReuseIdentifier: cellIdentifier)
|
table.register(VehicleCell.self, forCellReuseIdentifier: cellIdentifier)
|
||||||
table.translatesAutoresizingMaskIntoConstraints = false
|
table.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
table.accessibilityIdentifier = "historyTable"
|
||||||
return table
|
return table
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@ -25,10 +25,16 @@ class AutoCat2UITests: XCTestCase {
|
|||||||
func testExample() throws {
|
func testExample() throws {
|
||||||
|
|
||||||
let app = XCUIApplication()
|
let app = XCUIApplication()
|
||||||
app.launchArguments += ["UI-TESTING"]
|
app.setTestKind(.addNumberSuccess)
|
||||||
app.launchEnvironment["testKind"] = Testing.TestKind.addNumberSuccess.rawValue
|
|
||||||
app.launch()
|
app.launch()
|
||||||
|
|
||||||
app.auth(login: testLogin, password: testPassword)
|
app.auth(login: testLogin, password: testPassword)
|
||||||
|
app.enterPlateNumber("Н282СН61")
|
||||||
|
|
||||||
|
XCTAssert(app.tables["historyTable"].waitForExistence(timeout: 3), "History tableView not found")
|
||||||
|
|
||||||
|
let firstCell = app.cells.firstMatch
|
||||||
|
let plateView = firstCell.otherElements["plateView"].firstMatch
|
||||||
|
print(plateView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
//
|
|
||||||
// AutoCat2UITestsLaunchTests.swift
|
|
||||||
// AutoCat2UITests
|
|
||||||
//
|
|
||||||
// Created by Selim Mustafaev on 05.03.2022.
|
|
||||||
//
|
|
||||||
|
|
||||||
import XCTest
|
|
||||||
|
|
||||||
class AutoCat2UITestsLaunchTests: XCTestCase {
|
|
||||||
|
|
||||||
override class var runsForEachTargetApplicationUIConfiguration: Bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
override func setUpWithError() throws {
|
|
||||||
continueAfterFailure = false
|
|
||||||
}
|
|
||||||
|
|
||||||
func testLaunch() throws {
|
|
||||||
let app = XCUIApplication()
|
|
||||||
app.launch()
|
|
||||||
|
|
||||||
// Insert steps here to perform after app launch but before taking a screenshot,
|
|
||||||
// such as logging into a test account or navigating somewhere in the app
|
|
||||||
|
|
||||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
|
||||||
attachment.name = "Launch Screen"
|
|
||||||
attachment.lifetime = .keepAlways
|
|
||||||
add(attachment)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -7,9 +7,15 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
|
import AutoCatCore
|
||||||
|
|
||||||
extension XCUIApplication {
|
extension XCUIApplication {
|
||||||
|
|
||||||
|
func setTestKind(_ kind: Testing.TestKind) {
|
||||||
|
launchArguments += ["UI-TESTING"]
|
||||||
|
launchEnvironment["testKind"] = kind.rawValue
|
||||||
|
}
|
||||||
|
|
||||||
func auth(login: String, password: String) {
|
func auth(login: String, password: String) {
|
||||||
|
|
||||||
let loginButton = buttons["loginButton"]
|
let loginButton = buttons["loginButton"]
|
||||||
@ -27,4 +33,18 @@ extension XCUIApplication {
|
|||||||
let newButtonFound = buttons["NewCheckButton"].waitForExistence(timeout: 3)
|
let newButtonFound = buttons["NewCheckButton"].waitForExistence(timeout: 3)
|
||||||
XCTAssert(newButtonFound, "New button not found")
|
XCTAssert(newButtonFound, "New button not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func enterPlateNumber(_ number: String) {
|
||||||
|
|
||||||
|
buttons["NewCheckButton"].tap()
|
||||||
|
|
||||||
|
XCTAssert(otherElements["plateView"].waitForExistence(timeout: 3), "PlateView not found")
|
||||||
|
|
||||||
|
for character in number {
|
||||||
|
let id = String(character) + "_button"
|
||||||
|
buttons[id].tap()
|
||||||
|
}
|
||||||
|
|
||||||
|
buttons["checkButton"].tap()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
AutoCatCore/Testing/Api/Mocks/GenericMethodMock.swift
Normal file
22
AutoCatCore/Testing/Api/Mocks/GenericMethodMock.swift
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// GenericMethodMock.swift
|
||||||
|
// AutoCatCore
|
||||||
|
//
|
||||||
|
// Created by Selim Mustafaev on 06.04.2022.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class GenericMethodMock: ApiMethodMock {
|
||||||
|
|
||||||
|
private var responsFileName: String
|
||||||
|
|
||||||
|
init(httpMethod: String, path: String, responsFileName: String) {
|
||||||
|
self.responsFileName = responsFileName
|
||||||
|
super.init(httpMethod: httpMethod, path: path)
|
||||||
|
}
|
||||||
|
|
||||||
|
override func response(headers: [String : String], params: [String : Any]) -> (status: Int, data: Data?) {
|
||||||
|
return (status: 200, data: readData(from: responsFileName))
|
||||||
|
}
|
||||||
|
}
|
||||||
116
AutoCatCore/Testing/Api/Responses/check_success.json
Normal file
116
AutoCatCore/Testing/Api/Responses/check_success.json
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"data": {
|
||||||
|
"_id": "5fe34cfb20cf018658f18d4b",
|
||||||
|
"brand": {
|
||||||
|
"name": {
|
||||||
|
"original": "ВАЗ 21150",
|
||||||
|
"normalized": "LADA (ВАЗ)"
|
||||||
|
},
|
||||||
|
"logo": "https://vl.imgix.net/img/lada-logo.png"
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"name": {
|
||||||
|
"normalized": "2115"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"color": null,
|
||||||
|
"year": 2002,
|
||||||
|
"category": "B",
|
||||||
|
"engine": {
|
||||||
|
"number": "3300017",
|
||||||
|
"volume": 1499,
|
||||||
|
"powerHp": 77.5,
|
||||||
|
"powerKw": 57,
|
||||||
|
"fuelType": "Бензиновый"
|
||||||
|
},
|
||||||
|
"number": "Н282СН61",
|
||||||
|
"currentNumber": "Н282СН61",
|
||||||
|
"vin1": "XTA2*********2396",
|
||||||
|
"vin2": null,
|
||||||
|
"sts": "991****596",
|
||||||
|
"pts": "61НН346358",
|
||||||
|
"isRightWheel": false,
|
||||||
|
"isJapanese": false,
|
||||||
|
"photos": [],
|
||||||
|
"addedDate": 1608731898844,
|
||||||
|
"addedBy": "selim@fastmail.fm",
|
||||||
|
"ownershipPeriods": null,
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"direction": -1,
|
||||||
|
"address": "1 Stockton St",
|
||||||
|
"speed": -1,
|
||||||
|
"latitude": 37.785834,
|
||||||
|
"longitude": -122.406417,
|
||||||
|
"date": 1608731886.363112,
|
||||||
|
"id": "094f6ae3-a330-452a-b208-6b55a05d0e85"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"direction": -1,
|
||||||
|
"address": "улица Тимофеева, 13/1",
|
||||||
|
"speed": -1,
|
||||||
|
"latitude": 47.31775516651645,
|
||||||
|
"longitude": 39.79265569871447,
|
||||||
|
"date": 1617303669.4402928,
|
||||||
|
"id": "67b1d78c-451c-4633-bbe6-2d3d50041654"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"direction": -1,
|
||||||
|
"address": "1 Stockton St",
|
||||||
|
"speed": -1,
|
||||||
|
"latitude": 37.785834,
|
||||||
|
"longitude": -122.406417,
|
||||||
|
"date": 1617461917.608279,
|
||||||
|
"id": "f9c68279-14c0-4816-bceb-83cc22a0f71b"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ads": [
|
||||||
|
{
|
||||||
|
"id": 66089132,
|
||||||
|
"url": "https://rostov-na-donu.drom.ru/lada/2115/33471772.html",
|
||||||
|
"price": "87000",
|
||||||
|
"date": 1554670800,
|
||||||
|
"mileage": "107000",
|
||||||
|
"region": "Ростовская область",
|
||||||
|
"city": "Ростов-на-Дону",
|
||||||
|
"adDescription": "",
|
||||||
|
"photos": [
|
||||||
|
"https://s.nomerogram.ru/photo/anc_MawzZ3O_hl7no_eB9gbm0-WKIhAuv-DnTy9ns6ew2phAq9sAY5UP6YIUjNHhQBgSUYaZGDZk47hEbqo4iAM9NfR8.jpg",
|
||||||
|
"https://s.nomerogram.ru/photo/sxIsdctpGDKZBe-MJRBSy2uXMEln04vk_hK12fe04IkOctMRYhnLlO8AjKNzA8FBEf4of-p0ZYn_q4wkBcabiPGFCXPd.jpg",
|
||||||
|
"https://s.nomerogram.ru/photo/eO8K4Q8QkRvT-b9EYXqbAlUNlzLnv6h0l4YfqWcL6wvVpwnC9lKQmHyzwncTh5EXCTXtXKaE0VoiICLDaAZy54HChMbe.jpg",
|
||||||
|
"https://s.nomerogram.ru/photo/rAiWJpaO1jT_cAucLJg6APiR10-YVCWSQQXARLurj_RHuce2A2TNXY8_xt0e6dRBdRlwJEaTS_O2V4KPxWvznHhVTsGx.jpg",
|
||||||
|
"https://s.nomerogram.ru/photo/uD35kAplNFZzNZ8HFXmTI6WWrZs019fcqcAE-WOz1eC954WHD6x_8x2YmoUk3GcyzDxk3XpFkK87wYF8X7ti5quOkt1G.jpg"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 93154461,
|
||||||
|
"url": "https://vk.com/wall-46400154_151663",
|
||||||
|
"price": null,
|
||||||
|
"date": 1385496000,
|
||||||
|
"mileage": null,
|
||||||
|
"region": null,
|
||||||
|
"city": null,
|
||||||
|
"adDescription": "Люди пришли, люди ушли.Главное смотреть, кто остается, а остаются лишь единицы, которые по-настоящему тебя уважают и дорожат тобой и вашей дружбой.",
|
||||||
|
"photos": [
|
||||||
|
"https://s.nomerogram.ru/photo/MzGKkDzsSLOdp7T3lY9k3wsr0ba_GlXsuVIgpqLGO4yWFkmhjzCCbgUplfY-UPBk1bC5jQlBA70ZBtdFELZwG8Q.jpg"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"osagoContracts": [
|
||||||
|
{
|
||||||
|
"number": "ХХХ 0081681698",
|
||||||
|
"name": "ПАО СК \"Росгосстрах\"",
|
||||||
|
"status": "Прекратил действие",
|
||||||
|
"restrictions": "Ограничен список лиц, допущенных к управлению (допущено: 1 чел.)",
|
||||||
|
"insurant": "В***** КОНСТАНТИН ВЛАДИМИРОВИЧ 29.10.1984",
|
||||||
|
"owner": "В***** КОНСТАНТИН ВЛАДИМИРОВИЧ 29.10.1984",
|
||||||
|
"usageRegion": "Кемеровская область - Кузбасс обл, г Кемерово",
|
||||||
|
"plateNumber": "Н282СН61",
|
||||||
|
"vin": "XTA21150023172396",
|
||||||
|
"date": 1609323908.469239
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"updatedDate": 1649262418510
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -41,7 +41,8 @@ public struct Testing {
|
|||||||
var map = ApiMockMap()
|
var map = ApiMockMap()
|
||||||
|
|
||||||
map[.addNumberSuccess] = [
|
map[.addNumberSuccess] = [
|
||||||
LoginMethodMock(login: testEmail, password: testPassword)
|
LoginMethodMock(login: testEmail, password: testPassword),
|
||||||
|
GenericMethodMock(httpMethod: "POST", path: "vehicles/check", responsFileName: "check_success")
|
||||||
]
|
]
|
||||||
|
|
||||||
return map
|
return map
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user