-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add wallet features and socials github tests (#2571)
- Loading branch information
1 parent
7edf26e
commit fea5064
Showing
12 changed files
with
135 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,28 @@ | ||
/** | ||
* Social tests are still blocked because we are having authorization issues with them. | ||
* Some options like Google, Discord have human verification and passing them with the Playwright environment is not an easy pick (or not quite possible). | ||
* GitHub doesn't have human verification but when running the tests in parallel, it's getting stuck too much and not passing. | ||
* We are going to keep this test file here for future reference and when we have a better solution for this, we can enable them. | ||
*/ | ||
import { expect } from '@playwright/test' | ||
import { testMSocial } from './shared/fixtures/w3m-social-fixture' | ||
import type { ModalWalletPage } from './shared/pages/ModalWalletPage' | ||
|
||
testMSocial.beforeEach(async ({ modalValidator }) => { | ||
await modalValidator.expectConnected() | ||
}) | ||
|
||
testMSocial('it should sign', async ({ modalPage, modalValidator }) => { | ||
await modalPage.sign() | ||
await modalPage.approveSign() | ||
await modalValidator.expectAcceptedSign() | ||
}) | ||
|
||
testMSocial('it should reject sign', async ({ modalPage, modalValidator }) => { | ||
await modalPage.sign() | ||
await modalPage.rejectSign() | ||
await modalValidator.expectRejectedSign() | ||
}) | ||
testMSocial('it should connect with GitHub, switch network and sign', async ({ modalPage }) => { | ||
const targetChain = 'Polygon' | ||
const modalWalletPage = modalPage as ModalWalletPage | ||
|
||
testMSocial('it should switch network and sign', async ({ modalPage, modalValidator }) => { | ||
let targetChain = 'Polygon' | ||
await modalPage.switchNetwork(targetChain) | ||
await modalValidator.expectSwitchedNetwork(targetChain) | ||
await modalPage.closeModal() | ||
await modalPage.sign() | ||
await modalPage.approveSign() | ||
await modalValidator.expectAcceptedSign() | ||
|
||
targetChain = 'Ethereum' | ||
await modalPage.switchNetwork(targetChain) | ||
await modalValidator.expectSwitchedNetwork(targetChain) | ||
await modalPage.closeModal() | ||
await modalPage.sign() | ||
await modalPage.approveSign() | ||
await modalValidator.expectAcceptedSign() | ||
}) | ||
const networkButton = modalWalletPage.page.getByTestId('w3m-network-button') | ||
await networkButton.click() | ||
|
||
testMSocial('it should disconnect correctly', async ({ modalPage, modalValidator }) => { | ||
await modalPage.disconnect() | ||
await modalValidator.expectDisconnected() | ||
const networkToSwitchButton = modalWalletPage.page.getByTestId( | ||
`w3m-network-switch-${targetChain}` | ||
) | ||
await networkToSwitchButton.click() | ||
await networkToSwitchButton.waitFor({ state: 'hidden' }) | ||
await expect(networkButton).toHaveText(targetChain) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { expect } from '@playwright/test' | ||
import { testMEmail } from './shared/fixtures/w3m-email-fixture' | ||
|
||
testMEmail.beforeEach(async ({ modalValidator }) => { | ||
await modalValidator.expectConnected() | ||
}) | ||
|
||
testMEmail('it should initialize swap as expected', async ({ modalPage }) => { | ||
await modalPage.openAccount() | ||
const walletFeatureButton = await modalPage.getWalletFeaturesButton('swap') | ||
await walletFeatureButton.click() | ||
await expect(modalPage.page.getByTestId('swap-input-sourceToken')).toHaveValue('1') | ||
await expect(modalPage.page.getByTestId('swap-input-token-sourceToken')).toHaveText('ETH') | ||
await modalPage.page.getByTestId('swap-select-token-button-toToken').click() | ||
await modalPage.page | ||
.getByTestId('swap-select-token-search-input') | ||
.getByPlaceholder('Search token') | ||
.fill('USDC') | ||
await modalPage.page.getByTestId('swap-select-token-item-USDC').click() | ||
await expect(modalPage.page.getByTestId('swap-action-button')).toHaveText('Insufficient balance') | ||
}) | ||
|
||
testMEmail('it should initialize onramp as expected', async ({ modalPage }) => { | ||
await modalPage.openAccount() | ||
const walletFeatureButton = await modalPage.getWalletFeaturesButton('onramp') | ||
await walletFeatureButton.click() | ||
await expect(modalPage.page.getByText('Coinbase')).toBeVisible() | ||
}) | ||
|
||
testMEmail('it should initialize receive as expected', async ({ modalPage }) => { | ||
await modalPage.openAccount() | ||
const walletFeatureButton = await modalPage.getWalletFeaturesButton('receive') | ||
await walletFeatureButton.click() | ||
await modalPage.page.getByTestId('receive-address-copy-button').click() | ||
await expect(modalPage.page.getByText('Address copied')).toBeVisible() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters