Mercurial > public > simoleon
changeset 133:f54d3dabb2d3
Update test for screenshots
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Mon, 16 Aug 2021 18:22:55 +0100 |
parents | 9439c76e6590 |
children | 4165f76972d1 |
files | SimoleonScreenshots/SimoleonScreenshots.swift |
diffstat | 1 files changed, 25 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/SimoleonScreenshots/SimoleonScreenshots.swift Mon Aug 16 18:22:46 2021 +0100 +++ b/SimoleonScreenshots/SimoleonScreenshots.swift Mon Aug 16 18:22:55 2021 +0100 @@ -6,12 +6,14 @@ // import XCTest - +import CoreData +// Automate screenshots with Fastlane class SimoleonScreenshots: XCTestCase { var screnshotEndingName = "" override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. + // This method is called before the invocation of each test method in the class. + if UIDevice.current.userInterfaceIdiom == .pad { XCUIDevice.shared.orientation = .landscapeLeft screnshotEndingName = "-force_landscapeleft" @@ -23,51 +25,50 @@ // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false - - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } override func tearDownWithError() throws { // Put teardown code here. This method is called after the invocation of each test method in the class. } - // MARK: - Automate screenshots - func testLaunch() { + func testLaunchScreenshot() throws { if UIDevice.current.userInterfaceIdiom == .pad { - XCUIApplication().tables.buttons.firstMatch.tap() + XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() } + sleep(2) snapshot("1Launch\(screnshotEndingName)") } - func testCurrencySelector() { + func testConvertAmountScreenshot() throws { if UIDevice.current.userInterfaceIdiom == .pad { - XCUIApplication().tables.buttons.firstMatch.tap() + XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() } - XCUIApplication().scrollViews.buttons.firstMatch.tap() - snapshot("2CurrencySelector\(screnshotEndingName)") - - XCUIApplication().tables.buttons.element(boundBy: 6).tap() - let conversionTextfield = XCUIApplication().textFields.firstMatch - conversionTextfield.tap() - for _ in (0..<4) { - conversionTextfield.typeText(XCUIKeyboardKey.delete.rawValue) + let conversionTextField = XCUIApplication().textFields["ConversionTextField"] + conversionTextField.tap() + conversionTextField.typeText("1030.15\n") + snapshot("2Conversion\(screnshotEndingName)") + } + + func testCurrencySelectorScreenshot() throws { + if UIDevice.current.userInterfaceIdiom == .pad { + XCUIApplication().tables["Sidebar"].buttons["NavigateToConversion"].tap() } - conversionTextfield.typeText("\n") - - snapshot("3Amount\(screnshotEndingName)") + XCUIApplication().scrollViews.buttons["OpenCurrencySelector"].tap() + snapshot("3CurrencySelector\(screnshotEndingName)") } - func testFavorites() throws { - // Go to favorites + func testFavoriteScreenshot() throws { if UIDevice.current.userInterfaceIdiom == .pad { - XCUIApplication().tables.buttons.element(boundBy: 1).tap() + XCUIApplication().tables["Sidebar"].buttons["NavigateToFavorites"].tap() } else { XCUIApplication().tabBars.buttons.element(boundBy: 1).tap() } - + + sleep(1) + snapshot("4Favorites\(screnshotEndingName)") } }