mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-22 10:07:31 +00:00
core, ui: test app views on the core's recorded responses (#8234)
* core, ui: plan name alert tests against core fixtures * core: write name lookup responses to app fixtures in name tests * android, desktop: name alerts tested against core fixtures * core, ios: plan Swift fixtures and iOS unit tests of name alerts * core: write name lookup responses in the Swift form to iOS fixtures * ios: name alerts tested against core fixtures * core: write both app fixtures of a name test in one run * ui: add name lookup responses written by the core tests as fixtures * core: keep the fixture writer of name tests to the forms it receives * desktop: run name alert tests in the US locale * ios: one switch for the title and effect of name alert actions * docs: name alert tests in the app specs, CI guide and plan * docs: known gaps of the name alert tests in the plan * ui: restore the name alert code and the iOS project of master * core: record name lookup responses and name parses for app tests * android, desktop: test name alerts of planAndConnect on recorded responses * ci: run the app tests for a change of the name fixtures * core: name lookup responses and name parses recorded by the core tests * docs: plan of app views tested on core responses * ios: test name alerts of planAndConnect on recorded responses * ci: iOS unit tests in the iOS job, the app launched on stub migrations * android, desktop: core hooks below the externals, in the specs * ios: name alert tests compile with the converter at file scope * ui: the moved name test expects the alert to open a chat with the new address * core, ui: app test fixtures under tests/fixtures/api * core: record the responses of the name lookup flows that the apps test * core: record URI parses, and normalize the random values of fixtures * android, desktop: URI parse hook and event processing for tests * ios: URI parse hook for tests * desktop: full failure messages of tests * core: domain errors view compiles with GHC 8.10.7 * core: normalize parses and profile send times in fixtures * core: record the parses of the chat list search * core: recorded responses of the name flows and the contact address * android, desktop: test name alerts, buttons, search and name view * ios: test name alerts, buttons, search and the moved event * docs: plan, specs and CI guide of the app tests
This commit is contained in:
1 parent
88767bbc3a
commit
73761e6e0b
42 files changed
+5787
-34
No files matched your search
@@ -45,6 +45,7 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve
|
||||
- caches (the steps "Restore ... from cache");
|
||||
- `cabal build -j --enable-tests --ghc-options=-O0` (step "Build CLI");
|
||||
- simplex-chat-test with the selected tests (step "Run tests"), each attempt limited to 35 minutes by `timeout`; an attempt that reaches the limit fails, and "Attempt <n> timed out." is printed.
|
||||
- App test fixtures: core tests write the core's responses that the app tests use to tests/fixtures/api (`/names tests/` to tests/fixtures/api/names, `/contact via address/` to tests/fixtures/api/connect), and fail when a response differs from the committed file; the rewritten files are committed, and the kotlin and ios scopes run for them.
|
||||
- Local:
|
||||
```sh
|
||||
cp scripts/cabal.project.local.linux cabal.project.local
|
||||
@@ -73,9 +74,10 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve
|
||||
|
||||
- Globs:
|
||||
- apps/ios/**
|
||||
- tests/fixtures/api/**
|
||||
- scripts/ci/ios-stub-libs.sh
|
||||
- CI: build-ios: stub libraries, then xcodebuild for the iOS Simulator without signing.
|
||||
- Local, on macOS: `scripts/ci/ios-stub-libs.sh`, then the xcodebuild command of the step "Build iOS app" of build-ios.
|
||||
- CI: build-ios: stub libraries, then xcodebuild for the iOS Simulator without signing (step "Build iOS app"), then the target SimpleX Unit Tests, hosted by the app, in a new simulator (step "Run iOS unit tests"). The stubs of `chat_migrate_init` and `chat_migrate_init_key` return an empty string, so the app opens its database error screen and calls the core no more.
|
||||
- Local, on macOS: `scripts/ci/ios-stub-libs.sh`, then the commands of the steps "Build iOS app" and "Run iOS unit tests" of build-ios.
|
||||
|
||||
#### packages
|
||||
|
||||
@@ -165,7 +167,6 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve
|
||||
|
||||
| Scope | Paths | CI |
|
||||
|---|---|---|
|
||||
| ios | apps/ios/** | compile only |
|
||||
| types package | packages/simplex-chat-client/types/typescript/** | compile only |
|
||||
| ts-client | packages/simplex-chat-client/typescript/** | - |
|
||||
| webrtc | packages/simplex-chat-webrtc/** | - |
|
||||
|
||||
@@ -17,7 +17,7 @@ trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
# The linker resolves symbols by name only, so the stub signatures are not checked.
|
||||
sed -n 's/^extern [^(]*[ *]\([a-z_]*\)(.*/\1/p' "$IOS_DIR/SimpleXChat/SimpleX.h" "$IOS_DIR/SimpleXChat/hs_init.c" \
|
||||
| sort -u | sed 's/.*/void &(void) {}/' > "$tmp/stubs.c"
|
||||
| sort -u | sed -E -e 's/^(chat_migrate_init|chat_migrate_init_key)$/void *calloc(unsigned long, unsigned long); char *\1(void) { return calloc(1, 1); }/' -e t -e 's/.*/void &(void) {}/' > "$tmp/stubs.c"
|
||||
|
||||
if [ ! -s "$tmp/stubs.c" ]; then
|
||||
echo "Error: no extern functions found in SimpleX.h and hs_init.c" >&2
|
||||
|
||||
@@ -72,8 +72,8 @@ BUILD_CHANGES = {
|
||||
".github/actions/**",
|
||||
".github/changelog_conf.json",
|
||||
],
|
||||
"kotlin": ["apps/multiplatform/**", "Dockerfile*", ".github/workflows/build.yml", ".github/actions/**"],
|
||||
"ios": ["apps/ios/**", "scripts/ci/ios-stub-libs.sh"],
|
||||
"kotlin": ["apps/multiplatform/**", "tests/fixtures/api/**", "Dockerfile*", ".github/workflows/build.yml", ".github/actions/**"],
|
||||
"ios": ["apps/ios/**", "tests/fixtures/api/**", "scripts/ci/ios-stub-libs.sh"],
|
||||
"packages": [
|
||||
"packages/simplex-chat-nodejs/**",
|
||||
"packages/simplex-chat-client/types/typescript/**",
|
||||
|
||||
@@ -480,6 +480,9 @@ class ChangesTest(GitRepoTest):
|
||||
def test_core_change_builds_only_the_core(self):
|
||||
self.assertEqual(self.builds("src/Simplex/Chat.hs"), {"haskell"})
|
||||
|
||||
def test_api_fixture_change_builds_the_core_and_both_apps(self):
|
||||
self.assertEqual(self.builds("tests/fixtures/api/names/plan-known-expired.json"), {"haskell", "kotlin", "ios"})
|
||||
|
||||
def test_ios_stub_script_builds_only_ios(self):
|
||||
self.assertEqual(self.builds("scripts/ci/ios-stub-libs.sh"), {"ios"})
|
||||
|
||||
|
||||
Reference in new issue
Block a user