-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3029 change the title of the wallet tab to show the truncated wallet …
…address if enswallet name is not available (#3031) * Show formatted address by default * Show custom name instead of address * Show ENS name instead of address * Should show custom name instead of ENS name
- Loading branch information
1 parent
3a84fd0
commit 75a0554
Showing
3 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
app/src/androidTest/java/com/alphawallet/app/WalletNameTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.alphawallet.app; | ||
|
||
import static androidx.test.espresso.Espresso.onView; | ||
import static androidx.test.espresso.action.ViewActions.replaceText; | ||
import static androidx.test.espresso.matcher.ViewMatchers.withId; | ||
import static androidx.test.espresso.matcher.ViewMatchers.withSubstring; | ||
import static androidx.test.espresso.matcher.ViewMatchers.withText; | ||
import static com.alphawallet.app.assertions.Should.shouldSee; | ||
import static com.alphawallet.app.steps.Steps.createNewWallet; | ||
import static com.alphawallet.app.steps.Steps.getWalletAddress; | ||
import static com.alphawallet.app.steps.Steps.gotoWalletPage; | ||
import static com.alphawallet.app.steps.Steps.input; | ||
import static com.alphawallet.app.steps.Steps.watchWalletWithENS; | ||
import static com.alphawallet.app.util.Helper.click; | ||
|
||
import com.alphawallet.app.util.Helper; | ||
|
||
import org.junit.Test; | ||
|
||
public class WalletNameTest extends BaseE2ETest | ||
{ | ||
@Test | ||
public void should_show_custom_name_instead_of_address() | ||
{ | ||
createNewWallet(); | ||
String address = getWalletAddress(); | ||
|
||
gotoWalletPage(); | ||
shouldSeeFormattedAddress(address); | ||
|
||
renameWalletTo("TestWallet"); | ||
shouldSee("TestWallet"); | ||
|
||
renameWalletTo(""); | ||
shouldSeeFormattedAddress(address); | ||
} | ||
|
||
@Test | ||
public void should_show_custom_name_instead_of_ENS_name() | ||
{ | ||
watchWalletWithENS("vitalik.eth"); | ||
// Should see ENS name instead of address | ||
shouldSee("vitalik.eth"); | ||
|
||
renameWalletTo("Vitalik"); | ||
gotoWalletPage(); | ||
shouldSee("Vitalik"); | ||
|
||
renameWalletTo(""); | ||
gotoWalletPage(); | ||
shouldSee("vitalik.eth"); | ||
} | ||
|
||
private void renameWalletTo(String name) | ||
{ | ||
click(withId(R.id.action_my_wallet)); | ||
click(withSubstring("Rename this Wallet")); | ||
onView(withId(R.id.edit_text)).perform(replaceText(name)); | ||
input(R.id.input_name, name); | ||
click(withText("Save Name")); | ||
Helper.wait(2); | ||
} | ||
|
||
private void shouldSeeFormattedAddress(String address) | ||
{ | ||
shouldSee(address.substring(0, 6) + "..." + address.substring(address.length() - 4)); // 0xabcd...wxyz | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters