-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e tests (playwright) #594
base: main
Are you sure you want to change the base?
Conversation
4612e7b
to
b2cfd0a
Compare
📦 build.zip [updated at Feb 17, 5:19:57 PM UTC] |
src/ui/index.tsx
Outdated
@@ -70,7 +70,11 @@ async function initializeUI({ | |||
try { | |||
await registerServiceWorker(); | |||
initializeChannels(); | |||
await maybeOpenOnboarding(); | |||
|
|||
if (process.env.NODE_ENV !== 'test') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that we need such checks in the code. Or this will create a different behaviour between prod build and test run. May be it is better to provide a predefined config for test like we have some wallets in it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I noticed that it doesn't affect that single test, so I just removed this condition
// Retry on CI only | ||
retries: process.env.CI ? 2 : 0, | ||
// Opt out of parallel tests on CI | ||
workers: process.env.CI ? 1 : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this aligns with fullyParallel: true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I understand:
fullyParallel: true
enables parallel tests inside a single file
workers: process.env.CI ? 1 : undefined
ensures only one file runs at a time in CI.
so it kinda limits file-level concurrency in CI but keeps parallelism within file
- name: Run Playwright tests | ||
run: xvfb-run npx playwright test | ||
|
||
- name: Upload Playwright report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this part work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I renamed the folder to e2e-report
e2e/test.ts
Outdated
}); | ||
} | ||
|
||
export async function takeScreenshot(page: Page, screenshotPath: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used anywhere. Do we need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't added an example that takes screenshots yet so probably yes it's better to remove it for now
8ad2784
to
40fa30f
Compare
export function generateRandomRecoveryPhrase() { | ||
const entropy = randomBytes(16); | ||
return entropyToMnemonic(entropy); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about
import { Wallet as EthersV5Wallet } from '@ethersproject/wallet';
export function generateRandomRecoveryPhrase() {
return EthersV5Wallet.createRandom().mnemonic.phrase;
}
Is this the same?
return entropyToMnemonic(entropy); | ||
} | ||
|
||
export function generateRandomWallet() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should conform to wallets that are being created in src/shared/wallet/create.ts
:
export function generateRandomWallet() { | |
export function generateRandomWallet(): BareWallet { |
@@ -0,0 +1,15 @@ | |||
import { entropyToMnemonic } from '@ethersproject/hdnode'; | |||
import { Wallet, randomBytes } from 'ethers'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer Wallet
from '@ethersproject/wallet'
?
82de783
to
f6b4e3f
Compare
f6b4e3f
to
e523f5b
Compare
test('custom padding', () => { | ||
const address = '0x7358B726830A2E222f9b139E90483A37142bcBE5'; | ||
const expected = `0x7358${ellipsis}cBE5`; | ||
expect(truncateAddress(address, 4)).toBe(expected); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's test at least two different padding values?
e2e/tests/test.ts
Outdated
// Determine headless mode: | ||
// - in CI: always run headless | ||
// - in dev: use RUN_HEADED_IN_DEV value unless overridden by testConfig | ||
const headless = | ||
!process.env.CI && (testConfig?.headless ?? !RUN_HEADED_IN_DEV); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contradicts comment
No description provided.