Skip to content

Commit

Permalink
changes from k8s remote runner
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtzData committed Apr 8, 2024
1 parent 4c8af99 commit fd764be
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 115 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/load_browser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
test_name:
description: 'Test name'
default: ci-api-browser
iterations:
description: 'Iterations'
default: 10
browsers:
description: 'Browsers'
default: 1
url:
description: 'Environment Root URL'
required: true
Expand All @@ -20,10 +26,7 @@ on:
- https://eth-sepolia.blockscout.com
- https://gnosis.blockscout.com
- https://eth.blockscout.com
request_timeout:
description: 'Global request timeout'
required: true
default: 20000


jobs:
browser:
Expand Down Expand Up @@ -54,8 +57,8 @@ jobs:
env:
LOKI_URL: ${{ secrets.LOKI_URL }}
BASE_URL: ${{ inputs.url }}
ITERATIONS: 5
VUS: 1
ITERATIONS: ${{ inputs.iterations }}
VUS: ${{ inputs.browsers }}
K6_BROWSER_ENABLED: true
K6_BROWSER_HEADLESS: true
run: |
Expand Down
84 changes: 84 additions & 0 deletions tests/e2e/pages/NewHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class NewHomePage extends CommonPage {

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

BATCHES_WIDGET = `text=/Latest batch/ >> ..`

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

TXNS_FIELDS = `body >> div >> nth=98 >> div >> div >> div >> div >> div >> div >> div`
Expand Down Expand Up @@ -70,6 +72,76 @@ export class NewHomePage extends CommonPage {
return this.actions.page.isVisible(`text=/User operations/`)
}

async BlobIsOn(): Promise<boolean> {
return this.actions.page.isVisible(`text=/Blob txns/`)
}

async checkBlobTransactions(): Promise<void> {
await this.page.click(`text=/Blob txns/`)
const firstRow = `text=/Blob txn$/ >> ../../../.. >> nth=0`
await this.actions.verifyElementIsDisplayed(`${firstRow} >> text=/0x/`)
await this.actions.verifyElementIsDisplayed(`${firstRow} >> text=/.*ago/`)
await this.actions.verifyElementIsDisplayed(`${firstRow} >> text=/Success/`)
await this.actions.verifyElementIsDisplayed(`${firstRow} >> div >> nth=10 >> text=/\\d+/`)
await this.actions.verifyElementIsDisplayed(`${firstRow} >> div >> nth=13 >> text=/0x/`)
await this.actions.verifyElementIsDisplayed(`${firstRow} >> td >> nth=5 >> text=/0x/`)
await this.actions.verifyElementIsDisplayed(`${firstRow} >> td >> nth=6 >> text=/\\d+/`)
await this.actions.verifyElementIsDisplayed(`${firstRow} >> td >> nth=7 >> text=/\\d+/`)
}

async openFirstVerifiedContract(url: string): Promise<void> {
await this.open_custom(`${url}/verified-contracts`)
await this.page.click(`main >> table >> td >> nth=0 >> a`)
}

async checkContractReadTabs(): Promise<void> {
await this.page.getByRole(`tab`, { name: `Read contract` }).click()
await this.page.getByText(`DisconnectedConnect wallet`).isVisible()
await this.page.getByText(`Contract information`).isVisible()
await this.page.getByText(`Expand all`).click()
await this.page.getByText(`Collapse all`).click()
await this.page.getByText(`Reset`).click()
await this.actions.verifyElementIsDisplayed(`div[role='tabpanel'] >> section >> nth=1 >> text=/1..*/`)
}

async checkContractsWriteTabs(): Promise<void> {
await this.page.getByRole(`tab`, { name: `Write contract` }).click()
await this.page.getByText(`DisconnectedConnect wallet`).isVisible()
await this.page.getByText(`Expand all`).click()
await this.page.getByText(`Collapse all`).click()
await this.page.getByText(`Reset`).click()
await this.page.getByText(`Contract information`).isVisible()
await this.actions.verifyElementIsDisplayed(`div[role='tabpanel'] >> section >> nth=1 >> text=/1..*/`)
}

async checkContractsCodeTab(): Promise<void> {
await this.page.getByLabel(`Code`, { exact: true }).getByText(`Contract name`).isVisible()
await this.page.getByText(`EVM version`).isVisible()
await this.page.getByText(`Optimization runs`).isVisible()
await this.page.getByText(`Contract file path`).isVisible()
await this.page.getByText(`Compiler version`).isVisible()
await this.page.getByText(`Optimization enabled`).isVisible()
await this.page.getByText(`Verified at`).isVisible()
await this.page.getByText(`Contract source code`, { exact: true }).isVisible()
}

async checkContractUMLDiagram(): Promise<void> {
await this.page.getByRole(`link`, { name: `View UML diagram` }).click()
await this.page.getByText(`/For contract0x.*/`).isVisible()
await this.page.getByRole(`img`, { name: `/Contract.*/` }).isVisible()
}

async checkParticularBlob(url: string, addr: string): Promise<void> {
await this.open_custom(`${url}/tx/${addr}`)
await this.actions.clickElement(`text=/Blobs/`)
await this.page.getByRole(`link`, { name: `0x01a78ecbd6c01ab745dd85878ca57b67f3bb9629351e1c53bb18f0d3ac21484d` }).click()
await this.page.getByRole(`link`, { name: `0x671cc5e15f140d220c36b0abaf0f76afd108c23c83cc63bb8ded37de1ffffc5b` }).isVisible()
await this.page.getByText(`0x01a78ecbd6c01ab745dd85878ca57b67f3bb9629351e1c53bb18f0d3ac21484d`, { exact: true }).isVisible()
await this.page.getByText(`Sponsored`).isVisible()
await this.page.getByText(`Blob details`).isVisible()
await this.page.locator(`div`).filter({ hasText: /^Blob details$/ }).first().click()
}

async checkUserOpsHeader(): Promise<void> {
await this.actions.verifyElementIsDisplayed(`main >> th >> nth=0 >> text=/User op hash/`)
await this.actions.verifyElementIsDisplayed(`main >> th >> nth=1 >> text=/Age/`)
Expand Down Expand Up @@ -112,6 +184,11 @@ export class NewHomePage extends CommonPage {
await this.delay(5000)
}

async isENSEnabled(): Promise<boolean> {
await this.actions.page.hover(`text=/Blockchain/`)
return this.page.isVisible(`text=/Name services lookup/`)
}

async isGasTrackerOn(): Promise<boolean> {
return this.actions.page.isVisible(this.GAS_TRACKER_ON)
}
Expand Down Expand Up @@ -307,6 +384,13 @@ export class NewHomePage extends CommonPage {
await this.displayed_in_parent(`text=/Wallet addresses/`, `text=/\\d+.*/`, 2, `no wallet addresses`)
}

async checkHeaderL2(): Promise<void> {
await this.displayed_in_parent(`text=/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`)
}

async checkStatsCounters(): Promise<void> {
await this.displayed_in_parent(`text=/Average block time/`, `text=/\\d+.*s/`, 2, `no avg block time`)
await this.displayed_in_parent(`text=/Completed txns/`, `text=/\\d+.*/`, 2, `no completed txns`)
Expand Down
6 changes: 2 additions & 4 deletions tests/e2e/tests/functional/Smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ test(`@SmokeEthBaseSepolia Base Sepolia main page components`, async ({ newHomeP

test(`@SmokezkSync zkSync Era main page components`, async ({ newHomePage }) => {
await newHomePage.open_custom(`https://zksync-era-mainnet.blockscout.com/`)
await newHomePage.checkIndexing()
await newHomePage.checkHeader()
await newHomePage.checkBlocksWidget()
await newHomePage.checkHeaderL2()
})

test(`@SmokeEthStability zkSync Era main page components`, async ({ newHomePage }) => {
test(`@SmokeEthStability Eth Stability main page components`, async ({ newHomePage }) => {
await newHomePage.open_custom(`https://stability-betanet.blockscout.com/`)
await newHomePage.checkIndexing()
await newHomePage.checkHeader()
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/functional/SmokeENS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test(`@SmokeEthMainnet @ENS Eth main page components`, async ({ newHomePage }) =
await newHomePage.checkENSRow()
})

test(`@SmokeEthGoerli @ENS Eth Goerli ENS components`, async ({ newHomePage }) => {
test.skip(`@SmokeEthGoerli @ENS Eth Goerli ENS components`, async ({ newHomePage }) => {
await newHomePage.open_custom(`https://eth-goerli.blockscout.com/name-domains?only_active=true`)
await newHomePage.sortENSRows()
await newHomePage.checkENSHeader()
Expand Down
37 changes: 34 additions & 3 deletions tests/e2e/tests/functional/SmokeOnDemand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ test(`@OnDemandSmoke Check verified contracts`, async ({ newHomePage }) => {
})

test(`@OnDemandSmoke Check ENS`, async ({ newHomePage }) => {
await newHomePage.open_custom(`${url}/name-domains?only_active=true`)
await newHomePage.checkENSHeader()
await newHomePage.checkENSRow()
await newHomePage.open_custom(url)
if (await newHomePage.isENSEnabled()) {
await newHomePage.open_custom(`${url}/name-domains?only_active=true`)
await newHomePage.checkENSHeader()
await newHomePage.checkENSRow()
} else {
console.log(chalk.yellow(`ENS Services are OFF!`))
}
})

test(`@OnDemandSmoke Check gas tracker`, async ({ newHomePage }) => {
Expand Down Expand Up @@ -90,3 +95,29 @@ test(`@OnDemandSmoke Check user operations`, async ({ newHomePage }) => {
console.log(chalk.yellow(`User Operations are OFF!`))
}
})

test(`@OnDemandSmoke Check blobs`, async ({ newHomePage }) => {
await newHomePage.open_custom(`${url}/txs`)
if (await newHomePage.BlobIsOn()) {
await newHomePage.checkBlobTransactions()
await newHomePage.checkParticularBlob(url, `0x671cc5e15f140d220c36b0abaf0f76afd108c23c83cc63bb8ded37de1ffffc5b`)
} else {
console.log(chalk.yellow(`Blob txns is OFF!`))
}
})

test(`@OnDemandSmoke Check read contract tabs`, async ({ newHomePage }) => {
await newHomePage.openFirstVerifiedContract(url)
await newHomePage.checkContractReadTabs()
})

test(`@OnDemandSmoke Check write contract tabs`, async ({ newHomePage }) => {
await newHomePage.openFirstVerifiedContract(url)
await newHomePage.checkContractsWriteTabs()
})

test(`@OnDemandSmoke Check contracts code tabs`, async ({ newHomePage }) => {
await newHomePage.openFirstVerifiedContract(url)
await newHomePage.checkContractsCodeTab()
await newHomePage.checkContractUMLDiagram()
})
14 changes: 7 additions & 7 deletions tests/load/browser_vitals.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/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=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?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
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
Loading

0 comments on commit fd764be

Please sign in to comment.