-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix tests, add notification tests for native + erc20
- Loading branch information
Showing
9 changed files
with
76 additions
and
89 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,14 @@ import test from '@lib/BaseTest' | |
import { faker } from '@faker-js/faker' | ||
import { WatchListSpec } from '@pages/Login' | ||
import { MatchOptionFieldEnum, MatchOptionShouldEnum } from 'mailslurp-client' | ||
import { expect } from "@playwright/test" | ||
import { TestToken } from '../../../contracts/typechain/contracts/TestToken' | ||
import { TestNFT } from '../../../contracts/typechain/contracts/TestNFT' | ||
|
||
const emailTimeout = 30000 | ||
|
||
test(`@Notifications Check notification received on Ether transfer`, async ({ authorized }) => { | ||
const { TestTokenAddress } = process.env | ||
await authorized.openAccount() | ||
|
||
const token = await authorized.contracts.loadContract(`TestToken`, TestTokenAddress) as TestToken | ||
test(`@AccountImage @Notifications Check notification received on Ether transfer`, async ({ authorized }) => { | ||
await authorized.openWatchlist() | ||
const recipient = authorized.contracts.newWallet() | ||
console.log(`created recipient address: ${recipient.address}`) | ||
|
||
|
@@ -22,24 +20,27 @@ test(`@Notifications Check notification received on Ether transfer`, async ({ au | |
address: recipient.address.toLowerCase(), | ||
name: watchName, | ||
} as WatchListSpec) | ||
await authorized.check_tag_list(0, 0, watchName) | ||
await authorized.check_tag_list(0, 1, `0x`) | ||
await authorized.check_tag_list(0, 1, `(N/A)`) | ||
await authorized.check_tag_list(0, 1, `Edit`) | ||
await authorized.delay(5000) | ||
await authorized.checkNotificationItem() | ||
console.log(`sending Ether to recipient`) | ||
await authorized.contracts.sendEther(recipient.address, `0.01`) | ||
console.log(`awaiting blockscout indexing`) | ||
await authorized.delay(30000) | ||
|
||
await authorized.ms.waitForMatchingEmails( | ||
const emailResult = await authorized.ms.waitForMatchingEmails( | ||
{ matches: [{ field: MatchOptionFieldEnum.SUBJECT, should: MatchOptionShouldEnum.CONTAIN, value: watchName }] }, | ||
1, | ||
process.env.MAILSLURP_EMAIL_ID, | ||
emailTimeout, | ||
) | ||
console.log(`Received email: ${JSON.stringify(emailResult)}`) | ||
expect(emailResult[0].subject).toContain(`[Address Watch Alert] 0.01 ETH received at ${recipient.address.toLowerCase()} ${watchName}`) | ||
expect(emailResult[0].from).toContain(`[email protected]`) | ||
await authorized.deleteAddressWatch() | ||
}) | ||
|
||
test.skip(`@Notifications Check notification received on ERC20 transfer`, async ({ authorized }) => { | ||
test(`@AccountImage @Notifications Check notification received on ERC20 transfer`, async ({ authorized }) => { | ||
const { TestTokenAddress } = process.env | ||
await authorized.openAccount() | ||
await authorized.openWatchlist() | ||
|
||
const token = await authorized.contracts.loadContract(`TestToken`, TestTokenAddress) as TestToken | ||
const recipient = authorized.contracts.newWallet() | ||
|
@@ -51,25 +52,28 @@ test.skip(`@Notifications Check notification received on ERC20 transfer`, async | |
address: recipient.address.toLowerCase(), | ||
name: watchName, | ||
} as WatchListSpec) | ||
await authorized.check_tag_list(0, 0, watchName) | ||
await authorized.check_tag_list(0, 1, `0x`) | ||
await authorized.check_tag_list(0, 1, `(N/A)`) | ||
await authorized.check_tag_list(0, 1, `Edit`) | ||
await authorized.delay(5000) | ||
await authorized.checkNotificationItem() | ||
console.log(`sending ERC20 tokens to recipient`) | ||
const receipt = await (await token.transfer(recipient.address, 1)).wait() | ||
console.log(`receipt: ${JSON.stringify(receipt)}`) | ||
console.log(`awaiting blockscout indexing`) | ||
await authorized.delay(30000) | ||
|
||
await authorized.ms.waitForMatchingEmails( | ||
const emailResult = await authorized.ms.waitForMatchingEmails( | ||
{ matches: [{ field: MatchOptionFieldEnum.SUBJECT, should: MatchOptionShouldEnum.CONTAIN, value: watchName }] }, | ||
1, | ||
process.env.MAILSLURP_EMAIL_ID, | ||
emailTimeout, | ||
) | ||
console.log(`Received email: ${JSON.stringify(emailResult)}`) | ||
expect(emailResult[0].subject).toContain(`[Address Watch Alert] 0.000000000000000001 EPIC received at ${recipient.address.toLowerCase()} ${watchName}`) | ||
expect(emailResult[0].from).toContain(`[email protected]`) | ||
await authorized.deleteAddressWatch() | ||
}) | ||
|
||
test.skip(`@Notifications Check notification received on NFT transfer`, async ({ authorized }) => { | ||
const { TestNFTAddress } = process.env | ||
await authorized.openAccount() | ||
test.skip(`@AccountImage @Notifications Check notification received on NFT transfer`, async ({ authorized }) => { | ||
const { TestNFTAddress, TestTokenHolder } = process.env | ||
await authorized.openWatchlist() | ||
|
||
const nft = await authorized.contracts.loadContract(`TestNFT`, TestNFTAddress) as TestNFT | ||
const recipient = authorized.contracts.newWallet() | ||
|
@@ -81,18 +85,20 @@ test.skip(`@Notifications Check notification received on NFT transfer`, async ({ | |
address: recipient.address.toLowerCase(), | ||
name: watchName, | ||
} as WatchListSpec) | ||
await authorized.check_tag_list(0, 0, watchName) | ||
await authorized.check_tag_list(0, 1, `0x`) | ||
await authorized.check_tag_list(0, 1, `(N/A)`) | ||
await authorized.check_tag_list(0, 1, `Edit`) | ||
await authorized.checkNotificationItem() | ||
await authorized.delay(5000) | ||
const receipt = await (await nft.transferOwnership(recipient.address)).wait() | ||
console.log(`receipt: ${JSON.stringify(receipt)}`) | ||
// const receipt = await (await nft.transferOwnership(recipient.address)).wait() | ||
// console.log(`transferred ownership: ${JSON.stringify(receipt)}`) | ||
const receipt = await (await nft.mintNFT(recipient.address, watchName)).wait() | ||
console.log(`minted new token for recipient: ${JSON.stringify(receipt)}`) | ||
|
||
await authorized.ms.waitForMatchingEmails( | ||
const emailResult = await authorized.ms.waitForMatchingEmails( | ||
{ matches: [{ field: MatchOptionFieldEnum.SUBJECT, should: MatchOptionShouldEnum.CONTAIN, value: watchName }] }, | ||
1, | ||
process.env.MAILSLURP_EMAIL_ID, | ||
emailTimeout, | ||
) | ||
expect(emailResult[0].subject).toContain(`[Address Watch Alert] 0.000000000000000001 NFT received at ${recipient} ${watchName}`) | ||
expect(emailResult[0].from).toContain(`[email protected]`) | ||
console.log(`Received email: ${JSON.stringify(emailResult)}`) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
#!/usr/bin/env bash | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/blocks" ITERATIONS=5 VUS=10 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/txs" ITERATIONS=5 VUS=10 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/ops" ITERATIONS=5 VUS=10 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/tokens" ITERATIONS=5 VUS=10 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/accounts" ITERATIONS=5 VUS=10 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/address/0x54FA517F05e11Ffa87f4b22AE87d91Cec0C2D7E1?tab=token_transfers" ITERATIONS=5 VUS=10 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/token/0x183209DA02C281709A5BcD40188AaFfA04A7fEfD?tab=holders" ITERATIONS=5 VUS=10 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/blocks" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/txs" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/ops" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/tokens" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/accounts" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/address/0x54FA517F05e11Ffa87f4b22AE87d91Cec0C2D7E1" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/address/0x54FA517F05e11Ffa87f4b22AE87d91Cec0C2D7E1?tab=token_transfers" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts | ||
LOKI_URL="http://localhost:3100/loki/api/v1/push" BASE_URL="https://eth-sepolia.blockscout.com" PAGE="/token/0x183209DA02C281709A5BcD40188AaFfA04A7fEfD?tab=holders" ITERATIONS=5 VUS=1 K6_BROWSER_ENABLED=true K6_BROWSER_HEADLESS=true ./bin_k6/k6-tsdb-darwin run src/frontend.browser.test.suite.ts |