|
6 | 6 | // Copyright © 2018 Josh Adams. All rights reserved. |
7 | 7 | // |
8 | 8 |
|
9 | | -//import XCTest |
10 | | -// |
11 | | -//class QuizVCUITests: XCTestCase { |
12 | | -// let enableUiTesting = "enable-ui-testing" |
13 | | -// |
14 | | -// override func setUp() { |
15 | | -// continueAfterFailure = false |
16 | | -// } |
17 | | -// |
18 | | -// override func tearDown() {} |
19 | | -// |
20 | | -// func testDifficultSpainQuiz() { |
21 | | -// testQuiz(answers: ["sintiendo", "midiendo", "caminando", "existiendo", "bebiendo", "andas", "ocurre", "leemos", "vais", "duermen", "hago", "fuiste", "dio", "pusimos", "trabajastéis", "recibieron", "aprendí", "ibas", "veía", "caminábamos", "andabais", "sabrán", "cabré", "trabajarás", "estudiará", "escucharíamos", "visitaríais", "podrían", "vaya", "hayas", "sepa", "estudiemos", "permitáis", "comprendan", "pudiera", "viajases", "estuviere", "enseñáremos", "ve", "llevad", "no llegen", "he cubierto", "hubiste bailado", "había dicho", "habremos nadado", "habríais escrito", "hayan cocinado", "hubiera hecho", "hubieses charlado", "hubiere muerto"], region: "Spain", difficulty: "Difficult") |
22 | | -// } |
23 | | -// |
24 | | -// func testDifficultLatinAmericaQuiz() { |
25 | | -// testQuiz(answers: ["sintiendo", "midiendo", "caminando", "existiendo", "bebiendo", "andas", "ocurre", "leemos", "van", "duermo", "haces", "fue", "dimos", "pusieron", "trabajé", "recibiste", "aprendió", "ibamos", "veían", "caminaba", "andabas", "sabrá", "cabremos", "trabajarán", "estudiaré", "escucharías", "visitaría", "podríamos", "vayan", "haya", "sepas", "estudie", "permitamos", "comprendan", "pudiera", "viajases", "estuviere", "enseñáremos", "ve", "lleven", "no llege", "hemos cubierto", "hubieron bailado", "había dicho", "habrás nadado", "habría escrito", "hayamos cocinado", "hubieran hecho", "hubiese charlado", "hubieres muerto"], region: "Latin America", difficulty: "Difficult") |
26 | | -// } |
27 | | -// |
28 | | -// func testModerateSpainQuiz() { |
29 | | -// testQuiz(answers: ["caminas", "anda", "existimos", "bebéis", "van", "duermo", "haces", "muere", "sabremos", "cabréis", "podrán", "caminaré", "andarás", "querría", "pondríamos", "tendríais", "trabajarían", "estudiaría", "has cubierto", "ha dicho", "hemos escrito", "habéis escuchado", "han visitado", "iba", "veías", "era", "viajábamos", "enseñabais", "llevaban", "fui", "diste", "puso", "trabajamos", "ocurristeis", "leieron", "vaya", "hayas", "sepa", "llegemos", "bailéis", "sintiendo", "midiendo", "nadando", "cocinando", "ve", "he", "charlen", "platice", "no lloremos", "no esperéis"], region: "Spain", difficulty: "Moderate") |
30 | | -// } |
31 | | -// |
32 | | -// func testModerateLatinAmericaQuiz() { |
33 | | -// testQuiz(answers: ["caminas", "anda", "existimos", "beben", "voy", "duermes", "hace", "morimos", "sabrán", "cabré", "podrás", "caminará", "andaremos", "querrían", "pondría", "tendrías", "trabajaría", "estudiaríamos", "han cubierto", "he dicho", "has escrito", "ha escuchado", "hemos visitado", "iban", "veía", "eras", "viajaba", "enseñábamos", "llevaban", "fui", "diste", "puso", "trabajamos", "ocurrieron", "leí", "vayas", "haya", "sepamos", "llegen", "baile", "sintiendo", "midiendo", "nadando", "cocinando", "ve", "he", "charle", "platicemos", "no lloren", "no espere"], region: "Latin America", difficulty: "Moderate") |
34 | | -// } |
35 | | -// |
36 | | -// func testEasySpainQuiz() { |
37 | | -// testQuiz(answers: ["caminas", "anda", "trabajamos", "existís", "ocurren", "recibo", "bebes", "lee", "aprendemos", "vais", "duermen", "hago", "mueres", "muerde", "oímos", "podéis", "han", "siento", "sabrás", "cabrá", "podremos", "querréis", "pondrán", "tendré", "vendrás", "saldrá", "estudiaremos", "escucharéis", "visitarán", "permitiré", "partirás", "comprenderá", "correremos", "fuisteis", "dieron", "puse", "pudiste", "estuvo", "tuvimos", "anduvisteis", "supieron", "caminé", "anduviste", "trabajó", "estudiamos", "escuchastéis", "visitaron", "viajé", "enseñaste", "llevó"], region: "Spain", difficulty: "Easy") |
38 | | -// } |
39 | | -// |
40 | | -// func testEasyLatinAmericaQuiz() { |
41 | | -// testQuiz(answers: ["caminas", "anda", "trabajamos", "existen", "ocurro", "recibes", "bebe", "leemos", "aprenden", "voy", "duermes", "hace", "morimos", "muerden", "oigo", "puedes", "ha", "sentimos", "sabrán", "cabré", "podrás", "querrá", "pondremos", "tendrán", "vendré", "saldrás", "estudiará", "escucharemos", "visitarán", "permitiré", "partirás", "comprenderá", "correremos", "fueron", "di", "pusiste", "pudo", "estuvimos", "tuvieron", "anduve", "supiste", "caminó", "anduvimos", "trabajaron", "estudié", "escuchaste", "visitó", "viajamos", "enseñaron", "llevé"], region: "Latin America", difficulty: "Easy") |
42 | | -// } |
43 | | -// |
44 | | -// func testQuiz(answers: [String], region: String, difficulty: String) { |
45 | | -// let app = XCUIApplication() |
46 | | -// app.launchArguments = [enableUiTesting, region, difficulty] |
47 | | -// app.launch() |
48 | | -// app.tabBars.buttons["Quiz"].tap() |
49 | | -// let timeout: TimeInterval = 1.0 |
50 | | -// XCTAssert(app.buttons["Start"].waitForExistence(timeout: timeout)) |
51 | | -// app.buttons["Start"].tap() |
52 | | -// let textField = app.textFields[" conjugation"] |
53 | | -// answers.forEach { conjugation in |
54 | | -// textField.typeText(conjugation + "\n") |
55 | | -// } |
56 | | -// XCTAssert(app.staticTexts["Results"].waitForExistence(timeout: timeout)) |
57 | | -// XCTAssert(app.staticTexts[region].exists) |
58 | | -// XCTAssert(app.staticTexts[difficulty].exists) |
59 | | -// } |
60 | | -//} |
| 9 | +import XCTest |
| 10 | + |
| 11 | +class QuizVCUITests: XCTestCase { |
| 12 | + let enableUiTesting = "enable-ui-testing" |
| 13 | + |
| 14 | + override func setUp() { |
| 15 | + continueAfterFailure = false |
| 16 | + } |
| 17 | + |
| 18 | + override func tearDown() {} |
| 19 | + |
| 20 | + func testDifficultSpainQuiz() { |
| 21 | + testQuiz(answers: ["sintiendo", "midiendo", "caminando", "existiendo", "bebiendo", "andas", "ocurre", "leemos", "vais", "duermen", "hago", "fuiste", "dio", "pusimos", "trabajastéis", "recibieron", "aprendí", "ibas", "veía", "caminábamos", "andabais", "sabrán", "cabré", "trabajarás", "estudiará", "escucharíamos", "visitaríais", "podrían", "vaya", "hayas", "sepa", "estudiemos", "permitáis", "comprendan", "pudiera", "viajases", "estuviere", "enseñáremos", "ve", "llevad", "no llegen", "he cubierto", "hubiste bailado", "había dicho", "habremos nadado", "habríais escrito", "hayan cocinado", "hubiera hecho", "hubieses charlado", "hubiere muerto"], region: "Spain", difficulty: "Difficult") |
| 22 | + } |
| 23 | + |
| 24 | + func testDifficultLatinAmericaQuiz() { |
| 25 | + testQuiz(answers: ["sintiendo", "midiendo", "caminando", "existiendo", "bebiendo", "andas", "ocurre", "leemos", "van", "duermo", "haces", "fue", "dimos", "pusieron", "trabajé", "recibiste", "aprendió", "ibamos", "veían", "caminaba", "andabas", "sabrá", "cabremos", "trabajarán", "estudiaré", "escucharías", "visitaría", "podríamos", "vayan", "haya", "sepas", "estudie", "permitamos", "comprendan", "pudiera", "viajases", "estuviere", "enseñáremos", "ve", "lleven", "no llege", "hemos cubierto", "hubieron bailado", "había dicho", "habrás nadado", "habría escrito", "hayamos cocinado", "hubieran hecho", "hubiese charlado", "hubieres muerto"], region: "Latin America", difficulty: "Difficult") |
| 26 | + } |
| 27 | + |
| 28 | + func testModerateSpainQuiz() { |
| 29 | + testQuiz(answers: ["caminas", "anda", "existimos", "bebéis", "van", "duermo", "haces", "muere", "sabremos", "cabréis", "podrán", "caminaré", "andarás", "querría", "pondríamos", "tendríais", "trabajarían", "estudiaría", "has cubierto", "ha dicho", "hemos escrito", "habéis escuchado", "han visitado", "iba", "veías", "era", "viajábamos", "enseñabais", "llevaban", "fui", "diste", "puso", "trabajamos", "ocurristeis", "leieron", "vaya", "hayas", "sepa", "llegemos", "bailéis", "sintiendo", "midiendo", "nadando", "cocinando", "ve", "he", "charlen", "platice", "no lloremos", "no esperéis"], region: "Spain", difficulty: "Moderate") |
| 30 | + } |
| 31 | + |
| 32 | + func testModerateLatinAmericaQuiz() { |
| 33 | + testQuiz(answers: ["caminas", "anda", "existimos", "beben", "voy", "duermes", "hace", "morimos", "sabrán", "cabré", "podrás", "caminará", "andaremos", "querrían", "pondría", "tendrías", "trabajaría", "estudiaríamos", "han cubierto", "he dicho", "has escrito", "ha escuchado", "hemos visitado", "iban", "veía", "eras", "viajaba", "enseñábamos", "llevaban", "fui", "diste", "puso", "trabajamos", "ocurrieron", "leí", "vayas", "haya", "sepamos", "llegen", "baile", "sintiendo", "midiendo", "nadando", "cocinando", "ve", "he", "charle", "platicemos", "no lloren", "no espere"], region: "Latin America", difficulty: "Moderate") |
| 34 | + } |
| 35 | + |
| 36 | + func testEasySpainQuiz() { |
| 37 | + testQuiz(answers: ["caminas", "anda", "trabajamos", "existís", "ocurren", "recibo", "bebes", "lee", "aprendemos", "vais", "duermen", "hago", "mueres", "muerde", "oímos", "podéis", "han", "siento", "sabrás", "cabrá", "podremos", "querréis", "pondrán", "tendré", "vendrás", "saldrá", "estudiaremos", "escucharéis", "visitarán", "permitiré", "partirás", "comprenderá", "correremos", "fuisteis", "dieron", "puse", "pudiste", "estuvo", "tuvimos", "anduvisteis", "supieron", "caminé", "anduviste", "trabajó", "estudiamos", "escuchastéis", "visitaron", "viajé", "enseñaste", "llevó"], region: "Spain", difficulty: "Easy") |
| 38 | + } |
| 39 | + |
| 40 | + func testEasyLatinAmericaQuiz() { |
| 41 | + testQuiz(answers: ["caminas", "anda", "trabajamos", "existen", "ocurro", "recibes", "bebe", "leemos", "aprenden", "voy", "duermes", "hace", "morimos", "muerden", "oigo", "puedes", "ha", "sentimos", "sabrán", "cabré", "podrás", "querrá", "pondremos", "tendrán", "vendré", "saldrás", "estudiará", "escucharemos", "visitarán", "permitiré", "partirás", "comprenderá", "correremos", "fueron", "di", "pusiste", "pudo", "estuvimos", "tuvieron", "anduve", "supiste", "caminó", "anduvimos", "trabajaron", "estudié", "escuchaste", "visitó", "viajamos", "enseñaron", "llevé"], region: "Latin America", difficulty: "Easy") |
| 42 | + } |
| 43 | + |
| 44 | + func testQuiz(answers: [String], region: String, difficulty: String) { |
| 45 | + let app = XCUIApplication() |
| 46 | + app.launchArguments = [enableUiTesting, region, difficulty] |
| 47 | + app.launch() |
| 48 | + app.tabBars.buttons["Quiz"].tap() |
| 49 | + let timeout: TimeInterval = 1.0 |
| 50 | + XCTAssert(app.buttons["Start"].waitForExistence(timeout: timeout)) |
| 51 | + app.buttons["Start"].tap() |
| 52 | + let textField = app.textFields[" conjugation"] |
| 53 | + answers.forEach { conjugation in |
| 54 | + textField.typeText(conjugation + "\n") |
| 55 | + } |
| 56 | + XCTAssert(app.staticTexts["Results"].waitForExistence(timeout: timeout)) |
| 57 | + XCTAssert(app.staticTexts[region].exists) |
| 58 | + XCTAssert(app.staticTexts[difficulty].exists) |
| 59 | + } |
| 60 | +} |
0 commit comments