-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ost-ptk
committed
Nov 14, 2023
1 parent
6bcc2c7
commit 98b6b8d
Showing
11 changed files
with
377 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MC4CAQAwBQYDK2VwBCIEIHRZr1HEgKVbgchuatwA7dCWDWB7QZe+bpDb5dguIyLE | ||
-----END PRIVATE KEY----- |
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
108 changes: 108 additions & 0 deletions
108
e2e-tests/popup/connect-account/connect-account.spec.ts
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,108 @@ | ||
import { Page } from '@playwright/test'; | ||
|
||
import { popup, popupExpect } from '../../fixtures'; | ||
import { ACCOUNT_NAMES, PLAYGROUND_URL } from '../../common'; | ||
|
||
popup.describe('Popup UI: connect account', () => { | ||
let connectAccountPage: Page; | ||
|
||
popup.beforeEach(async ({ page, context, unlockVault }) => { | ||
await page.goto(PLAYGROUND_URL); | ||
|
||
[connectAccountPage] = await Promise.all([ | ||
context.waitForEvent('page'), | ||
page.getByRole('button', { name: 'Connect', exact: true }).click() | ||
]); | ||
|
||
await unlockVault(connectAccountPage); | ||
}); | ||
|
||
popup( | ||
'should connect one account to playground', | ||
async ({ extensionId, page }) => { | ||
await popupExpect( | ||
connectAccountPage.getByText('Connect with Casper Wallet Playground') | ||
).toBeVisible(); | ||
|
||
await popupExpect( | ||
connectAccountPage.getByRole('button', { name: 'Next' }) | ||
).toBeDisabled(); | ||
|
||
await connectAccountPage | ||
.getByText(ACCOUNT_NAMES.defaultFirstAccountName, { exact: true }) | ||
.click(); | ||
|
||
await popupExpect( | ||
connectAccountPage.getByRole('button', { name: 'Next' }) | ||
).toBeEnabled(); | ||
|
||
await connectAccountPage.getByRole('button', { name: 'Next' }).click(); | ||
await connectAccountPage | ||
.getByRole('button', { name: 'Connect to 1 account' }) | ||
.click(); | ||
|
||
await page.goto(`chrome-extension://${extensionId}/popup.html`); | ||
|
||
await page.getByTestId('menu-open-icon').click(); | ||
await page.getByText('Connected sites').click(); | ||
|
||
await popupExpect( | ||
page.getByText('Casper Wallet Playground') | ||
).toBeVisible(); | ||
await popupExpect( | ||
page.getByText('casper-wallet-playground.make.services') | ||
).toBeVisible(); | ||
await popupExpect( | ||
page.getByRole('button', { name: 'Disconnect' }) | ||
).toBeVisible(); | ||
await popupExpect( | ||
page.getByText(ACCOUNT_NAMES.defaultFirstAccountName) | ||
).toBeVisible(); | ||
} | ||
); | ||
|
||
popup( | ||
'should connect two accounts to playground', | ||
async ({ extensionId, page }) => { | ||
await popupExpect( | ||
connectAccountPage.getByText('Connect with Casper Wallet Playground') | ||
).toBeVisible(); | ||
|
||
await popupExpect( | ||
connectAccountPage.getByRole('button', { name: 'Next' }) | ||
).toBeDisabled(); | ||
|
||
await connectAccountPage.getByText('select all', { exact: true }).click(); | ||
|
||
await popupExpect( | ||
connectAccountPage.getByRole('button', { name: 'Next' }) | ||
).toBeEnabled(); | ||
|
||
await connectAccountPage.getByRole('button', { name: 'Next' }).click(); | ||
await connectAccountPage | ||
.getByRole('button', { name: 'Connect to 2 accounts' }) | ||
.click(); | ||
|
||
await page.goto(`chrome-extension://${extensionId}/popup.html`); | ||
|
||
await page.getByTestId('menu-open-icon').click(); | ||
await page.getByText('Connected sites').click(); | ||
|
||
await popupExpect( | ||
page.getByText('Casper Wallet Playground') | ||
).toBeVisible(); | ||
await popupExpect( | ||
page.getByText('casper-wallet-playground.make.services') | ||
).toBeVisible(); | ||
await popupExpect( | ||
page.getByRole('button', { name: 'Disconnect' }) | ||
).toBeVisible(); | ||
await popupExpect( | ||
page.getByText(ACCOUNT_NAMES.defaultFirstAccountName) | ||
).toBeVisible(); | ||
await popupExpect( | ||
page.getByText(ACCOUNT_NAMES.defaultSecondAccountName) | ||
).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
71 changes: 71 additions & 0 deletions
71
e2e-tests/popup/disconnect-account/disconnect-account.spec.ts
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,71 @@ | ||
import { popup, popupExpect } from '../../fixtures'; | ||
import { ACCOUNT_NAMES, PLAYGROUND_URL } from '../../common'; | ||
|
||
popup.describe('Popup UI: disconnect account', () => { | ||
popup.beforeEach(async ({ connectAccounts }) => { | ||
await connectAccounts(); | ||
}); | ||
|
||
popup( | ||
'should click the disconnect button on dapp and disconnect all accounts from the site', | ||
async ({ page, extensionId }) => { | ||
await page.goto(PLAYGROUND_URL); | ||
|
||
await page.getByRole('button', { name: 'Disconnect' }).click(); | ||
|
||
await page.goto(`chrome-extension://${extensionId}/popup.html`); | ||
await page.getByTestId('menu-open-icon').click(); | ||
await page.getByText('Connected sites').click(); | ||
|
||
await popupExpect(page.getByText('No connected sites yet')).toBeVisible(); | ||
} | ||
); | ||
|
||
popup( | ||
'should click the disconnect button on connecting site page and disconnect one account from the site', | ||
async ({ popupPage }) => { | ||
await popupPage.getByTestId('menu-open-icon').click(); | ||
await popupPage.getByText('Connected sites').click(); | ||
|
||
await popupExpect( | ||
popupPage.getByText(ACCOUNT_NAMES.defaultFirstAccountName) | ||
).toBeVisible(); | ||
await popupExpect( | ||
popupPage.getByText(ACCOUNT_NAMES.defaultSecondAccountName) | ||
).toBeVisible(); | ||
|
||
const disconnectIcons = await popupPage | ||
.getByTestId('disconnect-account-icon') | ||
.all(); | ||
await disconnectIcons[0].click(); | ||
|
||
await popupExpect( | ||
popupPage.getByText(ACCOUNT_NAMES.defaultFirstAccountName) | ||
).not.toBeVisible(); | ||
await popupExpect( | ||
popupPage.getByText(ACCOUNT_NAMES.defaultSecondAccountName) | ||
).toBeVisible(); | ||
} | ||
); | ||
|
||
popup( | ||
'should click the disconnect button on connecting site page and disconnect all accounts from the site', | ||
async ({ popupPage }) => { | ||
await popupPage.getByTestId('menu-open-icon').click(); | ||
await popupPage.getByText('Connected sites').click(); | ||
|
||
await popupExpect( | ||
popupPage.getByText(ACCOUNT_NAMES.defaultFirstAccountName) | ||
).toBeVisible(); | ||
await popupExpect( | ||
popupPage.getByText(ACCOUNT_NAMES.defaultSecondAccountName) | ||
).toBeVisible(); | ||
|
||
await popupPage.getByRole('button', { name: 'Disconnect' }).click(); | ||
|
||
await popupExpect( | ||
popupPage.getByText('No connected sites yet') | ||
).toBeVisible(); | ||
} | ||
); | ||
}); |
Oops, something went wrong.