()
| 65 | } |
| 66 | |
| 67 | async function run(): Promise<void> { |
| 68 | const platform = Capacitor.getPlatform() |
| 69 | const sqlite = new SQLiteConnection(CapacitorSQLite) |
| 70 | |
| 71 | setStatus(`Starting native e2e runtime on ${platform}`) |
| 72 | |
| 73 | if (platform === `web`) { |
| 74 | setStatus(`Expected a native Capacitor runtime but got web`, { |
| 75 | platform, |
| 76 | runId: runtimeRunId, |
| 77 | }) |
| 78 | return |
| 79 | } |
| 80 | |
| 81 | try { |
| 82 | resetRegisteredTests() |
| 83 | registerCapacitorNativeE2ESuite({ |
| 84 | suiteName: `capacitor persisted collection conformance`, |
| 85 | createDatabase: createNativeCapacitorSQLiteTestDatabaseFactory({ |
| 86 | sqlite, |
| 87 | runId: runtimeRunId, |
| 88 | }), |
| 89 | }) |
| 90 | |
| 91 | const totalTests = getRegisteredTestCount() |
| 92 | setStatus(`Running native e2e suite`, { |
| 93 | totalTests, |
| 94 | runId: runtimeRunId, |
| 95 | }) |
| 96 | |
| 97 | const result = await runRegisteredTests({ |
| 98 | onTestStart: ({ index, name, total }) => { |
| 99 | setStatus(`Running test ${String(index)}/${String(total)}`, { |
| 100 | currentTest: name, |
| 101 | }) |
| 102 | }, |
| 103 | }) |
| 104 | |
| 105 | const failedResults = result.results.filter( |
| 106 | (entry) => entry.status === `failed`, |
| 107 | ) |
| 108 | const summary = { |
| 109 | passed: result.passed, |
| 110 | failed: result.failed, |
| 111 | skipped: result.skipped, |
| 112 | total: result.total, |
| 113 | failures: failedResults.slice(0, 10), |
| 114 | } |
| 115 | |
| 116 | if (result.failed > 0) { |
| 117 | await persistRunResult(sqlite, { |
| 118 | status: `failed`, |
| 119 | payload: summary, |
| 120 | }) |
| 121 | setStatus(`Native e2e failed`, summary) |
| 122 | return |
| 123 | } |
| 124 |
no test coverage detected