123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783 |
- // _____ _
- // |_ _| |_ _ _ ___ ___ _ __ __ _
- // | | | ' \| '_/ -_) -_) ' \/ _` |_
- // |_| |_||_|_| \___\___|_|_|_\__,_(_)
- //
- // Threema iOS Client
- // Copyright (c) 2019-2020 Threema GmbH
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU Affero General Public License, version 3,
- // as published by the Free Software Foundation.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU Affero General Public License for more details.
- //
- // You should have received a copy of the GNU Affero General Public License
- // along with this program. If not, see <https://www.gnu.org/licenses/>.
- import XCTest
- class MakeScreenshots: XCTestCase {
-
- var language: String = ""
- var theme: String = "light"
- var version: String = "4.6.3"
- var orientation: String = ""
- var screenshotNameStart: String = ""
- var screenshotNameEnd: String = ""
- var app: XCUIApplication?
- var isWorkApp: Bool = false
- override func setUp() {
- // Put setup code here. This method is called before the invocation of each test method in the class.
-
- if UIDevice.current.userInterfaceIdiom == .pad {
- orientation = "landscape"
- XCUIDevice.shared.orientation = .landscapeLeft
- } else {
- orientation = "portrait"
- XCUIDevice.shared.orientation = .portrait
- }
- // In UI tests it is usually best to stop immediately when a failure occurs.
- continueAfterFailure = false
- // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
- app = XCUIApplication()
- Snapshot.setupSnapshot(app!, waitForAnimations: true)
- language = Snapshot.getLanguage()
- app!.launch()
-
- // 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.
-
- if let tmpTheme = argValueForKey(key: "-theme", app: app!) {
- theme = tmpTheme
- }
- if let tmpVersion = argValueForKey(key: "-version", app: app!) {
- version = tmpVersion
- }
-
- var ios: String = "ios-"
- ios.append(ProcessInfo().environment["SIMULATOR_DEVICE_NAME"]!)
-
- // add os, device, appversion, locale, theme
- var lang = language
- lang = lang.replacingOccurrences(of: "-", with: "_")
-
- screenshotNameStart = "\(ios)-\(version)-\(lang)"
- screenshotNameEnd = "\(theme)-\(orientation)"
-
- if #available(iOS 13.0, *) {
- }
- else {
- SDStatusBarManager.sharedInstance().carrierName = "3ma"
- SDStatusBarManager.sharedInstance().timeString = "08:15"
- SDStatusBarManager.sharedInstance().bluetoothState = .hidden
- SDStatusBarManager.sharedInstance().batteryDetailEnabled = true
- SDStatusBarManager.sharedInstance().enableOverrides()
- }
-
- addUIInterruptionMonitor(withDescription: "System Dialog") { (alert) -> Bool in
- let btnAllow: XCUIElement
- let btnAllowAlways: XCUIElement
- let btnAllowAll: XCUIElement
- let btnOK: XCUIElement
- let cancelButton: XCUIElement
-
- btnAllow = alert.buttons[self.allowButtonText()]
- btnAllowAlways = alert.buttons[self.alwaysAllowButtonText()]
- btnAllowAll = alert.buttons[self.allowAllButtonText()]
- btnOK = alert.buttons[self.okButtonText()]
- cancelButton = alert.buttons[self.cancelButtonText()]
-
- if cancelButton.exists {
- cancelButton.tap()
- return true
- }
- if btnAllow.exists {
- btnAllow.tap()
- return true
- }
- if btnAllowAlways.exists {
- btnAllowAlways.tap()
- return true
- }
- if btnAllowAll.exists {
- btnAllowAll.tap()
- return true
- }
- if btnOK.exists {
- btnOK.tap()
- return true
- }
- return true
- }
- }
- override func tearDown() {
- // Put teardown code here. This method is called after the invocation of each test method in the class.
-
- if #available(iOS 13.0, *) {
-
- }
- else {
- SDStatusBarManager.sharedInstance().disableOverrides()
- }
- }
-
- func testMakeScreenshots() {
- app = XCUIApplication()
-
- if Bundle.main.bundleIdentifier == "ch.threema.ScreenshotsWithDataWork.xctrunner" {
- isWorkApp = true
- // theme = "dark"
- // screenshotNameEnd = "\(theme)-\(orientation)"
- }
-
- // MARK: Enter license key
- if isWorkApp && app!.textFields.count > 0 {
- let login = workLogin()
-
- app!.textFields["licenseUsername"].typeText(login!["username"]!)
- if app!.keys.allElementsBoundByIndex[0].exists {
- app!.typeText("\n")
- }
- app!.secureTextFields["licensePassword"].typeText(login!["password"]!)
- app!.buttons["ConfirmButton"].tap()
-
- sleep(5)
- }
-
- let contactTabBarItem = app!.tabBars.buttons.element(boundBy: 0)
- let messagesTabBarItem = app!.tabBars.buttons.element(boundBy: 1)
-
- // switch tabs that fastlane will close all alerts before it will take the first screenshot
- contactTabBarItem.tap()
- messagesTabBarItem.tap()
-
- if UIDevice.current.userInterfaceIdiom == .pad {
- if isWorkApp == true {
- workScreenshotsForIpads()
- } else {
- screenshotsForIpads()
- }
- } else {
- if isWorkApp == true {
- workScreenshotsForIphones()
- } else {
- screenshotsForIphones()
- }
- }
- }
-
- private func workLogin() -> [String: String]? {
-
- // get screenshot project directory for work login
- guard let srcroot: String = ProcessInfo.processInfo.environment["SRCROOT"] else {
- assertionFailure("Can't find environment variable ro SRCROOT")
- return nil
- }
-
- let screenshotProject = "screenshot/dataWork"
- let screenshotPath = srcroot.replacingOccurrences(of: "ios-client", with: screenshotProject)
-
- let bundle = Bundle(path: screenshotPath)
- let loginJsonPath = bundle?.path(forResource: "login.json", ofType: nil)
-
- let fileManager = FileManager.default
- guard fileManager.fileExists(atPath: loginJsonPath!),
- let loginJsonData = fileManager.contents(atPath: loginJsonPath!) else {
- assertionFailure("Can't find login.json")
- return nil
- }
-
- do {
- return try JSONSerialization.jsonObject(with: loginJsonData, options: []) as? [String : String]
- } catch {
- assertionFailure("Can't create jsonObject from login.json")
- return nil
- }
- }
-
- private func screenshotsForIphones() {
- let contactTabBarItem = app!.tabBars.buttons.element(boundBy: 0)
- let messagesTabBarItem = app!.tabBars.buttons.element(boundBy: 1)
- let myIdTabBarItem = app!.tabBars.buttons.element(boundBy: 2)
-
- // switch tabs that fastlane will close all alerts before it will take the first screenshot
- contactTabBarItem.tap()
- messagesTabBarItem.tap()
-
- // MARK: Screenshot 1: conversations
- Snapshot.snapshot(screenshotName("01", "conversations"))
-
- // Switch to Contacts
- contactTabBarItem.tap()
-
- // MARK: Screenshot 2: contacts
- Snapshot.snapshot(screenshotName("02", "contacts"))
-
- // Switch to Chtas
- messagesTabBarItem.tap()
-
- // open chat of hanna schmidt
- app!.tables.cells.element(boundBy: 0).tap()
-
- // MARK: Screenshot 3: single_chat
- Snapshot.snapshot(screenshotName("03", "single_chat"))
-
- // tap plus icon
- app!.buttons["PlusButton"].tap()
-
- // MARK: Screenshot 4: single_chat_attachments
- Snapshot.snapshot(screenshotName("04", "single_chat_attachments"))
-
- // leave plus icon
- app!.cells["Cancel"].tap()
- // leave single chat --> chat overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // open chat of lisa goldman
- app!.tables.cells.element(boundBy: 4).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open call view
- app!.buttons["CallButton"].tap()
-
- // MARK: Screenshot 5: threema_call
- Snapshot.snapshot(screenshotName("05", "threema_call_incoming"))
-
- // tap hide button to change ui to connected call
- app!.buttons["HideButton"].tap()
-
- // MARK: Screenshot 6: threema_call
- Snapshot.snapshot(screenshotName("06", "threema_call"))
-
- // close call view
- app!.buttons["EndButton"].tap()
- // leave single chat --> chat overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // open chat from roberto dias
- app!.tables.cells.element(boundBy: 3).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open call view
- app!.buttons["CallButton"].tap()
- // tap hide button to change ui to connected call
- app!.buttons["HideButton"].tap()
- // tap camera button to change ui to video call
- app!.buttons["VideoButton"].tap()
-
- // MARK: Screenshot 7: threema_video_call
- Snapshot.snapshot(screenshotName("07", "threema_video_call"))
-
- // close call view
- app!.buttons["EndButton"].tap()
- // leave single chat --> chat overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // open group chat
- app!.tables.cells.element(boundBy: 1).tap()
-
- // MARK: Screenshot 8: group_chat
- Snapshot.snapshot(screenshotName("08", "group_chat"))
-
- // swipe down to show the header
- app!.swipeDown()
- // show group detail
- app!.scrollViews["GroupImageView"].tap()
-
- // MARK: Screenshot 9: group_detail
- Snapshot.snapshot(screenshotName("09", "group_detail"))
-
- // leave group detail --> group chat
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open ballot view
- app!.buttons["BallotButton"].tap()
- // select closed ballot
- app!.cells.element(boundBy: 0).tap()
-
- // MARK: Screenshot 10: ballot_matrix
- Snapshot.snapshot(screenshotName("10", "ballot_matrix"))
-
- // leave ballot --> ballot overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // ballot overview --> group chat
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // group chat --> conversation overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- contactTabBarItem.tap()
- // show detail of Schmidt Hanna
- app!.cells.element(boundBy: indexOfHannaSchmidt()).tap()
-
- // MARK: Screenshot 11: contact_detail
- Snapshot.snapshot(screenshotName("11", "contact_detail"))
-
- // contact detail --> contact overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // show my id tab
- myIdTabBarItem.tap()
-
- // MARK: Screenshot 12: my_id
- Snapshot.snapshot(screenshotName("12", "my_id"))
-
- //MARK: Show qr code
- app?.buttons["qrCodeButton"].tap()
-
- // MARK: Screenshot 13: qr_code
- Snapshot.snapshot(screenshotName("13", "qr_code"))
-
- // MARK: Dismiss qr code
- app?.otherElements["CoverView"].tap()
-
- // show threema safe
- app!.cells["SafeCell"].tap()
-
- // MARK: Screenshot 14: threema_safe
- Snapshot.snapshot(screenshotName("14", "threema_safe"))
- }
-
- private func screenshotsForIpads() {
- let contactTabBarItem = app!.tabBars.buttons.element(boundBy: 0)
- let messagesTabBarItem = app!.tabBars.buttons.element(boundBy: 1)
- let myIdTabBarItem = app!.tabBars.buttons.element(boundBy: 2)
-
- // switch tabs that fastlane will close all alerts before it will take the first screenshot
- contactTabBarItem.tap()
- messagesTabBarItem.tap()
-
- // MARK: Screenshot 1: conversations
- Snapshot.snapshot(screenshotName("01", "conversations"))
-
- // Switch to Contacts
- contactTabBarItem.tap()
-
- // MARK: Screenshot 2: contacts
- Snapshot.snapshot(screenshotName("02", "contacts"))
-
- // Switch to Chtas
- messagesTabBarItem.tap()
-
- // open chat of hanna schmidt
- app!.tables.cells.element(boundBy: 0).tap()
-
- // MARK: Screenshot 3: single_chat
- Snapshot.snapshot(screenshotName("03", "single_chat"))
-
- // tap plus icon
- app!.tap()
-
- // MARK: Screenshot 4: single_chat_attachments
- Snapshot.snapshot(screenshotName("04", "single_chat_attachments"))
-
- // leave plus icon
- app!.cells["Cancel"].tap()
-
- // open chat of lisa goldman
- app!.tables.cells.element(boundBy: 4).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open call view
- app!.buttons["CallButton"].tap()
-
- // MARK: Screenshot 5: threema_call
- Snapshot.snapshot(screenshotName("05", "threema_call_incoming"))
-
- // tap hide button to change ui to connected call
- app!.buttons["HideButton"].tap()
-
- // MARK: Screenshot 6: threema_call
- Snapshot.snapshot(screenshotName("06", "threema_call"))
-
- // close call view
- app!.buttons["EndButton"].tap()
- // open chat from roberto dias
- app!.tables.cells.element(boundBy: 3).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open call view
- app!.buttons["CallButton"].tap()
- // tap hide button to change ui to connected call
- app!.buttons["HideButton"].tap()
- // tap camera button to change ui to video call
- app!.buttons["VideoButton"].tap()
-
- // MARK: Screenshot 7: threema_video_call
- Snapshot.snapshot(screenshotName("07", "threema_video_call"))
-
- // close call view
- app!.buttons["EndButton"].tap()
- // open group chat
- app!.tables.cells.element(boundBy: 1).tap()
-
- // MARK: Screenshot 8: group_chat
- Snapshot.snapshot(screenshotName("08", "group_chat"))
-
- // swipe down to show the header
- app!.swipeDown()
- // show group detail
- app!.scrollViews["GroupImageView"].tap()
-
- // MARK: Screenshot 9: group_detail
- Snapshot.snapshot(screenshotName("09", "group_detail"))
-
- // leave group detail --> group chat
- app!.navigationBars.element(boundBy: 1).buttons.element(boundBy: 0).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open ballot view
- app!.buttons["BallotButton"].tap()
- // select closed ballot
- app!.tables.element(boundBy: 1).cells.element(boundBy: 0).tap()
-
- // MARK: Screenshot 10: ballot_matrix
- Snapshot.snapshot(screenshotName("10", "ballot_matrix"))
-
- // leave ballot --> ballot overview
- app!.navigationBars.element(boundBy: 1).buttons.element(boundBy: 0).tap()
- // ballot overview --> group chat
- app!.navigationBars.element(boundBy: 1).buttons.element(boundBy: 0).tap()
- // show contact tab
- contactTabBarItem.tap()
- // show detail of Schmidt Hanna
- app!.tables.element(boundBy: 0).cells.element(boundBy: indexOfHannaSchmidt()).tap()
-
- // MARK: Screenshot 11: contact_detail
- Snapshot.snapshot(screenshotName("11", "contact_detail"))
-
- // show my id tab
- myIdTabBarItem.tap()
-
- // MARK: Screenshot 12: my_id
- Snapshot.snapshot(screenshotName("12", "my_id"))
-
- //MARK: Show qr code
- app?.buttons["qrCodeButton"].tap()
-
- // MARK: Screenshot 13: qr_code
- Snapshot.snapshot(screenshotName("13", "qr_code"))
-
- // MARK: Dismiss qr code
- app?.otherElements["CoverView"].tap()
-
- // show threema safe
- app!.cells["SafeCell"].tap()
-
- // MARK: Screenshot 14: threema_safe
- Snapshot.snapshot(screenshotName("14", "threema_safe"))
- }
-
- private func workScreenshotsForIphones() {
- let contactTabBarItem = app!.tabBars.buttons.element(boundBy: 0)
- let messagesTabBarItem = app!.tabBars.buttons.element(boundBy: 1)
- let myIdTabBarItem = app!.tabBars.buttons.element(boundBy: 2)
-
- // switch tabs that fastlane will close all alerts before it will take the first screenshot
- contactTabBarItem.tap()
- messagesTabBarItem.tap()
-
- // MARK: Screenshot 1: conversations
- Snapshot.snapshot(screenshotName("01", "conversations"))
-
- // Switch to Contacts
- contactTabBarItem.tap()
-
- // MARK: Screenshot 2: contacts
- Snapshot.snapshot(screenshotName("02", "contacts"))
-
- // Switch to Chtas
- messagesTabBarItem.tap()
- // open chat of peter schreiner
- app!.tables.cells.element(boundBy: 0).tap()
- // MARK: Screenshot 3: single_chat
- Snapshot.snapshot(screenshotName("03", "single_chat"))
- // tap plus icon
- app!/*@START_MENU_TOKEN@*/.buttons["PlusButton"]/*[[".images",".buttons[\"Send media or location\"]",".buttons[\"PlusButton\"]"],[[[-1,2],[-1,1],[-1,0,1]],[[-1,2],[-1,1]]],[0]]@END_MENU_TOKEN@*/.tap()
- // MARK: Screenshot 4: single_chat_attachments
- Snapshot.snapshot(screenshotName("04", "single_chat_attachments"))
- // leave plus icon
- app!.cells["Cancel"].tap()
- // swipe down to show the header
- app!.swipeDown()
- // open call view
- app!.buttons["CallButton"].tap()
-
- // MARK: Screenshot 5: threema_call
- Snapshot.snapshot(screenshotName("05", "threema_call_incoming"))
-
- // tap hide button to change ui to connected call
- app!.buttons["HideButton"].tap()
-
- // MARK: Screenshot 6: threema_call
- Snapshot.snapshot(screenshotName("06", "threema_call"))
-
- // tap camera button to change ui to video call
- app!.buttons["VideoButton"].tap()
-
- // MARK: Screenshot 7: threema_video_call
- Snapshot.snapshot(screenshotName("07", "threema_video_call"))
- // close call view
- app!.buttons["EndButton"].tap()
- // leave single chat --> chat overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // open group chat
- app!.tables.cells.element(boundBy: 2).tap()
-
- // MARK: Screenshot 8: group_chat
- Snapshot.snapshot(screenshotName("08", "group_chat"))
-
- // swipe down to show the header
- app!.swipeDown()
- // show group detail
- app!.scrollViews["GroupImageView"].tap()
- // MARK: Screenshot 9: group_detail
- Snapshot.snapshot(screenshotName("09", "group_detail"))
- // leave group detail --> group chat
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open ballot view
- app!.buttons["BallotButton"].tap()
- // select closed ballot
- app!.cells.element(boundBy: 0).tap()
- // MARK: Screenshot 10: ballot_matrix
- Snapshot.snapshot(screenshotName("10", "ballot_matrix"))
- // leave ballot --> ballot overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // ballot overview --> group chat
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- // group chat --> conversation overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
- contactTabBarItem.tap()
-
- // tap contacts on segment control
- if app!.navigationBars.element(boundBy: 0).buttons["Work"].exists {
- app!.navigationBars.element(boundBy: 0).buttons["Work"].tap()
- } else {
- if app!.navigationBars.element(boundBy: 0).buttons["Case"].exists {
- app!.navigationBars.element(boundBy: 0).buttons["Case"].tap()
- }
- }
-
- // show detail of peter schreiner
- app!.cells.element(boundBy: indexOfPeterSchreiner()).tap()
-
- // MARK: Screenshot 11: contact_detail
- Snapshot.snapshot(screenshotName("11", "contact_detail"))
-
- // contact detail --> contact overview
- app!.navigationBars.buttons.element(boundBy: 0).tap()
-
- // show my id tab
- myIdTabBarItem.tap()
-
- // MARK: Screenshot 12: my_id
- Snapshot.snapshot(screenshotName("12", "my_id"))
-
- //MARK: Show qr code
- app?.buttons["qrCodeButton"].tap()
-
- // MARK: Screenshot 13: qr_code
- Snapshot.snapshot(screenshotName("13", "qr_code"))
-
- // MARK: Dismiss qr code
- app?.otherElements["CoverView"].tap()
-
- // show threema safe
- app!.cells["SafeCell"].tap()
-
- // MARK: Screenshot 14: threema_safe
- Snapshot.snapshot(screenshotName("14", "threema_safe"))
- }
-
- private func workScreenshotsForIpads() {
- let contactTabBarItem = app!.tabBars.buttons.element(boundBy: 0)
- let messagesTabBarItem = app!.tabBars.buttons.element(boundBy: 1)
- let myIdTabBarItem = app!.tabBars.buttons.element(boundBy: 2)
-
- // switch tabs that fastlane will close all alerts before it will take the first screenshot
- contactTabBarItem.tap()
- messagesTabBarItem.tap()
-
- // MARK: Screenshot 1: conversations
- Snapshot.snapshot(screenshotName("01", "conversations"))
-
- // Switch to Contacts
- contactTabBarItem.tap()
-
- // MARK: Screenshot 2: contacts
- Snapshot.snapshot(screenshotName("02", "contacts"))
-
- // Switch to Chtas
- messagesTabBarItem.tap()
-
- // open chat of peter schreiner
- app!.tables.cells.element(boundBy: 0).tap()
-
- // MARK: Screenshot 3: single_chat
- Snapshot.snapshot(screenshotName("03", "single_chat"))
-
- // tap plus icon
- app!/*@START_MENU_TOKEN@*/.buttons["PlusButton"]/*[[".images",".buttons[\"Send media or location\"]",".buttons[\"PlusButton\"]"],[[[-1,2],[-1,1],[-1,0,1]],[[-1,2],[-1,1]]],[0]]@END_MENU_TOKEN@*/.tap()
-
- // MARK: Screenshot 4: single_chat_attachments
- Snapshot.snapshot(screenshotName("04", "single_chat_attachments"))
-
- // leave plus icon
- app!.cells["Cancel"].tap()
- // swipe down to show the header
- app!.swipeDown()
- // open call view
- app!.buttons["CallButton"].tap()
-
- // MARK: Screenshot 5: threema_call_incoming
- Snapshot.snapshot(screenshotName("05", "threema_call_incoming"))
-
- // tap hide button to change ui to connected call
- app!.buttons["HideButton"].tap()
-
- // MARK: Screenshot 6: threema_call
- Snapshot.snapshot(screenshotName("06", "threema_call"))
-
- // tap camera button to change ui to video call
- app!.buttons["VideoButton"].tap()
-
- // MARK: Screenshot 7: threema_video_call
- Snapshot.snapshot(screenshotName("07", "threema_video_call"))
-
- // close call view
- app!.buttons["EndButton"].tap()
- // open group chat
- app!.tables.cells.element(boundBy: 2).tap()
-
- // MARK: Screenshot 8: group_chat
- Snapshot.snapshot(screenshotName("08", "group_chat"))
-
- // swipe down to show the header
- app!.swipeDown()
- // show group detail
- app!.scrollViews["GroupImageView"].tap()
-
- // MARK: Screenshot 9: group_detail
- Snapshot.snapshot(screenshotName("09", "group_detail"))
-
- // leave group detail --> group chat
- app!.navigationBars.element(boundBy: 1).buttons.element(boundBy: 0).tap()
- // swipe down to show the header
- app!.swipeDown()
- // open ballot view
- app!.buttons["BallotButton"].tap()
- // select closed ballot
- app!.tables.element(boundBy: 1).cells.element(boundBy: 0).tap()
-
- // MARK: Screenshot 10: ballot_matrix
- Snapshot.snapshot(screenshotName("10", "ballot_matrix"))
-
- // leave ballot --> ballot overview
- app!.navigationBars.element(boundBy: 1).buttons.element(boundBy: 0).tap()
- // ballot overview --> group chat
- app!.navigationBars.element(boundBy: 1).buttons.element(boundBy: 0).tap()
- contactTabBarItem.tap()
-
- // tap contacts on segment control
- if app!.navigationBars.element(boundBy: 0).buttons["Work"].exists {
- app!.navigationBars.element(boundBy: 0).buttons["Work"].tap()
- } else {
- if app!.navigationBars.element(boundBy: 0).buttons["Case"].exists {
- app!.navigationBars.element(boundBy: 0).buttons["Case"].tap()
- }
- }
-
- // show detail of peter schreiner
- app!.cells.element(boundBy: indexOfPeterSchreiner()).tap()
-
- // MARK: Screenshot 11: contact_detail
- Snapshot.snapshot(screenshotName("11", "contact_detail"))
-
- // show my id tab
- myIdTabBarItem.tap()
-
- // MARK: Screenshot 12: my_id
- Snapshot.snapshot(screenshotName("12", "my_id"))
-
- //MARK: Show qr code
- app?.buttons["qrCodeButton"].tap()
-
- // MARK: Screenshot 13: qr_code
- Snapshot.snapshot(screenshotName("13", "qr_code"))
-
- // MARK: Dismiss qr code
- app?.otherElements["CoverView"].tap()
-
- // show threema safe
- app!.cells["SafeCell"].tap()
-
- // MARK: Screenshot 14: threema_safe
- Snapshot.snapshot(screenshotName("14", "threema_safe"))
- }
-
- private func argValueForKey(key: String, app: XCUIApplication) -> String? {
- if let index = app.launchArguments.firstIndex(of: key) {
-
- return app.launchArguments[index+1]
- }
- return nil
- }
-
- private func screenshotName(_ count: String, _ key: String) -> String {
- return "\(screenshotNameStart)-\(count)-\(key)-\(screenshotNameEnd)"
- }
-
- private func indexOfHannaSchmidt() -> Int {
- if language == "ru-RU" || language == "nl-NL" {
- return 4
- }
- else if language == "it-IT" || language == "pt_BR" {
- return 0
- }
- else if language == "fr-FR" {
- return 1
- }
-
- return 3
- }
-
- private func indexOfPeterSchreiner() -> Int {
- return 2
- }
-
- private func allowButtonText() -> String {
- return "Allow"
- }
-
- private func alwaysAllowButtonText() -> String {
- return "Always Allow"
- }
-
- private func allowAllButtonText() -> String {
- return "Allow Access to All Photos"
- }
-
- private func okButtonText() -> String {
- return "OK"
- }
-
- private func cancelButtonText() -> String {
- return "Cancel"
- }
- }
|