Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: account missing in connection page #25500

Merged
merged 13 commits into from
Jul 2, 2024
9 changes: 9 additions & 0 deletions test/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,14 @@ const openDapp = async (driver, contract = null, dappURL = DAPP_URL) => {
: await driver.openNewPage(dappURL);
};

const openDappConnectionsPage = async (driver) => {
await driver.openNewPage(
`${driver.extensionUrl}/home.html#connections/${encodeURIComponent(
DAPP_URL,
)}`,
);
};

const createDappTransaction = async (driver, transaction) => {
await openDapp(
driver,
Expand Down Expand Up @@ -1150,6 +1158,7 @@ module.exports = {
importWrongSRPOnboardingFlow,
testSRPDropdownIterations,
openDapp,
openDappConnectionsPage,
createDappTransaction,
switchToOrOpenDapp,
connectToDapp,
Expand Down
33 changes: 33 additions & 0 deletions test/e2e/tests/multichain/connection-page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,37 @@ describe('Connections page', function () {
},
);
});

// Skipped until issue where firefox connecting to dapp is resolved.
// it('shows that the account is connected to the dapp', async function () {
// await withFixtures(
// {
// dapp: true,
// fixtures: new FixtureBuilder().build(),
// title: this.test.fullTitle(),
// ganacheOptions: defaultGanacheOptions,
// },
// async ({ driver, ganacheServer }) => {
// const ACCOUNT = '0x5CfE73b6021E818B776b421B1c4Db2474086a7e1';
// const SHORTENED_ACCOUNT = shortenAddress(ACCOUNT);
// await logInWithBalanceValidation(driver, ganacheServer);
// await openDappConnectionsPage(driver);
// // Verify that there are no connected accounts
// await driver.assertElementNotPresent(
// '[data-testid="account-list-address"]',
// );

// await connectToDapp(driver);
// await openDappConnectionsPage(driver);

// const account = await driver.findElement(
// '[data-testid="account-list-address"]',
// );
// const accountAddress = await account.getText();

// // Dapp should contain single connected account address
// assert.strictEqual(accountAddress, SHORTENED_ACCOUNT);
// },
// );
// });
});
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
bc1qn3s...5eker
</p>
Expand Down Expand Up @@ -557,6 +558,7 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0x0DCD5...3E7bc
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ export const AccountListItem = ({
justifyContent={JustifyContent.spaceBetween}
>
<Box display={Display.Flex} alignItems={AlignItems.center}>
<Text variant={TextVariant.bodySm} color={Color.textAlternative}>
<Text
variant={TextVariant.bodySm}
color={Color.textAlternative}
data-testid="account-list-address"
>
{shortenAddress(normalizeSafeAddress(account.address))}
</Text>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { GlobalMenu } from '../global-menu';
import {
getSelectedInternalAccount,
getTestNetworkBackgroundColor,
getOriginOfCurrentTab,
} from '../../../selectors';
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
import { normalizeSafeAddress } from '../../../../app/scripts/lib/multichain/address';
Expand Down Expand Up @@ -80,6 +81,7 @@ export const AppHeaderUnlockedContent = ({
const t = useI18nContext();
const history = useHistory();
const dispatch = useDispatch();
const origin = useSelector(getOriginOfCurrentTab);
const [accountOptionsMenuOpen, setAccountOptionsMenuOpen] = useState(false);
const testNetworkBackgroundColor = useSelector(getTestNetworkBackgroundColor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ ConnectedSiteMenu.propTypes = {
/**
* Disable the connected site menu if the account is non-evm
*/
disabled: PropTypes.boolean,
disabled: PropTypes.bool,
};
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ exports[`Connections Content should render correctly 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0x0DCD5...3E7bc
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ exports[`SendPage render and initialization should render correctly even when a
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0x0
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0x0DCD5...3E7bc
</p>
Expand Down Expand Up @@ -561,6 +562,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0xEC1Ad...9251B
</p>
Expand Down Expand Up @@ -857,6 +859,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0xc42ED...D8813
</p>
Expand Down Expand Up @@ -1162,6 +1165,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0xeB9e6...64823
</p>
Expand Down Expand Up @@ -1458,6 +1462,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0xb5526...FEe5D
</p>
Expand Down Expand Up @@ -1767,6 +1772,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0xca8f1...Cf281
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ exports[`remove-snap-account confirmation should match snapshot 1`] = `
>
<p
class="mm-box mm-text mm-text--body-sm mm-box--color-text-alternative"
data-testid="account-list-address"
>
0x0DCD5...3E7bc
</p>
Expand Down