chore: Fix e2ee tests by login with username instead of mxid

Hacky workaround because the UIA
Proxy does not work reliably with
login via mxid.
This commit is contained in:
Christian Pauly 2022-08-15 12:26:19 +02:00
parent f08d38ef6d
commit a01921e6bc
3 changed files with 14 additions and 10 deletions

View File

@ -10,7 +10,7 @@ workflow:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
FLUTTER_IMAGE_TAG: '3.0.5'
FLUTTER_IMAGE_TAG: "3.0.5"
coverage:
tags:
@ -70,7 +70,7 @@ e2ee_test:
image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable:${FLUTTER_IMAGE_TAG}
dependencies: []
script:
- printf "abstract class TestUser {\n static const String homeserver = '$TEST_HOMESERVER';\n static const String username = '$TEST_USER1';\n static const String username2 = '$TEST_USER2';\n static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart
- printf "abstract class TestUser {\n static const String homeserver = '$TEST_HOMESERVER';\n static const String username = '$TEST_USER1';\n static const String username2 = '$TEST_USER2';\n static const String displayname = '$TEST_USER1_NAME';\n static const String displayname2 = '$TEST_USER2_NAME';\n static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart
- ./scripts/prepare.sh
- ./scripts/test_driver.sh
timeout: 16m
@ -84,13 +84,10 @@ dry-run:
- dart pub get
- dart pub publish --dry-run
pub-dev:
stage: deploy
image: dart
dependencies: [
dry-run
]
dependencies: [dry-run]
script:
- rm -rf ./docs
- |
@ -101,7 +98,7 @@ pub-dev:
mkdir -p ~/.config/dart/
cp "${PUB_DEV_CREDENTIALS}" ~/.config/dart/pub-credentials.json
- dart pub get
- dart pub publish --force
rules:

View File

@ -44,16 +44,20 @@ void test() async {
Logs().i('++++ Login Alice at ++++');
testClientA = Client('TestClientA', databaseBuilder: getDatabase);
await testClientA.checkHomeserver(Uri.parse(TestUser.homeserver));
// Workaround: Logging in with displayname instead of mxid because of a bug
// in the UIA proxy: https://gitlab.com/famedly/company/backend/services/uia-proxy/-/issues/27
// When this gets fixed, we no longer need the displayname login at all.
await testClientA.login(LoginType.mLoginPassword,
identifier: AuthenticationUserIdentifier(user: TestUser.username),
identifier: AuthenticationUserIdentifier(user: TestUser.displayname),
password: TestUser.password);
assert(testClientA.encryptionEnabled);
Logs().i('++++ Login Bob ++++');
testClientB = Client('TestClientB', databaseBuilder: getDatabase);
await testClientB.checkHomeserver(Uri.parse(TestUser.homeserver));
// Workaround: Logging in with displayname instead of mxid
await testClientB.login(LoginType.mLoginPassword,
identifier: AuthenticationUserIdentifier(user: TestUser.username2),
identifier: AuthenticationUserIdentifier(user: TestUser.displayname2),
password: TestUser.password);
assert(testClientB.encryptionEnabled);
@ -247,8 +251,9 @@ void test() async {
Logs().i('++++ Login Bob in another client ++++');
final testClientC = Client('TestClientC', databaseBuilder: getDatabase);
await testClientC.checkHomeserver(Uri.parse(TestUser.homeserver));
// Workaround: Logging in with displayname instead of mxid
await testClientC.login(LoginType.mLoginPassword,
identifier: AuthenticationUserIdentifier(user: TestUser.username2),
identifier: AuthenticationUserIdentifier(user: TestUser.displayname2),
password: TestUser.password);
await Future.delayed(Duration(seconds: 3));

View File

@ -2,5 +2,7 @@ class TestUser {
static const String homeserver = 'https://enter-your-server.here';
static const String username = 'alice';
static const String username2 = 'bob';
static const String displayname = 'Alice';
static const String displayname2 = 'Bob';
static const String password = '1234';
}