Enfoque moderno para probar la localización en iOS

¡Hola! Hablemos de cómo ahora, en 2020, puede probar una aplicación iOS multilingüe si no desea verificar la localización manualmente.


imagen


— -, . ( ), . : , , , . . , , , .


imagen


Product Owner . , — , .


imagen


: , .


imagen


6-7 .



Exness Mobile Trader.


, WebSocket. . , . : , - . — push-.


imagen


, . .


2017 , 70% - , . . , . 2017- . . . , BDD-, API Postman. 2018 , - , .



— . , , .


— , , ?


Crowdin — . , Jira, : , , . , . .


Crowdin : XML, YML, JSON, . . - : , . Crowdin API. . , - , . , , , , .


Crowdin .


: ?
LinguanApp — «» Xcode-, - . , , - . : . LinguanApp : , . , , .


: LinguanApp , , Crowdin.



, . , , — , , . , . , , :


imagen


? , , , : 14 . iPhone ( , iPhone SE), 6 15 = 90 « — ». . , . .


-, : iPhone Xs Max, iPhone X, 6S 6 plus. , , . Display Zoom:


imagen



? , . iPhone 6S, Display Zoom iPhone 5. iOS 11 iPhone Xs Display Zoom, Xr Xs Max .


. . , .



. , . UI-. UI-, , . , accessebility Identifier’:


signinButton.accessebilityIdentifier = "btn_auth"

, Identity Inspector Xcode.


, , . Swift XCTest.


func testTutorial() {
        tutorialButton.tap()
        waitForElementToDissappear(element: tutorialButton, timeout: 5)
        makeScreenshot()
        for _ in 1...4 {
            app.swipeLeft()
            makeScreenshot()
        }
        tutorialCloseButton.tap()
        waitForElementToDissappear(element: tutorialCloseButton, timeout: 3)
    }

, Tutorial. . , . tutorial , .


:



Stackoverflow :


func makeScreenshot() {
        XCTContext.runActivity(named: "Making a full screenshot and saving it") { (activity) in
            let screen = XCUIScreen.main
            let fullscreenshot = screen.screenshot()
            let fullScreenshotAttachment = XCTAttachment(screenshot: fullscreenshot)
            fullScreenshotAttachment.lifetime = .keepAlways
            activity.add(fullScreenshotAttachment)
        }
    }

:


func waitForElementToDissappear(element: XCUIElement, timeout: Double) {
        let doesNotExistPredicate = NSPredicate(format: "exists == FALSE")
        expectation(for: doesNotExistPredicate, evaluatedWith: element, handler: nil)
        waitForExpectations(timeout: timeout, handler: nil)
    }

.


Fastlane, . , .


:


imagen



SnapshotHelper.swift Snapfile, .
Fastlane UI Test Target. UI Test Bundle:


imagen



:


imagen



Target membership .
. , shared. , Build :


imagen



Test :


imagen



Fastlane setUp(), -:


override func setUp() {
        continueAfterFailure = false
        setupnapshot(app)
        app.launch()
    }

, , Fastlane. makeScreenshot() snapshot("snapshot_name"), Fastlane .


, . :


func testTutorial() {
        tutorialButton.tap()
        waitForElementToDissappear(element: tutorialButton, timeout: 5)
        snapshot("Tutorial_page_1")
        var i: Int = 2
        repeat {
            app.swipeLeft()
            snapshot("Tutorial_page_\(i)")
            i += 1
        } while i <= 5
        tutorialCloseButton.tap()
        waitForElementToDissappear(element: tutorialCloseButton, timeout: 3)
    }

4 5 : , , , . , — , . :


imagen



list of device , ; , UI-, . , , — .


fastlane snapshot HTML- , , .


Fastlane . 5 4 5 28 . . Fastlane.


— XCTest Plan. WWDC 2019 Xcode 11. : , , . , XCTest Plan Xcode .


. , , XCTest Plan:


imagen



:


imagen



. application language:


imagen



Shared settings system language, , , :


imagen



. :


—> Run yourTestName():


imagen



,


Xcodebuild:


Xcodebuild 
    -workspace ExnessForHeisenbug.xcworkspace/
    -scheme ExnessForHeisenbug
    -destination 'platform=iOS Simulator,OS=10.3.1,name=iPhone 6s'
    -destination 'platform=iOS Simulator,OS=11.4,name=iPhone 7 plus' 
    -destination 'platform=iOS Simulator,OS=12.2,name=iPhone Xs' 
    -destination 'platform=iOS Simulator,OS=12.2,name=iPhone SE' 
    test -testPlan ExnessForHeisenbug

, , testPlan destination. , iOS, .


XCTest Plan. , . Fastlane.



testTutorial:


imagen



XCTest Plan: . Fastlane HTML-, , . , Xcode , - . XCTest Plan , Xcode.


. , Apple , , . , Fastlane 28 , XCTest Plan 2,6 . 10 .



, . , -: , .
- :


iOS Snapshot Test Case, , Objective C. UIView/CALayer . (recordMode = true) (). (recordMode = false), .


imagen



Deposit is in your account! Long title! Test it Elon Musk!, 120 000 000.00 USD. , .


. , - . , transaction id, .


( ). , , .


pod


imagen



:


FB_REFERENCE_IMAGE_DIR — ,
IMAGE_DIF_DIR — .


imagen



. - , . , , .


Swift Snapshot Testing, Point Free Co. : . JSON, , URL, .


. E Import Snapshot Testing, assertSnapshot() ViewController . .


import SnapshotTesting
import XCTest

class MyViewControllerTests: XCTestCase {
  func testMyViewController() {
    let vc = MyViewController()

    assertSnapshot(matching: vc, as: .image)
  }
}

, Swift . — diff: . . , , open source, , .



, . — XCTest Plan Fastlane. . -.


Exness : Exness Trading, , Social Trading, .


Crowdin . LinguanApp Exness Trading , , , . Social Trading. Fastlane . XCTest Plan . , Exness Trading Swift Snapshot Test Case, Social Trading — iOS Snapshot Test Case. , . Happy testing!


/ :


Fastlane:


https://agostini.tech/2018/07/15/automatic-screenshots-with-fastlane-snapshot/
https://docs.fastlane.tools/getting-started/ios/screenshots/


XCTestPlan:


https://shashikantjagtap.net/wwdc19-getting-started-with-test-plan-for-xctest/
https://developer.apple.com/videos/play/wwdc2019/403
https://developer.apple.com/videos/play/wwdc2019/413


swift-snapshot-testing:


https://github.com/pointfreeco/swift-snapshot-testing/


ios-snapshot-test-case:


https://github.com/uber/ios-snapshot-test-case/


Display Zoom:


http://www.iphonehacks.com/2014/09/use-display-zoom-iphone-6-plus.html


All Articles