Skip to content
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 improvements #1302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cypress/integration/deposit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ context("Deposit Flow", () => {
cy.get("[data-testid=txnDeadlineInputGroup]")
.find("input")
.type((60 * 60 * 7).toString()) // 1 week for safety

// wait for balances to update
cy.get("[data-testid=tokenInputMax]").should("not.have.text", "0.0")

cy.get("#tokenInput input").then(($inputs) => {
cy.wrap($inputs).each(($input) => {
cy.wrap($input).type("100")
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/swap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ context("Swap Flow", () => {
cy.get("button").contains("Swap").should("be.enabled").click()
})
it("completes a swap", () => {
cy.getBySelId("highPriceImpactConfirmationContainer").then(
($highPriceImpaceContainer) => {
cy.getBySelId("highPriceImpactConfirmationContainer")
.should(() => true) // if this element doesn't exist, it shouldn't throw an exception
.then(($highPriceImpaceContainer) => {
if ($highPriceImpaceContainer.is(":visible")) {
cy.getBySelId("highPriceImpactConfirmCheck").find("input").check()
} else {
cy.log("high price impact is not detected")
}
},
)
})
cy.get("button").contains("Confirm Swap").should("be.enabled").click()
})
})
Expand Down
6 changes: 4 additions & 2 deletions src/components/TokenInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function TokenInput({
}

return (
<div {...rest}>
<div {...rest} data-testid="tokenInputWrapper">
{max && (
<Box display="flex" alignItems="center" justifyContent="end">
<Typography variant="subtitle2" sx={{ mr: 1 }}>
Expand All @@ -84,7 +84,9 @@ function TokenInput({
disabled={readonly || disabled}
onClick={() => onChange && onChange(String(max))}
>
<Typography variant="subtitle2">{commify(max)}</Typography>
<Typography variant="subtitle2" data-testid="tokenInputMax">
{commify(max)}
</Typography>
</Button>
</Box>
)}
Expand Down