-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from GuardianUI/test-examples
Add test examples
- Loading branch information
Showing
6 changed files
with
344 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ node_modules | |
.github | ||
dist/*.test.ts | ||
src | ||
test-examples | ||
CLA.md | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,52 @@ | ||
import { test } from "@guardianui/test"; | ||
|
||
test.describe("Bond Protocol", () => { | ||
test("Should create Fixed Term market", async ({ page, gui }) => { | ||
// Initialize fork | ||
await gui.initializeChain(1); | ||
|
||
// Go to bond protocol | ||
await page.goto("https://app.bondprotocol.finance/#/create"); | ||
|
||
// Mocking | ||
await gui.setEthBalance("100000000000000000000000"); | ||
await gui.setBalance("0x6b175474e89094c44da98b954eedeac495271d0f", "100000000000000000000000"); | ||
|
||
// Select DAI as payout token | ||
await page.waitForSelector("input[id='cm-payout-token-picker']"); | ||
await page.locator("input[id='cm-payout-token-picker']").first().click(); | ||
await page.waitForSelector("text=DAI"); | ||
await page.locator("text=DAI").first().click(); | ||
|
||
// Select DAI as output token | ||
await page.waitForSelector("input[id='cm-quote-token-picker']"); | ||
await page.locator("input[id='cm-quote-token-picker']").first().click(); | ||
await page.waitForSelector("text=DAI"); | ||
await page.locator("text=DAI").first().click(); | ||
|
||
// Select vesting term | ||
await page.waitForSelector("button[id='cm-vesting-picker']"); | ||
await page.locator("button[id='cm-vesting-picker']").first().click(); | ||
await page.waitForSelector("text=7 days"); | ||
await page.locator("text=7 days").first().click(); | ||
|
||
// Enter capacity | ||
await page.waitForSelector("input[id='cm-capacity-picker']"); | ||
await page.locator("input[id='cm-capacity-picker']").first().fill("100"); | ||
|
||
// Select end date | ||
await page.waitForSelector("input[id='cm-end-date-picker']"); | ||
await page.locator("input[id='cm-end-date-picker']").first().click(); | ||
await page.waitForSelector("input[placeholder='Enter the amount of days to run the market']"); | ||
await page.locator("input[placeholder='Enter the amount of days to run the market']").first().fill("1"); | ||
await page.locator("button:has-text('Select')").first().click(); | ||
|
||
// Open market submission modal | ||
await page.waitForSelector("button[id='cm-pre-submit']"); | ||
await page.locator("button[id='cm-pre-submit']").first().click(); | ||
|
||
// Confirm deployment | ||
await page.waitForSelector("button[id='cm-confirm-modal-submit-allowance']"); | ||
await gui.validateContractInteraction("button[id='cm-confirm-modal-submit-allowance']", "0x007f7735baf391e207e3aa380bb53c4bd9a5fed6"); | ||
}); | ||
}); |
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,43 @@ | ||
import { test } from "@guardianui/test"; | ||
|
||
test.describe("Olympus", () => { | ||
test("Should stake OHM to gOHM", async ({ page, gui }) => { | ||
// Initialize fork | ||
await gui.initializeChain(1); | ||
|
||
// Navigate to site | ||
await page.goto("https://app.olympusdao.finance/#/stake"); | ||
|
||
// Set up wallet | ||
await gui.setEthBalance("100000000000000000000000"); | ||
await gui.setAllowance("0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5", "0xb63cac384247597756545b500253ff8e607a8020", "1000000000000000000000000"); | ||
await gui.setBalance("0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5", "1000000000000000000000000"); | ||
|
||
// Clear any info modals | ||
let infoModalIsVisible = await page.isVisible("text=Did You Know?"); | ||
if (infoModalIsVisible) { | ||
await page.locator("[id='root']").click({ position: {x: 0, y: 0}, force: true }); | ||
} | ||
|
||
await page.waitForSelector("text=Connect Wallet"); | ||
await page.locator("text=Connect Wallet").first().click(); | ||
await page.waitForSelector("text=Connect Wallet"); | ||
await page.locator("text=Connect Wallet").first().click(); | ||
await page.locator("text=Metamask").first().click(); | ||
await page.locator("[id='root']").click({ position: {x: 0, y: 0}, force: true }); | ||
|
||
// Enter OHM input amount | ||
await page.locator("[data-testid='ohm-input']").type("0.1"); | ||
|
||
// Execute stake | ||
await page.waitForSelector("[data-testid='submit-button']"); | ||
await page.locator("[data-testid='submit-button']").click(); | ||
|
||
// Sign checkbox transaction | ||
await page.waitForSelector("[class='PrivateSwitchBase-input css-1m9pwf3']"); | ||
await page.locator("[class='PrivateSwitchBase-input css-1m9pwf3']").click(); | ||
|
||
// Submit stake transaction | ||
await gui.validateContractInteraction("[data-testid='submit-modal-button']", "0xb63cac384247597756545b500253ff8e607a8020"); | ||
}); | ||
}); |
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,40 @@ | ||
import { test } from "@guardianui/test"; | ||
|
||
test.describe("Ribbon Uni Deposit", () => { | ||
test("Should deposit UNI into the Ribbon UNI Covered Call Vault", async ({ page, gui }) => { | ||
// Initialize fork | ||
await gui.initializeChain(1); | ||
|
||
// Navigate to site | ||
await page.goto("https://app.ribbon.finance/v2/theta-vault/T-UNI-C"); | ||
|
||
// Mocking | ||
await gui.setEthBalance("100000000000000000000000"); | ||
await gui.setBalance("0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", "1000000000000000000000"); | ||
|
||
// Connect wallet | ||
let needToConnect = await page.isVisible("text=Connect Wallet"); | ||
if (needToConnect) { | ||
await page.waitForSelector("text=Connect Wallet"); | ||
await page.locator("text=Connect Wallet").first().click(); | ||
await page.locator("span:has-text('Ethereum')").click(); | ||
await page.locator("div[role='button']:has-text('Next')").click(); | ||
await page.locator("span:has-text('METAMASK')").click(); | ||
await page.locator("text=Connect WalletMETAMASKWALLET CONNECTCOINBASE WALLETConnectLearn more about walle >> div[role='button'] >> nth=3").click(); | ||
} | ||
|
||
// Wait for site to recognize UNI balance | ||
await page.waitForSelector("text=1,000 UNI"); | ||
|
||
// Enter UNI amount | ||
await page.waitForSelector("input[placeholder='0']"); | ||
await page.locator("input[placeholder='0']").first().type("1"); | ||
|
||
// Click preview deposit button | ||
await page.waitForSelector("button:has-text('Preview Deposit')"); | ||
await page.locator("button:has-text('Preview Deposit')").first().click(); | ||
|
||
// Click approve UNI button and verify contract target | ||
await gui.validateContractInteraction("button:has-text('Approve UNI') >> visible=true", "0xDD9d1B7dEaB1A843A1B584d2CA5903B8A4735deF"); | ||
}); | ||
}); |
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