-
Notifications
You must be signed in to change notification settings - Fork 4
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 redeem retryable e2e #62
Open
chrstph-dvx
wants to merge
1
commit into
54-set-up-synpress
Choose a base branch
from
54-add-redeem-retryable-e2e
base: 54-set-up-synpress
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
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,92 @@ | ||
import { addDefaultLocalNetwork } from '@arbitrum/sdk'; | ||
import { L1ToL2MessageCreator } from '@arbitrum/sdk/dist/lib/message/L1ToL2MessageCreator'; | ||
import { StaticJsonRpcProvider } from '@ethersproject/providers'; | ||
import { BigNumber, Wallet } from 'ethers'; | ||
|
||
const createRetryable = async () => { | ||
try { | ||
addDefaultLocalNetwork(); | ||
} catch (e) {} | ||
const ethProvider = new StaticJsonRpcProvider(Cypress.env('ETH_RPC_URL')); | ||
const arbProvider = new StaticJsonRpcProvider(Cypress.env('ARB_RPC_URL')); | ||
const privateKey = Cypress.env('PRIVATE_KEY'); | ||
const userWallet = new Wallet(privateKey); | ||
|
||
const l1Signer = userWallet.connect(ethProvider); | ||
const signerAddress = await l1Signer.getAddress(); | ||
|
||
// Instantiate the object | ||
const l1ToL2MessageCreator = new L1ToL2MessageCreator(l1Signer); | ||
|
||
// And create the retryable ticket | ||
const l1SubmissionTx = await l1ToL2MessageCreator.createRetryableTicket( | ||
{ | ||
from: signerAddress, | ||
l2CallValue: BigNumber.from(0), | ||
to: signerAddress, | ||
data: '0x', | ||
retryableData: { | ||
data: '0x', | ||
from: signerAddress, | ||
l2CallValue: BigNumber.from(0), | ||
to: signerAddress, | ||
deposit: BigNumber.from(0), | ||
maxFeePerGas: BigNumber.from(10), | ||
gasLimit: BigNumber.from(10), | ||
maxSubmissionCost: BigNumber.from(10), | ||
callValueRefundAddress: signerAddress, | ||
excessFeeRefundAddress: signerAddress, | ||
}, | ||
}, | ||
arbProvider, | ||
); | ||
const l1SubmissionTxReceipt = await l1SubmissionTx.wait(); | ||
return l1SubmissionTxReceipt; | ||
}; | ||
|
||
function goToTransactionPage(transactionHash: string) { | ||
cy.findByText('Arbitrum Cross-chain Message Dashboard').click(); | ||
cy.findByPlaceholderText('Paste your transaction hash') | ||
.should('exist') | ||
.type(transactionHash); | ||
return cy.findByDisplayValue('Submit').click(); | ||
} | ||
|
||
describe('Retryable', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
}); | ||
|
||
it("Display retryable information before it's claimed", async () => { | ||
const retryable = await createRetryable(); | ||
goToTransactionPage(retryable.transactionHash); | ||
cy.findByDisplayValue('Submit').click(); | ||
|
||
cy.findByText('Cross chain messages found').should('exist'); | ||
cy.findByText( | ||
'L1 to L2 message initiated from L1, but not yet created — check again in a few minutes!', | ||
).should('exist'); | ||
cy.findByText('Redeem').should('not.exist'); | ||
cy.findByText('Connect').should('not.exist'); | ||
}); | ||
|
||
it('Display expired retryable', () => { | ||
goToTransactionPage( | ||
'0xd5114540abaf1442b5bf2b1f31a4e49d333bb585bb39e87d99b2667b9e25c1f3', | ||
); | ||
cy.findByText('Cross chain messages found').should('exist'); | ||
cy.findByText('Retryable ticket expired.').should('exist'); | ||
cy.findByText('Redeem').should('not.exist'); | ||
cy.findByText('Connect').should('not.exist'); | ||
}); | ||
|
||
it('Display successful retryable information', () => { | ||
goToTransactionPage( | ||
'0xe07401ee4ba9131f6efe367eaace256a59daaf162a53e2e105caa810228487c8', | ||
); | ||
cy.findByText('Cross chain messages found').should('exist'); | ||
cy.findByText('Success! 🎉 Your retryable was executed.').should('exist'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
cy.findByText('Redeem').should('not.exist'); | ||
cy.findByText('Connect').should('not.exist'); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 help us when we are already assigning the env variables individually later?