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

Simplify e2e test transaction navigation (#7816)

The transaction navigation in the e2e tests has been made simpler with
the addition of data attributes to help with finding the navigation
buttons. Each button is now labelled according to its purpose.
This commit is contained in:
Mark Stacey 2020-01-14 14:53:02 -04:00 committed by GitHub
parent dd4e684f7d
commit 19f10e197e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 16 deletions

View File

@ -577,46 +577,37 @@ describe('MetaMask', function () {
})
it('navigates the transactions', async () => {
let navigateTxButtons = await driver.findElements(By.css('.confirm-page-container-navigation__arrow'))
assert.equal(navigateTxButtons.length, 4, 'navigation button present')
await navigateTxButtons[2].click()
await driver.clickElement(By.css('[data-testid="next-page"]'))
let navigationElement = await driver.findElement(By.css('.confirm-page-container-navigation'))
let navigationText = await navigationElement.getText()
assert.equal(navigationText.includes('2'), true, 'changed transaction right')
navigateTxButtons = await driver.findElements(By.css('.confirm-page-container-navigation__arrow'))
await navigateTxButtons[2].click()
await driver.clickElement(By.css('[data-testid="next-page"]'))
navigationElement = await driver.findElement(By.css('.confirm-page-container-navigation'))
navigationText = await navigationElement.getText()
assert.equal(navigationText.includes('3'), true, 'changed transaction right')
navigateTxButtons = await driver.findElements(By.css('.confirm-page-container-navigation__arrow'))
await navigateTxButtons[2].click()
await driver.clickElement(By.css('[data-testid="next-page"]'))
navigationElement = await driver.findElement(By.css('.confirm-page-container-navigation'))
navigationText = await navigationElement.getText()
assert.equal(navigationText.includes('4'), true, 'changed transaction right')
navigateTxButtons = await driver.findElements(By.css('.confirm-page-container-navigation__arrow'))
await navigateTxButtons[0].click()
await driver.clickElement(By.css('[data-testid="first-page"]'))
navigationElement = await driver.findElement(By.css('.confirm-page-container-navigation'))
navigationText = await navigationElement.getText()
assert.equal(navigationText.includes('1'), true, 'navigate to first transaction')
navigateTxButtons = await driver.findElements(By.css('.confirm-page-container-navigation__arrow'))
await navigateTxButtons[3].click()
await driver.clickElement(By.css('[data-testid="last-page"]'))
navigationElement = await driver.findElement(By.css('.confirm-page-container-navigation'))
navigationText = await navigationElement.getText()
assert.equal(navigationText.split('4').length, 3, 'navigate to last transaction')
navigateTxButtons = await driver.findElements(By.css('.confirm-page-container-navigation__arrow'))
await navigateTxButtons[1].click()
await driver.clickElement(By.css('[data-testid="previous-page"]'))
navigationElement = await driver.findElement(By.css('.confirm-page-container-navigation'))
navigationText = await navigationElement.getText()
assert.equal(navigationText.includes('3'), true, 'changed transaction left')
navigateTxButtons = await driver.findElements(By.css('.confirm-page-container-navigation__arrow'))
await navigateTxButtons[1].click()
await driver.clickElement(By.css('[data-testid="previous-page"]'))
navigationElement = await driver.findElement(By.css('.confirm-page-container-navigation'))
navigationText = await navigationElement.getText()
assert.equal(navigationText.includes('2'), true, 'changed transaction left')

View File

@ -19,12 +19,14 @@ const ConfirmPageContainerNavigation = props => {
>
<div
className="confirm-page-container-navigation__arrow"
data-testid="first-page"
onClick={() => onNextTx(firstTx)}
>
<img src="/images/double-arrow.svg" />
</div>
<div
className="confirm-page-container-navigation__arrow"
data-testid="previous-page"
onClick={() => onNextTx(prevTxId)}
>
<img src="/images/single-arrow.svg" />
@ -46,12 +48,14 @@ const ConfirmPageContainerNavigation = props => {
>
<div
className="confirm-page-container-navigation__arrow"
data-testid="next-page"
onClick={() => onNextTx(nextTxId)}
>
<img className="confirm-page-container-navigation__imageflip" src="/images/single-arrow.svg" />
</div>
<div
className="confirm-page-container-navigation__arrow"
data-testid="last-page"
onClick={() => onNextTx(lastTx)}
>
<img className="confirm-page-container-navigation__imageflip" src="/images/double-arrow.svg" />