Mercurial > public > simoleon
comparison SimoleonAppPreview/SimoleonAppPreview.swift @ 171:70f0625bfcf1
Merge pull request #17 from denniscm190/development
open source project
committer: GitHub <noreply@github.com>
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Tue, 12 Oct 2021 16:17:35 +0200 |
parents | 23395b98a921 |
children |
comparison
equal
deleted
inserted
replaced
146:f10b0e188905 | 171:70f0625bfcf1 |
---|---|
1 // | |
2 // SimoleonAppPreview.swift | |
3 // SimoleonAppPreview | |
4 // | |
5 // Created by Dennis Concepción Martín on 17/8/21. | |
6 // | |
7 | |
8 import XCTest | |
9 | |
10 class SimoleonAppPreview: XCTestCase { | |
11 | |
12 override func setUpWithError() throws { | |
13 // This method is called before the invocation of each test method in the class. | |
14 if UIDevice.current.userInterfaceIdiom == .pad { | |
15 XCUIDevice.shared.orientation = .landscapeLeft | |
16 } | |
17 | |
18 // In UI tests it is usually best to stop immediately when a failure occurs. | |
19 continueAfterFailure = false | |
20 } | |
21 | |
22 override func tearDownWithError() throws { | |
23 // This method is called after the invocation of each test method in the class. | |
24 } | |
25 | |
26 func recordInteraction(of app: XCUIApplication) { | |
27 app.launch() | |
28 | |
29 /* | |
30 * Type amount to convert | |
31 * Click 'Done' to dismiss keyboard | |
32 */ | |
33 app.textFields["ConversionTextField"].tap() | |
34 app.keys["4"].tap() | |
35 app.keys["5"].tap() | |
36 app.keys["0"].tap() | |
37 app.keys["0"].tap() | |
38 app.keys["0"].tap() | |
39 | |
40 // Tap done to dismiss keyboard | |
41 app.navigationBars.buttons.element(boundBy: 0).tap() | |
42 | |
43 /* | |
44 * Open currency selector | |
45 * Select USD/BTC | |
46 */ | |
47 app.scrollViews.buttons["OpenCurrencySelector"].tap() | |
48 let currencySearchBar = app.textFields["CurrencySearchBar"] | |
49 currencySearchBar.tap() | |
50 currencySearchBar.typeText("Usd/btc\n") | |
51 sleep(1) | |
52 app.tables.buttons.firstMatch.tap() | |
53 sleep(2) | |
54 | |
55 /* | |
56 * Go to favorite view | |
57 * Open XAG/CAD | |
58 * Convert 100 ounce to CAD | |
59 * Go back to favorite | |
60 * Delete XAG to CAD | |
61 */ | |
62 app.tabBars.buttons.element(boundBy: 1).tap() | |
63 let favoritesList = app.tables["FavoritesList"].cells | |
64 sleep(1) | |
65 let xagToCad = favoritesList.element(boundBy: 7) | |
66 xagToCad.tap() | |
67 sleep(2) | |
68 | |
69 // Convert 100 ounce to CAD | |
70 app.textFields["ConversionTextField"].tap() | |
71 app.keys["1"].tap() | |
72 app.keys["0"].tap() | |
73 app.keys["0"].tap() | |
74 sleep(2) | |
75 | |
76 // Tap done to dismiss keyboard | |
77 app.navigationBars.buttons.element(boundBy: 1).tap() | |
78 | |
79 // Go back | |
80 app.navigationBars.buttons.element(boundBy: 0).tap() | |
81 sleep(1) | |
82 | |
83 // Delete row from favorites | |
84 xagToCad.swipeLeft() | |
85 xagToCad.buttons.firstMatch.tap() | |
86 } | |
87 | |
88 func testUSEnglish() throws { | |
89 let app = XCUIApplication() | |
90 app.launchArguments += ["-AppleLanguages", "(en-US)"] | |
91 app.launchArguments += ["-AppleLocale", "\"en-US\""] | |
92 recordInteraction(of: app) | |
93 } | |
94 | |
95 func testSpanish() throws { | |
96 let app = XCUIApplication() | |
97 app.launchArguments += ["-AppleLanguages", "(es-ES)"] | |
98 app.launchArguments += ["-AppleLocale", "\"es-ES\""] | |
99 recordInteraction(of: app) | |
100 } | |
101 | |
102 func testGBEnglish() throws { | |
103 let app = XCUIApplication() | |
104 app.launchArguments += ["-AppleLanguages", "(en-GB)"] | |
105 app.launchArguments += ["-AppleLocale", "\"en-GB\""] | |
106 recordInteraction(of: app) | |
107 } | |
108 | |
109 func testGerman() throws { | |
110 let app = XCUIApplication() | |
111 app.launchArguments += ["-AppleLanguages", "(de-DE)"] | |
112 app.launchArguments += ["-AppleLocale", "\"de-DE\""] | |
113 recordInteraction(of: app) | |
114 } | |
115 | |
116 func testFrench() throws { | |
117 let app = XCUIApplication() | |
118 app.launchArguments += ["-AppleLanguages", "(fr-FR)"] | |
119 app.launchArguments += ["-AppleLocale", "\"fr-FR\""] | |
120 recordInteraction(of: app) | |
121 } | |
122 | |
123 func testPortuguese() throws { | |
124 let app = XCUIApplication() | |
125 app.launchArguments += ["-AppleLanguages", "(pt-PT)"] | |
126 app.launchArguments += ["-AppleLocale", "\"pt-PT\""] | |
127 recordInteraction(of: app) | |
128 } | |
129 | |
130 func testDutch() throws { | |
131 let app = XCUIApplication() | |
132 app.launchArguments += ["-AppleLanguages", "(nl-NL)"] | |
133 app.launchArguments += ["-AppleLocale", "\"nl-NL\""] | |
134 recordInteraction(of: app) | |
135 } | |
136 | |
137 func testItalian() throws { | |
138 let app = XCUIApplication() | |
139 app.launchArguments += ["-AppleLanguages", "(it-IT)"] | |
140 app.launchArguments += ["-AppleLocale", "\"it-IT\""] | |
141 recordInteraction(of: app) | |
142 } | |
143 | |
144 func testRussian() throws { | |
145 let app = XCUIApplication() | |
146 app.launchArguments += ["-AppleLanguages", "(ru-RU)"] | |
147 app.launchArguments += ["-AppleLocale", "\"ru-RU\""] | |
148 recordInteraction(of: app) | |
149 } | |
150 } |