1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Replace contract with third party within the token allowance flow (#18101)

This commit is contained in:
Filip Sekulic 2023-04-11 05:19:42 +02:00 committed by GitHub
parent 463fe40fde
commit 54aeb1b791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 31 deletions

View File

@ -815,7 +815,7 @@
"message": "Contract deployment" "message": "Contract deployment"
}, },
"contractDescription": { "contractDescription": {
"message": "To protect yourself against scammers, take a moment to verify contract details." "message": "To protect yourself against scammers, take a moment to verify third-party details."
}, },
"contractInteraction": { "contractInteraction": {
"message": "Contract interaction" "message": "Contract interaction"
@ -830,10 +830,10 @@
"message": "Contract requesting signature" "message": "Contract requesting signature"
}, },
"contractRequestingSpendingCap": { "contractRequestingSpendingCap": {
"message": "Contract requesting spending cap" "message": "Third party requesting spending cap"
}, },
"contractTitle": { "contractTitle": {
"message": "Contract details" "message": "Third-party details"
}, },
"contractToken": { "contractToken": {
"message": "Token contract" "message": "Token contract"
@ -1808,14 +1808,14 @@
"message": "Your initial transaction was confirmed by the network. Click OK to go back." "message": "Your initial transaction was confirmed by the network. Click OK to go back."
}, },
"inputLogicEmptyState": { "inputLogicEmptyState": {
"message": "Only enter a number that you're comfortable with the contract spending now or in the future. You can always increase the spending cap later." "message": "Only enter a number that you're comfortable with the third party spending now or in the future. You can always increase the spending cap later."
}, },
"inputLogicEqualOrSmallerNumber": { "inputLogicEqualOrSmallerNumber": {
"message": "This allows the contract to spend $1 from your current balance.", "message": "This allows the third party to spend $1 from your current balance.",
"description": "$1 is the current token balance in the account and the name of the current token" "description": "$1 is the current token balance in the account and the name of the current token"
}, },
"inputLogicHigherNumber": { "inputLogicHigherNumber": {
"message": "This allows the contract to spend all your token balance until it reaches the cap or you revoke the spending cap. If this is not intended, consider setting a lower spending cap." "message": "This allows the third party to spend all your token balance until it reaches the cap or you revoke the spending cap. If this is not intended, consider setting a lower spending cap."
}, },
"insightsFromSnap": { "insightsFromSnap": {
"message": "Insights from $1", "message": "Insights from $1",
@ -3328,7 +3328,7 @@
"description": "$1 is a token symbol" "description": "$1 is a token symbol"
}, },
"revokeSpendingCapTooltipText": { "revokeSpendingCapTooltipText": {
"message": "This contract will be unable to spend any more of your current or future tokens." "message": "This third party will be unable to spend any more of your current or future tokens."
}, },
"rpcUrl": { "rpcUrl": {
"message": "New RPC URL" "message": "New RPC URL"
@ -4660,7 +4660,7 @@
"message": "Username" "message": "Username"
}, },
"verifyContractDetails": { "verifyContractDetails": {
"message": "Verify contract details" "message": "Verify third-party details"
}, },
"verifyThisTokenDecimalOn": { "verifyThisTokenDecimalOn": {
"message": "Token decimal can be found on $1", "message": "Token decimal can be found on $1",
@ -4746,7 +4746,7 @@
"message": "Warning" "message": "Warning"
}, },
"warningTooltipText": { "warningTooltipText": {
"message": "$1 The contract could spend your entire token balance without further notice or consent. Protect yourself by customizing a lower spending cap.", "message": "$1 The third party could spend your entire token balance without further notice or consent. Protect yourself by customizing a lower spending cap.",
"description": "$1 is a warning icon with text 'Be careful' in 'warning' colour" "description": "$1 is a warning icon with text 'Be careful' in 'warning' colour"
}, },
"weak": { "weak": {

View File

@ -119,16 +119,16 @@ describe('Create token, approve token and approve token without gas', function (
); );
await driver.clickElement({ await driver.clickElement({
text: 'Verify contract details', text: 'Verify third-party details',
css: '.token-allowance-container__verify-link', css: '.token-allowance-container__verify-link',
}); });
const modalTitle = await driver.waitForSelector({ const modalTitle = await driver.waitForSelector({
text: 'Contract details', text: 'Third-party details',
tag: 'h5', tag: 'h5',
}); });
assert.equal(await modalTitle.getText(), 'Contract details'); assert.equal(await modalTitle.getText(), 'Third-party details');
await driver.clickElement({ await driver.clickElement({
text: 'Got it', text: 'Got it',

View File

@ -60,7 +60,7 @@ describe('Sign Typed Data V4 Signature Request', function () {
assert.equal(await origin.getText(), 'http://127.0.0.1:8080'); assert.equal(await origin.getText(), 'http://127.0.0.1:8080');
verifyContractDetailsButton.click(); verifyContractDetailsButton.click();
await driver.findElement({ text: 'Contract details', tag: 'h5' }); await driver.findElement({ text: 'Third-party details', tag: 'h5' });
await driver.findElement('[data-testid="recipient"]'); await driver.findElement('[data-testid="recipient"]');
await driver.clickElement({ text: 'Got it', tag: 'button' }); await driver.clickElement({ text: 'Got it', tag: 'button' });
@ -142,7 +142,7 @@ describe('Sign Typed Data V3 Signature Request', function () {
assert.equal(await origin.getText(), 'http://127.0.0.1:8080'); assert.equal(await origin.getText(), 'http://127.0.0.1:8080');
verifyContractDetailsButton.click(); verifyContractDetailsButton.click();
await driver.findElement({ text: 'Contract details', tag: 'h5' }); await driver.findElement({ text: 'Third-party details', tag: 'h5' });
await driver.findElement('[data-testid="recipient"]'); await driver.findElement('[data-testid="recipient"]');
await driver.clickElement({ text: 'Got it', tag: 'button' }); await driver.clickElement({ text: 'Got it', tag: 'button' });

View File

@ -224,7 +224,7 @@ exports[`Signature Request Component render should match snapshot when we are us
<h6 <h6
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h7 typography--weight-normal typography--style-normal typography--color-primary-default" class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h7 typography--weight-normal typography--style-normal typography--color-primary-default"
> >
Verify contract details Verify third-party details
</h6> </h6>
</a> </a>
</div> </div>
@ -999,7 +999,7 @@ exports[`Signature Request Component render should match snapshot when we want t
<h6 <h6
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h7 typography--weight-normal typography--style-normal typography--color-primary-default" class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h7 typography--weight-normal typography--style-normal typography--color-primary-default"
> >
Verify contract details Verify third-party details
</h6> </h6>
</a> </a>
</div> </div>

View File

@ -57,7 +57,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button" role="button"
tabindex="0" tabindex="0"
> >
Verify contract details Verify third-party details
</a> </a>
</div> </div>
<div <div
@ -244,7 +244,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button" role="button"
tabindex="0" tabindex="0"
> >
Verify contract details Verify third-party details
</a> </a>
</div> </div>
<div <div
@ -431,7 +431,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button" role="button"
tabindex="0" tabindex="0"
> >
Verify contract details Verify third-party details
</a> </a>
</div> </div>
<div <div
@ -618,7 +618,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button" role="button"
tabindex="0" tabindex="0"
> >
Verify contract details Verify third-party details
</a> </a>
</div> </div>
<div <div

View File

@ -56,7 +56,7 @@ describe('ConfirmApproveContent Component', () => {
'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.', 'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.',
), ),
).toBeInTheDocument(); ).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument(); expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect( expect(
queryByText( queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.', 'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',
@ -119,7 +119,7 @@ describe('ConfirmApproveContent Component', () => {
'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.', 'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.',
), ),
).toBeInTheDocument(); ).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument(); expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect( expect(
queryByText( queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.', 'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',
@ -181,7 +181,7 @@ describe('ConfirmApproveContent Component', () => {
'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.', 'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.',
), ),
).toBeInTheDocument(); ).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument(); expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect( expect(
queryByText( queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.', 'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',
@ -239,7 +239,7 @@ describe('ConfirmApproveContent Component', () => {
'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.', 'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.',
), ),
).toBeInTheDocument(); ).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument(); expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect( expect(
queryByText( queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.', 'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',

View File

@ -223,7 +223,7 @@ exports[`Signature Request Component render should match snapshot 1`] = `
<h6 <h6
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h7 typography--weight-normal typography--style-normal typography--color-primary-default" class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography typography--h7 typography--weight-normal typography--style-normal typography--color-primary-default"
> >
Verify contract details Verify third-party details
</h6> </h6>
</a> </a>
</div> </div>

View File

@ -16,8 +16,8 @@
a.token-allowance-container__verify-link { a.token-allowance-container__verify-link {
width: fit-content; width: fit-content;
margin-inline-start: 96px; margin-inline-start: auto;
margin-inline-end: 96px; margin-inline-end: auto;
padding: 0; padding: 0;
} }

View File

@ -237,16 +237,16 @@ describe('TokenAllowancePage', () => {
expect(getByText('Set a spending cap for your')).toBeInTheDocument(); expect(getByText('Set a spending cap for your')).toBeInTheDocument();
}); });
it('should click Verify contract details and show popup Contract details, then close popup', () => { it('should click Verify third-party details and show popup Third-party details, then close popup', () => {
const { getByText } = renderWithProvider( const { getByText } = renderWithProvider(
<TokenAllowance {...props} />, <TokenAllowance {...props} />,
store, store,
); );
const verifyContractDetails = getByText('Verify contract details'); const verifyThirdPartyDetails = getByText('Verify third-party details');
fireEvent.click(verifyContractDetails); fireEvent.click(verifyThirdPartyDetails);
expect(getByText('Contract details')).toBeInTheDocument(); expect(getByText('Third-party details')).toBeInTheDocument();
const gotIt = getByText('Got it'); const gotIt = getByText('Got it');
fireEvent.click(gotIt); fireEvent.click(gotIt);