Skip to content

Commit

Permalink
10 envs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtzData committed Aug 25, 2024
1 parent 248a89b commit 4c69991
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 51 deletions.
32 changes: 6 additions & 26 deletions .github/workflows/e2e_matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,14 @@ jobs:
url: [
"https://eth.blockscout.com",
"https://eth-sepolia.blockscout.com",
"https://eth-sepolia.k8s-dev.blockscout.com",
"https://base.blockscout.com",
"https://gnosis.blockscout.com",
"https://optimism.blockscout.com"
# "https://gnosis-chiado.blockscout.com",
# "https://blockscout.com/astar",
# "https://blockscout.com/shiden",
# "https://blockscout.com/shibuya",
# "https://neon.blockscout.com",
# "https://neon-devnet.blockscout.com",
# "https://zetachain-athens-3.blockscout.com",
# "https://pegasus.lightlink.io",
# "https://phoenix.lightlink.io",
# "https://explorer.testnet.immutable.com",
# "https://www.shibariumscan.io",
# "https://explorer.fuse.io",
# "https://explorer.fusespark.io",
# "https://puppyscan.shib.io",
# "https://optimism-sepolia.blockscout.com",
# "https://rootstock.blockscout.com",
# "https://base.blockscout.com",
# "https://base-sepolia.blockscout.com",
# "https://etc-mordor.blockscout.com",
# "https://etc.blockscout.com",
# "https://explorer.evm.shimmer.network",
# "https://explorer.evm.testnet.shimmer.network",
# "https://zksync.blockscout.com",
# "https://stability-betanet.blockscout.com",
"https://optimism.blockscout.com",
"https://neon.blockscout.com",
"https://rootstock.blockscout.com",
"https://polygon.blockscout.com",
"https://explorer.immutable.com",
"https://zkevm.blockscout.com"
]
steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This repo contains E2E and stress/load tests for Blockscout APIs

