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:
parent
f08d38ef6d
commit
a01921e6bc
|
|
@ -10,7 +10,7 @@ workflow:
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
FLUTTER_IMAGE_TAG: '3.0.5'
|
FLUTTER_IMAGE_TAG: "3.0.5"
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -70,7 +70,7 @@ e2ee_test:
|
||||||
image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable:${FLUTTER_IMAGE_TAG}
|
image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable:${FLUTTER_IMAGE_TAG}
|
||||||
dependencies: []
|
dependencies: []
|
||||||
script:
|
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/prepare.sh
|
||||||
- ./scripts/test_driver.sh
|
- ./scripts/test_driver.sh
|
||||||
timeout: 16m
|
timeout: 16m
|
||||||
|
|
@ -84,13 +84,10 @@ dry-run:
|
||||||
- dart pub get
|
- dart pub get
|
||||||
- dart pub publish --dry-run
|
- dart pub publish --dry-run
|
||||||
|
|
||||||
|
|
||||||
pub-dev:
|
pub-dev:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: dart
|
image: dart
|
||||||
dependencies: [
|
dependencies: [dry-run]
|
||||||
dry-run
|
|
||||||
]
|
|
||||||
script:
|
script:
|
||||||
- rm -rf ./docs
|
- rm -rf ./docs
|
||||||
- |
|
- |
|
||||||
|
|
|
||||||
|
|
@ -44,16 +44,20 @@ void test() async {
|
||||||
Logs().i('++++ Login Alice at ++++');
|
Logs().i('++++ Login Alice at ++++');
|
||||||
testClientA = Client('TestClientA', databaseBuilder: getDatabase);
|
testClientA = Client('TestClientA', databaseBuilder: getDatabase);
|
||||||
await testClientA.checkHomeserver(Uri.parse(TestUser.homeserver));
|
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,
|
await testClientA.login(LoginType.mLoginPassword,
|
||||||
identifier: AuthenticationUserIdentifier(user: TestUser.username),
|
identifier: AuthenticationUserIdentifier(user: TestUser.displayname),
|
||||||
password: TestUser.password);
|
password: TestUser.password);
|
||||||
assert(testClientA.encryptionEnabled);
|
assert(testClientA.encryptionEnabled);
|
||||||
|
|
||||||
Logs().i('++++ Login Bob ++++');
|
Logs().i('++++ Login Bob ++++');
|
||||||
testClientB = Client('TestClientB', databaseBuilder: getDatabase);
|
testClientB = Client('TestClientB', databaseBuilder: getDatabase);
|
||||||
await testClientB.checkHomeserver(Uri.parse(TestUser.homeserver));
|
await testClientB.checkHomeserver(Uri.parse(TestUser.homeserver));
|
||||||
|
// Workaround: Logging in with displayname instead of mxid
|
||||||
await testClientB.login(LoginType.mLoginPassword,
|
await testClientB.login(LoginType.mLoginPassword,
|
||||||
identifier: AuthenticationUserIdentifier(user: TestUser.username2),
|
identifier: AuthenticationUserIdentifier(user: TestUser.displayname2),
|
||||||
password: TestUser.password);
|
password: TestUser.password);
|
||||||
assert(testClientB.encryptionEnabled);
|
assert(testClientB.encryptionEnabled);
|
||||||
|
|
||||||
|
|
@ -247,8 +251,9 @@ void test() async {
|
||||||
Logs().i('++++ Login Bob in another client ++++');
|
Logs().i('++++ Login Bob in another client ++++');
|
||||||
final testClientC = Client('TestClientC', databaseBuilder: getDatabase);
|
final testClientC = Client('TestClientC', databaseBuilder: getDatabase);
|
||||||
await testClientC.checkHomeserver(Uri.parse(TestUser.homeserver));
|
await testClientC.checkHomeserver(Uri.parse(TestUser.homeserver));
|
||||||
|
// Workaround: Logging in with displayname instead of mxid
|
||||||
await testClientC.login(LoginType.mLoginPassword,
|
await testClientC.login(LoginType.mLoginPassword,
|
||||||
identifier: AuthenticationUserIdentifier(user: TestUser.username2),
|
identifier: AuthenticationUserIdentifier(user: TestUser.displayname2),
|
||||||
password: TestUser.password);
|
password: TestUser.password);
|
||||||
await Future.delayed(Duration(seconds: 3));
|
await Future.delayed(Duration(seconds: 3));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,7 @@ class TestUser {
|
||||||
static const String homeserver = 'https://enter-your-server.here';
|
static const String homeserver = 'https://enter-your-server.here';
|
||||||
static const String username = 'alice';
|
static const String username = 'alice';
|
||||||
static const String username2 = 'bob';
|
static const String username2 = 'bob';
|
||||||
|
static const String displayname = 'Alice';
|
||||||
|
static const String displayname2 = 'Bob';
|
||||||
static const String password = '1234';
|
static const String password = '1234';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue