Skip to content

Commit 46e966c

Browse files
lukaw3dlukaw3d
authored andcommitted
Refactor E2E test that Transak can not be embedded in extension
1 parent aa522fa commit 46e966c

1 file changed

Lines changed: 6 additions & 23 deletions

File tree

playwright/tests/extension.spec.ts

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { test } from '../utils/extensionTestExtend'
22
import { expect } from '@playwright/test'
33
import { warnSlowApi } from '../utils/warnSlowApi'
44
import { mockApi } from '../utils/mockApi'
5-
import { fillPrivateKeyAndPassword } from '../utils/fillPrivateKey'
6-
import { privateKey, privateKeyAddress } from '../../src/utils/__fixtures__/test-inputs'
75

86
test.beforeEach(async ({ context }) => {
97
await warnSlowApi(context)
@@ -48,7 +46,6 @@ test.describe('The extension popup should load', () => {
4846
*/
4947
test('Transak can not be embedded in extension', async ({ page, extensionPopupURL }) => {
5048
test.fail()
51-
await page.setViewportSize({ width: 1280, height: 720 })
5249

5350
/* TODO: reenable when transak throws only a few errors
5451
await expectNoErrorsInConsole(page, {
@@ -61,28 +58,14 @@ test.describe('The extension popup should load', () => {
6158
},
6259
})
6360
*/
64-
await page.goto(`${extensionPopupURL}/open-wallet/private-key`)
65-
await fillPrivateKeyAndPassword(page, {
66-
privateKey: privateKey,
67-
privateKeyAddress: privateKeyAddress,
68-
persistenceCheckboxDisabled: 'disabled-checked',
61+
await page.goto(`${extensionPopupURL}/`)
62+
await page.evaluate(() => {
63+
const iframe = document.createElement('iframe')
64+
iframe.src = 'https://global.transak.com'
65+
document.body.appendChild(iframe)
6966
})
70-
await expect(page.getByTestId('account-selector')).toBeVisible()
71-
await page.getByRole('link', { name: 'Buy' }).click()
72-
await expect(page.getByRole('heading', { name: 'Buy ROSE' })).toBeVisible()
73-
74-
await page
75-
.getByText(
76-
'I understand that I’m using a third-party solution and Oasis* does not carry any responsibility over the usage of this solution.',
77-
)
78-
.click()
67+
await page.locator('iframe').scrollIntoViewIfNeeded()
7968
await expect(page.frameLocator('iframe')!.getByAltText('Powered by Transak')).toBeVisible()
80-
// Wait for conversion to be loaded otherwise clicking "Buy now" early reloads the iframe
81-
await expect(page.frameLocator('iframe')!.locator('#transak-calculator-source:disabled')).toHaveValue(
82-
/\d/,
83-
)
84-
await page.frameLocator('iframe')!.getByText('Buy now').click()
85-
await expect(page.frameLocator('iframe')!.getByText(/email/i).first()).toBeVisible()
8669
})
8770

8871
test('recover from fatal errors', async ({ extensionPopupURL, context }) => {

0 commit comments

Comments
 (0)