1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix hide token e2e test (#8724)

The e2e test for the "Hide token" functionality was incorrectly
clicking "Cancel" on the "Hide token" modal, thus not actually testing
that that token was hidden at all.

The "Confirm" button is now selected using a test id, to ensure the
wrong button isn't selected.
This commit is contained in:
Mark Stacey 2020-06-02 18:47:55 -03:00 committed by GitHub
parent e1c3778446
commit 56b157f692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -1223,8 +1223,7 @@ describe('MetaMask', function () {
const confirmHideModal = await driver.findElement(By.css('span .modal'))
const byHideTokenConfirmationButton = By.css('.hide-token-confirmation__button')
await driver.clickElement(byHideTokenConfirmationButton)
await driver.clickElement(By.css('[data-testid="hide-token-confirmation__hide"]'))
await driver.wait(until.stalenessOf(confirmHideModal))
})
@ -1232,7 +1231,6 @@ describe('MetaMask', function () {
describe('Add existing token using search', function () {
it('clicks on the Add Token button', async function () {
await driver.clickElement(By.css('[data-testid="asset__back"]'))
await driver.clickElement(By.xpath(`//button[contains(text(), 'Add Token')]`))
await driver.delay(regularDelayMs)
})

View File

@ -65,12 +65,14 @@ class HideTokenConfirmationModal extends Component {
<div className="hide-token-confirmation__buttons">
<button
className="btn-default hide-token-confirmation__button btn--large"
data-testid="hide-token-confirmation__cancel"
onClick={() => hideModal()}
>
{this.context.t('cancel')}
</button>
<button
className="btn-secondary hide-token-confirmation__button btn--large"
data-testid="hide-token-confirmation__hide"
onClick={() => hideToken(address)}
>
{this.context.t('hide')}