Skip to content

Commit 89aa453

Browse files
committed
test: e2e tags for add contact, profile qr, and profile edit
Made-with: Cursor
1 parent 675769b commit 89aa453

4 files changed

Lines changed: 31 additions & 11 deletions

File tree

app/src/main/java/to/bitkit/ui/components/ProfileEditForm.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,15 @@ fun ProfileEditForm(
157157
tint = Colors.White64,
158158
modifier = Modifier.size(16.dp)
159159
)
160-
IconButton(onClick = { onRemoveLink(index) }) {
160+
IconButton(
161+
onClick = { onRemoveLink(index) },
162+
modifier = Modifier.testTag("ProfileEditLinkRemove_$index"),
163+
) {
161164
Icon(
162165
painter = painterResource(R.drawable.ic_trash),
163166
contentDescription = null,
164167
tint = Colors.White64,
165-
modifier = Modifier.size(16.dp)
168+
modifier = Modifier.size(16.dp),
166169
)
167170
}
168171
}
@@ -252,7 +255,7 @@ fun ProfileEditForm(
252255
}
253256

254257
if (onDelete != null) {
255-
Column(modifier = Modifier.testTag("ProfileEditDelete")) {
258+
Column {
256259
VerticalSpacer(16.dp)
257260
HorizontalDivider()
258261
VerticalSpacer(16.dp)
@@ -276,6 +279,7 @@ fun ProfileEditForm(
276279
modifier = Modifier.size(16.dp)
277280
)
278281
},
282+
modifier = Modifier.testTag("ProfileEditDelete"),
279283
)
280284
}
281285
}

app/src/main/java/to/bitkit/ui/screens/contacts/AddContactScreen.kt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import androidx.compose.runtime.remember
3030
import androidx.compose.runtime.setValue
3131
import androidx.compose.ui.Alignment
3232
import androidx.compose.ui.Modifier
33+
import androidx.compose.ui.platform.testTag
3334
import androidx.compose.ui.draw.clip
3435
import androidx.compose.ui.draw.drawBehind
3536
import androidx.compose.ui.geometry.Offset
@@ -160,15 +161,20 @@ private fun AddContactSheetContent(
160161
}
161162
},
162163
trailingIcon = {
163-
IconButton(onClick = onPaste) {
164+
IconButton(
165+
onClick = onPaste,
166+
modifier = Modifier.testTag("AddContactPaste"),
167+
) {
164168
Icon(
165169
painter = painterResource(R.drawable.ic_clipboard_text),
166170
contentDescription = null,
167171
tint = Colors.White64,
168172
)
169173
}
170174
},
171-
modifier = Modifier.fillMaxWidth()
175+
modifier = Modifier
176+
.fillMaxWidth()
177+
.testTag("AddContactPubkyField"),
172178
)
173179
VerticalSpacer(16.dp)
174180

@@ -179,13 +185,17 @@ private fun AddContactSheetContent(
179185
SecondaryButton(
180186
text = stringResource(R.string.contacts__add_scan_qr),
181187
onClick = onScanQr,
182-
modifier = Modifier.weight(1f)
188+
modifier = Modifier
189+
.weight(1f)
190+
.testTag("AddContactScanQR"),
183191
)
184192
PrimaryButton(
185193
text = stringResource(R.string.contacts__add_button),
186194
onClick = onSubmit,
187195
enabled = isSubmitEnabled,
188-
modifier = Modifier.weight(1f)
196+
modifier = Modifier
197+
.weight(1f)
198+
.testTag("AddContactAdd"),
189199
)
190200
}
191201
VerticalSpacer(16.dp)
@@ -408,6 +418,7 @@ private fun ErrorContent(
408418
SecondaryButton(
409419
text = stringResource(R.string.common__retry),
410420
onClick = onRetry,
421+
modifier = Modifier.testTag("AddContactRetry"),
411422
)
412423
}
413424
}
@@ -449,13 +460,17 @@ private fun LoadedContent(
449460
SecondaryButton(
450461
text = stringResource(R.string.contacts__add_discard),
451462
onClick = onDiscard,
452-
modifier = Modifier.weight(1f)
463+
modifier = Modifier
464+
.weight(1f)
465+
.testTag("AddContactDiscard"),
453466
)
454467
PrimaryButton(
455468
text = stringResource(R.string.common__save),
456469
onClick = onSave,
457470
enabled = !isLoading,
458-
modifier = Modifier.weight(1f)
471+
modifier = Modifier
472+
.weight(1f)
473+
.testTag("AddContactSave"),
459474
)
460475
}
461476
VerticalSpacer(16.dp)

app/src/main/java/to/bitkit/ui/screens/contacts/AddContactViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class AddContactViewModel @Inject constructor(
8686
ToastEventBus.send(
8787
type = Toast.ToastType.SUCCESS,
8888
title = context.getString(R.string.contacts__add_contact_saved),
89+
testTag = "ContactSavedToast",
8990
)
9091
_effects.emit(AddContactEffect.ContactSaved)
9192
}

app/src/main/java/to/bitkit/ui/screens/profile/ProfileScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ private fun ProfileBody(
161161
) {
162162
QrCodeImage(
163163
content = profile.publicKey,
164-
testTag = "QRCode",
165-
modifier = Modifier.fillMaxWidth()
164+
modifier = Modifier.fillMaxWidth(),
165+
testTag = "ProfileQRCode",
166166
)
167167
if (profile.imageUrl != null) {
168168
Box(

0 commit comments

Comments
 (0)