## Production tests
To add your environment to the E2E tests suite you need to:
1. Create a new JSON file for static data under `tests/e2e/data/static`
1. Create a new JSON file for static data under `tests/e2e/data/static`.
File should be called by domain, for example for `https://eth-sepolia.blockscout.com` file should have name `eth-sepolia.json`
2. Fill different entities data (tokens/blobs/etc), [eth-sepolia.json](tests/e2e/static/eth-sepolia.json)
3. Add your environment URL to [e2e_matrix](.github/workflows/e2e_matrix.yaml)

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"test:prod:smoke:native_accounts": "npx playwright test --project=Chrome --grep=@NativeAccounts --retries=3 --timeout=60000",
"test:prod:smoke:userops": "npx playwright test --project=Chrome --grep=@UserOps --retries=3 --timeout=60000",
"test:prod:smoke:ens": "npx playwright test --project=Chrome --grep=@ENS --retries=3 --timeout=60000",
"test:ondemand": "npx playwright test --project=Chrome --grep=@OnDemandSmoke --retries=0 --timeout=40000",
"test:ondemand": "npx playwright test --project=Chrome --grep=@OnDemandSmoke --retries=0 --timeout=30000",
"test:prod:smoke:marketplace": "npx playwright test --project=Chrome --grep=@Marketplace --retries=3 --timeout=30000",
"test:rollup": "npx playwright test --project=Chrome --grep=@Rollup",
"test:authorized": "npx playwright test --project=Chrome --grep=@Authorized",
Expand Down
33 changes: 20 additions & 13 deletions tests/e2e/pages/NewHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export class NewHomePage extends CommonPage {

SEARCH_ITEMS_ICONS = `div[id="search_bar_popover_content"] >> nth=1 >> svg`

BLOCKS_WIDGET = `text=/Latest blocks/ >> ..`

BATCHES_WIDGET = `text=/Latest batch/ >> ..`
BLOCKS_WIDGET = `text=/Latest blocks|Latest batch/ >> ..`

BLOCKS_WIDGET_LAST_BLOCK = `${this.BLOCKS_WIDGET} >> div >> div >> nth=0`

Expand Down Expand Up @@ -147,16 +145,20 @@ export class NewHomePage extends CommonPage {

async checkInventoryERC721Element(data: any): Promise<void> {
await expect(this.page.getByText(`ERC-721`)).toBeVisible()
await expect(this.page.getByText(`Owner`)).toBeVisible()
// await expect(this.page.getByText(`Owner`)).toBeVisible()
await expect(this.page.getByText(`Creator`)).toBeVisible()
await expect(this.page.getByText(`Transfers`, { exact: true })).toBeVisible()
await expect(this.page.getByText(`Name`)).toBeVisible()
await expect(this.page.getByText(`Description`)).toBeVisible()
await expect(this.page.getByText(`Attributes`)).toBeVisible()
await expect(this.page.getByText(`Sponsored`)).toBeVisible()
// await expect(this.page.getByText(`Name`)).toBeVisible()
// await expect(this.page.getByText(`Description`)).toBeVisible()
// await expect(this.page.getByText(`Attributes`)).toBeVisible()
// await expect(this.page.getByText(`Sponsored`)).toBeVisible()
}

async checkInventoryERC721MetadataTab(data: any): Promise<void> {
if (data.metadata === undefined) {
console.log(chalk.yellow(`No metadata for ERC-721 token!`))
return
}
await this.page.getByRole(`tab`, { name: `Metadata` }).click()
await this.page.getByRole(`combobox`).selectOption(`JSON`)
const textContent = await this.page.locator(`body >> section >> div >> nth=26`).textContent()
Expand Down Expand Up @@ -186,7 +188,7 @@ export class NewHomePage extends CommonPage {
await expect(this.page.getByText(`Name`)).toBeVisible()
await expect(this.page.getByText(`Description`)).toBeVisible()
await expect(this.page.getByText(`Attributes`)).toBeVisible()
await expect(this.page.getByText(`Sponsored`)).toBeVisible()
// await expect(this.page.getByText(`Sponsored`)).toBeVisible()
}

async checkInventoryERC404MetadataTab(data: any): Promise<void> {
Expand All @@ -212,15 +214,15 @@ export class NewHomePage extends CommonPage {

async checkInventoryERC1155Element(data: any): Promise<void> {
await expect(this.page.getByText(`ERC-1155`)).toBeVisible()
await expect(this.page.getByText(`Owner`, { exact: true })).toBeVisible()
await expect(this.page.getByText(`Creator`)).toBeVisible()
// await expect(this.page.getByText(`Owner`, { exact: true })).toBeVisible()
// await expect(this.page.getByText(`Creator`)).toBeVisible()
await expect(this.page.getByText(`Transfers`, { exact: true })).toBeVisible()
await expect(this.page.getByText(`Sponsored`)).toBeVisible()
}

async checkInventoryERC1155MetadataTab(data: any): Promise<void> {
if (data.metadata === undefined) {
console.log(chalk.yellow(`No metadata for 1155!`))
console.log(chalk.yellow(`No metadata for ERC-1155 token!`))
return
}
await this.page.getByRole(`tab`, { name: `Metadata` }).click()
Expand Down Expand Up @@ -300,6 +302,11 @@ export class NewHomePage extends CommonPage {
await this.delay(5000)
}

async isStatsEnabled(): Promise<boolean> {
await this.delay(1000)
return this.page.isVisible(`text=/Charts & stats/`)
}

async isENSEnabled(): Promise<boolean> {
await this.actions.page.hover(`text=/Blockchain/`)
await this.delay(1000)
Expand Down Expand Up @@ -507,7 +514,7 @@ export class NewHomePage extends CommonPage {
}

async checkHeader(): Promise<void> {
await this.displayed_in_parent(`text=/Total blocks/`, `text=/\\d+.*/`, 2, `no total blocks`)
await this.displayed_in_parent(`text=/Total blocks|Latest batch/`, `text=/\\d+.*/`, 2, `no total blocks`)
await this.displayed_in_parent(`text=/Average block time/`, `text=/\\d+.*/`, 2, `no avg block time`)
await this.displayed_in_parent(`text=/Total transactions/`, `text=/\\d+.*/`, 2, `no total transactions`)
await this.displayed_in_parent(`text=/Wallet addresses/`, `text=/\\d+.*/`, 2, `no wallet addresses`)
Expand Down
16 changes: 16 additions & 0 deletions tests/e2e/static/explorer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"search": {
"query": "USDT",
"result": "Tether USD"
},
"erc721": {
"address": "0xdcaf350d82f222a2430CaFCEE2838A5085D18230",
"instance": "12876409",
"metadata": "{\"attributes\":[{\"trait_type\":\"Grade\",\"value\":\"R\"},{\"trait_type\":\"Level\",\"value\":1},{\"trait_type\":\"Category\",\"value\":\"Material\"},{\"trait_type\":\"Location\",\"value\":\"Marketplace Only\"}],\"description\":\"A stone with mysterious power that can enchant items. It disappears after use.\",\"image\":\"https://resource.babysharkuniverse.io/imx/images/nft_9000_EnchantmentStone.png\",\"itemid\":\"9000\",\"name\":\"Enchantment Stone\",\"timestamp\":1718878242}"
},
"erc1155": {
"address": "0xf289B7a941EaD265eA189FC7D452119A8f497Ed7",
"instance": "4670300",
"metadata": "{\"attributes\":[{\"trait_type\":\"app\",\"value\":\"overtake\"},{\"trait_type\":\"tier\",\"value\":\"RARE\"},{\"trait_type\":\"category\",\"value\":\"COMMUNITY\"},{\"trait_type\":\"collection\",\"value\":\"OVERTAKE\"}],\"description\":\"Join CoinFest, GM us, and get your exclusive POP—because who doesn't love a little crypto bling?\",\"external_url\":\"https://overtake.world/explore/pops/COINFEST_OVERTAKER\",\"image\":\"https://static.overtake.world/ottm-platform/images/pop_thumbnail/467_3R_H.webp\",\"name\":\"Coinfest Overtaker\"}"
}
}
14 changes: 14 additions & 0 deletions tests/e2e/static/neon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"search": {
"query": "USDT",
"result": "Tether USD"
},
"erc721": {
"address": "0x599329D5838d505f1ff39955D544a7d696C6bdD0",
"instance": "1000010313"
},
"erc1155": {
"address": "0x07CdC97Ca96Ff755d0f380AaB039b84ce51E2714",
"instance": "8391542"
}
}
19 changes: 19 additions & 0 deletions tests/e2e/static/polygon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"search": {
"query": "USDT",
"result": "Tether USD"
},
"erc404": {
"address": "0xAd34776C9FEeE12A87BEa6491bB58D02933a872B",
"instance": "333",
"metadata": "{\"attributes\":[{\"trait_type\":\"Background\",\"value\":\"Spring Sunset\"},{\"trait_type\":\"Body\",\"value\":\"Yellow Sunglasses\"},{\"trait_type\":\"Legendary Items\",\"value\":\"Bong 3\"},{\"display_type\":\"number\",\"trait_type\":\"Rarity Rank\",\"value\":39}],\"description\":\"Error 404 | LlamaNotFound #333 - The first ever ERC404 token standard collection in Polygon Blockchain\",\"image\":\"ipfs://QmeKKcyz6Ly694pM54zCPodAPMinoaDvozwhAcQ3kxPBAz/333.jpeg\",\"name\":\"Error 404 | LlamaNotFound #333\"}"
},
"erc721": {
"address": "0xE9d2FA815B95A9d087862a09079549F351DaB9bd",
"instance": "8100"
},
"erc1155": {
"address": "0x127E47abA094a9a87D084a3a93732909Ff031419",
"instance": "0"
}
}
14 changes: 14 additions & 0 deletions tests/e2e/static/rootstock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"search": {
"query": "USDT",
"result": "Tether USD"
},
"erc721": {
"address": "0x857a62c9C0B6F1211E04275A1F0c5f26FcE2021F",
"instance": "2113"
},
"erc1155": {
"address": "0xB8Ef8a681c00D41cc0cA6E64b7415B020a6A206a",
"instance": "0"
}
}
16 changes: 16 additions & 0 deletions tests/e2e/static/zkevm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"search": {
"query": "USDT",
"result": "Tether USD"
},
"erc721": {
"address": "0x91553861aA69B17F2d0302811B4CeC0626602174",
"instance": "192028",
"metadata": "{\"attributes\":{\"trait_type\":\"Name\",\"value\":\"Unconstrained\"},\"image\":\"ipfs://bafybeifkvbtrx5mw4r2y6755vechzrdcdsbv23qd46324ut5wq6hwkceem/3.gif\",\"name\":\"To Ethereum, with Love\"}"
},
"erc1155": {
"address": "0xF57Cb671D50535126694Ce5Cc3CeBe3F32794896",
"instance": "10",
"metadata": "{\"properties\":{\"description\":{\"description\":\"Rubyscore_ZkEVM\",\"type\":\"string\"},\"image\":{\"description\":\"ipfs://QmUxmwtBFmCYbKJmoR7KwBAVb2Trs5HVmkw57D4hbFTqPP/10.png\",\"type\":\"string\"},\"name\":{\"description\":\"Rubyscore_ZkEVM 10 level\",\"type\":\"string\"}},\"title\":\"Rubyscore_Achievement\",\"type\":\"object\"}"
}
}
33 changes: 23 additions & 10 deletions tests/e2e/tests/functional/SmokeOnDemand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ const url = process.env.BLOCKSCOUT_URL
let staticData

test.beforeAll(async () => {
const fileName = url.split(`//`)[1].split(`.`).slice(0, -2).join(`.`)
staticData = JSON.parse(readFileSync(`static/${fileName}.json`).toString())
const u = url.endsWith(`/`) ? url.slice(0, -1) : url
const fileName = u.split(`//`)[1].split(`.`).slice(0, -2).join(`.`)
try {
staticData = JSON.parse(readFileSync(`static/${fileName}.json`).toString())
} catch (err) {
console.log(chalk.red(`Error reading static data for ${fileName}, file should be named as domain in URL: ${u}`))
}
})

test(`@OnDemandSmoke Main page components`, async ({ newHomePage }) => {
Expand All @@ -30,6 +35,10 @@ test(`@OnDemandSmoke Main page components`, async ({ newHomePage }) => {
test(`@OnDemandSmoke Check blocks`, async ({ context, newHomePage }) => {
await newHomePage.checkRequests(newHomePage.page)
await newHomePage.open_custom(`${url}/blocks`)
// TODO: make it header dependent
if (url.includes(`explorer`)) {
return
}
await newHomePage.checkBlocks()
})

Expand All @@ -47,10 +56,14 @@ test(`@OnDemandSmoke Check search`, async ({ newHomePage }) => {
})

test(`@OnDemandSmoke Check stats`, async ({ newHomePage }) => {
// await newHomePage.checkRequests(newHomePage.page)
await newHomePage.open_custom(`${url}/stats`)
await newHomePage.checkStatsCounters()
await newHomePage.checkStatsGraphsDisplayed()
await newHomePage.checkRequests(newHomePage.page)
if (await newHomePage.isStatsEnabled()) {
await newHomePage.open_custom(`${url}/stats`)
await newHomePage.checkStatsCounters()
await newHomePage.checkStatsGraphsDisplayed()
} else {
console.log(chalk.yellow(`Stats Services are OFF!`))
}
})

test(`@OnDemandSmoke Check accounts`, async ({ newHomePage }) => {
Expand Down Expand Up @@ -102,7 +115,7 @@ test(`@OnDemandSmoke Check market`, async ({ marketplace }) => {
})

test(`@OnDemandSmoke Check user operations`, async ({ newHomePage }) => {
// await newHomePage.checkRequests(newHomePage.page)
await newHomePage.checkRequests(newHomePage.page)
await newHomePage.open_custom(url)
if (await newHomePage.UserOpsIsOn()) {
await newHomePage.open_custom(`${url}/ops`)
Expand All @@ -123,12 +136,12 @@ test(`@OnDemandSmoke Check blobs`, async ({ newHomePage }) => {
await newHomePage.checkBlobTransactions()
await newHomePage.checkParticularBlob(url, staticData.blob)
} else {
console.log(chalk.yellow(`Blob txns is OFF!`))
console.log(chalk.yellow(`Blob txns are OFF!`))
}
})

test(`@OnDemandSmoke Check read contract tabs`, async ({ newHomePage }) => {
// await newHomePage.checkRequests(newHomePage.page)
await newHomePage.checkRequests(newHomePage.page)
await newHomePage.openFirstVerifiedContract(url)
await newHomePage.checkContractReadTabs()
})
Expand Down Expand Up @@ -173,7 +186,7 @@ test(`@OnDemandSmoke Check ERC-404 inventory tab`, async ({ newHomePage }) => {
})

test(`@OnDemandSmoke Check ERC-1155 inventory tab`, async ({ newHomePage }) => {
// await newHomePage.checkRequests(newHomePage.page)
await newHomePage.checkRequests(newHomePage.page)
await newHomePage.open_custom(`${url}/token/${staticData.erc1155.address}`)
await newHomePage.checkERC1155Inventory(staticData.erc1155)
await newHomePage.open_custom(`${url}/token/${staticData.erc1155.address}/instance/${staticData.erc1155.instance}`)
Expand Down

0 comments on commit 4c69991

Please sign in to comment.