-
Notifications
You must be signed in to change notification settings - Fork 11
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
test: add e2e test #151
test: add e2e test #151
Conversation
Codecov Report
@@ Coverage Diff @@
## main #151 +/- ##
=======================================
Coverage 86.75% 86.75%
=======================================
Files 41 41
Lines 770 770
Branches 95 95
=======================================
Hits 668 668
Misses 20 20
Partials 82 82 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -0,0 +1,7 @@ | |||
import { setCommitHashToReport } from './util'; | |||
|
|||
describe('get Env', function () { |
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.
Seems it is not a test case, maybe a setup step for global.
Please use globalSetup
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.
At that time, I made some adjustments in globalSetup, but it seemed that the Allure plugin had not been loaded yet, which resulted in an error. Therefore, I directly wrote it in the test case instead.
e2e/packages/e2e/src/setup/launch.ts
Outdated
args: [`--disable-extensions-except=${option.nexusPath}`, `--load-extension=${option.nexusPath}`], | ||
permissions: ['clipboard-read'], | ||
slowMo: 10, | ||
// // recordVideo: { |
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.
add a TODO or FIXME here for complain the reason.
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.
the "recordVideo" function was too difficult to use, so I commented it out.now will remove it
{ | ||
files: '*.{ts,tsx}', | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'error', |
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.
The better way is to modify these rules. I have seen many /* eslint-disable xxxxxxx */
in e2e. these rules may not suitable to enable on the e2e test files. @homura can we modify it? I need your opinion.
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.
There are only 12 disable mark in this PR, and I found no disable mark for any
, therefore, just keep it as it is
id: startWeb | ||
if: success() || failure() | ||
run: | | ||
cd /home/runner/work/nexus/nexus/e2e/packages/nexus-web |
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.
Is there a ENV property for the path /home/runner/work/nexus/nexus
?
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 path is the fixed path in the action, need to modify it?
Co-authored-by: Shinya <[email protected]>
…thub.io PERSON_TOKEN => E2E_PERSON_TOKEN
The |
connected statue test can't e2e
connected statue test can't e2e
|
After the review, I think e2e needs to have some conventions, and here are some of my suggestions Element QueryPriorityWe can check out the testing-libarary data-testid Standardizationuse the data-testid to find an element, the block // 👍
my-block // 👍 dash to concatenate words
block__elem // 👍 element of a block
my-block__elem // 👍 dash block with element
my-block__another-elem // 👍
MyBlock // 👎 migrate to dash
myBlock // 👎 migrate to dash
block__elem__another-elem // 👎 multiple level element is not recommended Testing CodeFollow the KISS (keep it simple, stupid) principle
// ownership-sign-tx
// init with default mnemonic and whitelist
describe("fullOwnership sign transaction", () => {
it('should send a signed tx successfully', () => {
await createTestEnv({
launchCkb: true
// a ckb object implemented by playwright
}, ({ rpc, ckb, nexus, browser }) => {
// open the nexus-e2e
await browser.open("http://localhost:3000")
// simulate a dApp to assemble a transaction
const provider = new FullOwnershipProvider(ckb)
txSkeleton = await provider.injectCapacity({
amount: CkbAmount.from(1000)
})
// NO await here, since we need do something on Nexus extension
const signTxPromise = provider.signTransaction(tx)
await nexus.focus();
await nexus.fill(`[type="password"]`, DEFAULT_PASSWORD)
await nexus.click({text: "Approve"})
// await signed tx here
const signature = await signTxPromise
const txHash = await sendTransaction(tx)
await rpc.waitForNextBlock()
expect(await rpc.getTransaction(txHash)).not.empty()
})
})
}) |
What Changed
Resolve: #120
add e2e test
Motivation
Change Type
Indicate the type of change your pull request is:
documentation
patch
minor
major
Some pre-actions are required to trigger the E2E test
https://github.com/gpBlockchain/nexus/blob/fe55bc73f738619d33f6ab8f11b633fe6fdf7535/.github/workflows/e2e.yaml#L89
https://github.com/gpBlockchain/nexus/blob/fe55bc73f738619d33f6ab8f11b633fe6fdf7535/.github/workflows/e2e.yaml#L100
https://github.com/gpBlockchain/nexus/tree/lgp/fix-e2e/e2e/packages/e2e#how-to-add-personal-access-token