Skip to content

Commit

Permalink
Merge pull request #1365 from buberdds/mz/e2e
Browse files Browse the repository at this point in the history
Enable ParaTime e2e test
  • Loading branch information
buberdds committed Mar 31, 2023
2 parents 2226509 + c06c0a5 commit 141d6cb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
64 changes: 35 additions & 29 deletions playwright/tests/paraTimes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
// Uncomment when ParaTimes are released
// import { test, expect } from '@playwright/test'
// import { privateKey, privateKeyAddress } from '../utils/test-inputs'
// import { fillPrivateKeyWithoutPassword } from '../utils/fillPrivateKey'
import { test, expect } from '@playwright/test'
import { privateKey, privateKeyAddress } from '../utils/test-inputs'
import { fillPrivateKeyWithoutPassword } from '../utils/fillPrivateKey'
import { warnSlowApi } from '../utils/warnSlowApi'
import { mockApi } from '../utils/mockApi'

// test.describe('ParaTimes', () => {
// test('should clear form data on cancel transfer', async ({ page }) => {
// await page.goto('/open-wallet/private-key')
// await fillPrivateKeyWithoutPassword(page, {
// privateKey: privateKey,
// privateKeyAddress: privateKeyAddress,
// persistenceCheckboxChecked: false,
// persistenceCheckboxDisabled: false,
// })
// await page.getByTestId('nav-paratime').click()
// await page.getByRole('button', { name: /Deposit/i }).click()
// await page.getByRole('button', { name: /Select/i }).click()
// await expect(page.getByRole('listbox')).toBeVisible()
// await page.getByRole('listbox').locator('button', { hasText: 'Cipher' }).click()
// await page.getByRole('button', { name: /Next/i }).click()
// await page.getByPlaceholder(privateKeyAddress).fill(privateKeyAddress)
// await page.getByRole('button', { name: /Cancel transfer/i }).click()
// await page.getByRole('button', { name: /Deposit/i }).click()
// await page.getByRole('button', { name: /Select/i }).click()
// await expect(page.getByRole('listbox')).toBeVisible()
// await page.getByRole('listbox').locator('button', { hasText: 'Emerald' }).click()
// await page.getByRole('button', { name: /Next/i }).click()
// await expect(page.getByPlaceholder('0x...')).toHaveValue('')
// })
// })
test.beforeEach(async ({ page }) => {
await warnSlowApi(page)
await mockApi(page, 500000000000)
})

test.describe('ParaTimes', () => {
test('should clear form data on cancel transfer', async ({ page }) => {
await page.goto('/open-wallet/private-key')
await fillPrivateKeyWithoutPassword(page, {
privateKey: privateKey,
privateKeyAddress: privateKeyAddress,
persistenceCheckboxChecked: false,
persistenceCheckboxDisabled: false,
})
await page.getByTestId('nav-paratime').click()
await page.getByRole('button', { name: /Deposit/i }).click()
await page.getByRole('button', { name: /Select/i }).click()
await expect(page.getByRole('listbox')).toBeVisible()
await page.getByRole('listbox').locator('button', { hasText: 'Cipher' }).click()
await page.getByRole('button', { name: /Next/i }).click()
await page.getByPlaceholder(privateKeyAddress).fill(privateKeyAddress)
await page.getByRole('button', { name: /Cancel transfer/i }).click()
await page.getByRole('button', { name: /Deposit/i }).click()
await page.getByRole('button', { name: /Select/i }).click()
await expect(page.getByRole('listbox')).toBeVisible()
await page.getByRole('listbox').locator('button', { hasText: 'Emerald' }).click()
await page.getByRole('button', { name: /Next/i }).click()
await expect(page.getByPlaceholder('0x...')).toHaveValue('')
})
})
4 changes: 3 additions & 1 deletion src/app/pages/ParaTimesPage/useParaTimesNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const useParaTimesNavigation = (): ParaTimesNavigationHook => {
const dispatch = useDispatch()
const walletType = useSelector(selectType)
const canAccessParaTimesRoute =
false && // Remove when we can officially show ParaTimes to users
// Remove process envs when we can officially show ParaTimes to users
process.env.NODE_ENV !== 'test' &&
!!process.env.REACT_APP_E2E_TEST &&
backend() === BackendAPIs.OasisScan &&
walletType !== WalletType.Ledger
const getParaTimesRoutePath = (address: string) => `/account/${address}/paratimes`
Expand Down

0 comments on commit 141d6cb

Please sign in to comment.