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

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

Merged
merged 11 commits into from
Apr 11, 2023
18 changes: 9 additions & 9 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions test/e2e/tests/custom-token-add-approve.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ describe('Create token, approve token and approve token without gas', function (
);

await driver.clickElement({
text: 'Verify contract details',
text: 'Verify third-party details',
css: '.token-allowance-container__verify-link',
});

const modalTitle = await driver.waitForSelector({
text: 'Contract details',
text: 'Third-party details',
tag: 'h5',
});

assert.equal(await modalTitle.getText(), 'Contract details');
assert.equal(await modalTitle.getText(), 'Third-party details');

await driver.clickElement({
text: 'Got it',
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/tests/signature-request.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Sign Typed Data V4 Signature Request', function () {
assert.equal(await origin.getText(), 'http://127.0.0.1:8080');

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.clickElement({ text: 'Got it', tag: 'button' });

Expand Down Expand Up @@ -142,7 +142,7 @@ describe('Sign Typed Data V3 Signature Request', function () {
assert.equal(await origin.getText(), 'http://127.0.0.1:8080');

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.clickElement({ text: 'Got it', tag: 'button' });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ exports[`Signature Request Component render should match snapshot when we are us
<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"
>
Verify contract details
Verify third-party details
</h6>
</a>
</div>
Expand Down Expand Up @@ -999,7 +999,7 @@ exports[`Signature Request Component render should match snapshot when we want t
<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"
>
Verify contract details
Verify third-party details
</h6>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button"
tabindex="0"
>
Verify contract details
Verify third-party details
</a>
</div>
<div
Expand Down Expand Up @@ -244,7 +244,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button"
tabindex="0"
>
Verify contract details
Verify third-party details
</a>
</div>
<div
Expand Down Expand Up @@ -431,7 +431,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button"
tabindex="0"
>
Verify contract details
Verify third-party details
</a>
</div>
<div
Expand Down Expand Up @@ -618,7 +618,7 @@ exports[`ConfirmApproveContent Component should render Confirm approve page corr
role="button"
tabindex="0"
>
Verify contract details
Verify third-party details
</a>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
),
).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument();
expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect(
queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',
Expand Down Expand Up @@ -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.',
),
).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument();
expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect(
queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',
Expand Down Expand Up @@ -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.',
),
).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument();
expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect(
queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',
Expand Down Expand Up @@ -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.',
),
).toBeInTheDocument();
expect(queryByText('Verify contract details')).toBeInTheDocument();
expect(queryByText('Verify third-party details')).toBeInTheDocument();
expect(
queryByText(
'We were not able to estimate gas. There might be an error in the contract and this transaction may fail.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ exports[`Signature Request Component render should match snapshot 1`] = `
<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"
>
Verify contract details
Verify third-party details
</h6>
</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/token-allowance/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

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

Expand Down
8 changes: 4 additions & 4 deletions ui/pages/token-allowance/token-allowance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,16 @@ describe('TokenAllowancePage', () => {
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(
<TokenAllowance {...props} />,
store,
);

const verifyContractDetails = getByText('Verify contract details');
fireEvent.click(verifyContractDetails);
const verifyThirdPartyDetails = getByText('Verify third-party details');
fireEvent.click(verifyThirdPartyDetails);

expect(getByText('Contract details')).toBeInTheDocument();
expect(getByText('Third-party details')).toBeInTheDocument();

const gotIt = getByText('Got it');
fireEvent.click(gotIt);
Expand Down