Skip to content

Commit

Permalink
admin tests for new entities
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtzData committed Mar 17, 2024
1 parent 685c02b commit 932346e
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 24 deletions.
42 changes: 37 additions & 5 deletions tests/e2e/pages/Admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class AdminPage extends CommonPage {
if (noRecords) {
return
}
await this.selectFirstSubmission()
await this.selectFirstListElement()
await this.deleteTokenInfo()
}

Expand All @@ -140,21 +140,53 @@ export class AdminPage extends CommonPage {
await this.actions.clickElement(`text=Apply changes`)
}

async filterByAddress(addr: string): Promise<void> {
await this.actions.clickElement(`text=Filter`)
await this.actions.enterElementText(`input[name="filter-address"]`, addr)
await this.actions.clickElement(`text=Apply changes`)
}

async filterByInputRef(inputName: string, filter: string): Promise<void> {
await this.actions.clickElement(`text=Filter`)
await this.actions.enterElementText(`input[name="${inputName}"]`, filter)
await this.actions.clickElement(`text=Apply changes`)
}

async filterBySlug(addr: string): Promise<void> {
await this.actions.clickElement(`text=Filter`)
await this.actions.enterElementText(`input[name="filter-address"]`, addr)
await this.actions.clickElement(`text=Apply changes`)
}

async filterByEmailProjectName(projectName: string): Promise<void> {
await this.actions.clickElement(`text=Filter`)
await this.actions.enterElementText(`input[name="filter-project_name"]`, projectName)
await this.actions.clickElement(`text=Apply changes`)
}

async filterByEmailStatus(email: string, status: string): Promise<void> {
await this.actions.clickElement(`text=Filter`)
await this.actions.enterElementText(`input[name="filter-blockscout_user_email"]`, email)
await this.actions.clickElement(`input[id="react-select-5-input"]`)
await this.actions.clickElement(`form >> text=/${status}/ >> nth=1`)
await this.actions.clickElement(`text=Apply changes`)
}

async filterByTokenAddress(email: string): Promise<void> {
await this.actions.clickElement(`text=Filter`)
await this.actions.enterElementText(`input[name="filter-address"]`, email)
await this.actions.clickElement(`text=Apply changes`)
}

async selectFirstSubmission(): Promise<void> {
async selectFirstListElement(): Promise<void> {
await this.actions.clickElement(`tr >> nth=1 >> td >> nth=1`)
}

async selectLastSubmissionSorted(): Promise<void> {
await this.actions.clickElement(`text=/Id/ >> nth=0`)
await this.actions.clickElement(`text=/Id/ >> nth=0`)
await this.delay(3000)
await this.selectFirstSubmission()
await this.selectFirstListElement()
}

async deleteTokenInfo(): Promise<void> {
Expand All @@ -175,7 +207,7 @@ export class AdminPage extends CommonPage {
await this.actions.clickElement(`text=Create new`)
await this.actions.enterElementText(`input >> nth=0`, sub.TokenAddress)
await this.actions.clickElement(`input >> nth=1`)
await this.actions.clickElement(`text=${sub.ChainID}`)
await this.actions.clickElement(`body >> section >> nth=5 >> text=${sub.ChainID} >> nth=1`)
await this.actions.enterElementText(`input >> nth=2`, sub.ProjectName)
await this.actions.enterElementText(`input >> nth=3`, sub.ProjectWebSite)
await this.actions.enterElementText(`input >> nth=4`, sub.ProjectEmail)
Expand Down Expand Up @@ -204,7 +236,7 @@ export class AdminPage extends CommonPage {
async createNewAdminSubmission(sub: SuperSubmission): Promise<void> {
await this.actions.clickElement(`text=Create new`)
await this.actions.clickElement(`input >> nth=0`)
await this.actions.clickElement(`text=${sub.ChainID}`)
await this.actions.clickElement(`body >> section >> nth=5 >> text=${sub.ChainID} >> nth=1`)
await this.actions.enterElementText(`input >> nth=1`, sub.TokenAddress)
await this.actions.enterElementText(`input >> nth=2`, sub.BlockscoutUserEmail)
await this.actions.enterElementText(`input >> nth=3`, sub.RequesterName)
Expand Down
73 changes: 54 additions & 19 deletions tests/e2e/tests/functional/Admin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ import test from '@lib/BaseTest'

test.describe.configure({ mode: `parallel` })

test.skip(`@Admin Delete/Create SuperSubmission`, async ({ tokenPage, newHomeGoerli, adminPage }) => {
adminPage.setBaseURL(`https://admin.services.blockscout.com`)
const envURL = `https://admin-ts-test.k8s-dev.blockscout.com`

test.beforeEach(async ({ adminPage }) => {
adminPage.setBaseURL(envURL)
await adminPage.open()
await adminPage.login(process.env.ACCOUNT_USERNAME, process.env.ACCOUNT_PASSWORD)
});

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / E2E tests

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (mainnet)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (gnosis)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (etc)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (neon)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (gnosis_chiado)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (base)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (fuse)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (etc_mordor)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (athens_3)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Admin console tests

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (base)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / E2E comparison tests

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (base_sepolia)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (fuse_testnet)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (mainnet)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (goerli)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (astar)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (optimism_goerli)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (immutable)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (phoenix)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (pegasus)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shibarium_testnet)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (rootstock)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (neon_devnet)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shibarium_mainnet)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shimmer_mainnet)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (zk_sync)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shimmer)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (optimism)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shiden)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (sepolia)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (stability)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Tests

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shibuya)

Extra semicolon

Check failure on line 13 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / tests / Tests

Extra semicolon

test(`@Admin Delete/Create SuperSubmission`, async ({ tokenPage, newHomeGoerli, adminPage }) => {
await adminPage.selectSuperUserTab()
await adminPage.selectSuperUserTabSubmissions()
await adminPage.clearMySubmissions(process.env.ACCOUNT_USERNAME)
Expand All @@ -21,7 +26,7 @@ test.skip(`@Admin Delete/Create SuperSubmission`, async ({ tokenPage, newHomeGoe
BlockscoutUserEmail: process.env.ACCOUNT_USERNAME,
RequesterName: `test_submission_user`,
RequesterEmail: process.env.ACCOUNT_USERNAME,
ProjectName: `test_project`,
ProjectName: uniqueSupportURL,
ProjectWebSite: `https://ya.ru`,
IconURL: iconURL,
ProjectDescription: `desc`,
Expand All @@ -44,25 +49,22 @@ test.skip(`@Admin Delete/Create SuperSubmission`, async ({ tokenPage, newHomeGoe
CGTickerURL: iconURL,
LlamaTickerURL: iconURL,
})
await adminPage.filterByEmail(process.env.ACCOUNT_USERNAME)
await adminPage.selectFirstSubmission()
await adminPage.filterByEmailProjectName(uniqueSupportURL)
await adminPage.selectFirstListElement()
await adminPage.openSubmissions()
await adminPage.selectTokenServicesTab()
await adminPage.selectTODOSubmissions()
await adminPage.filterByEmail(process.env.ACCOUNT_USERNAME)
await adminPage.selectLastSubmissionSorted()
await adminPage.filterByEmailProjectName(uniqueSupportURL)
await adminPage.selectFirstListElement()
await adminPage.approve()
await adminPage.delay(10000)
// await adminPage.delay(10000)

await newHomeGoerli.openAddress(tokenAddr)
await tokenPage.selectProjectInfo()
await tokenPage.actions.verifyElementIsDisplayed(`text=${uniqueSupportURL}`)
// await newHomeGoerli.openAddress(tokenAddr)
// await tokenPage.selectProjectInfo()
// await tokenPage.actions.verifyElementIsDisplayed(`text=${uniqueSupportURL}`)
})

test.skip(`@Admin Delete/Create TokenInfo`, async ({ newHomeGoerli, tokenPage, adminPage }) => {
adminPage.setBaseURL(`https://admin.services.blockscout.com`)
await adminPage.open()
await adminPage.login(process.env.ACCOUNT_USERNAME, process.env.ACCOUNT_PASSWORD)
test(`@Admin Delete/Create TokenInfo`, async ({ newHomeGoerli, tokenPage, adminPage }) => {
await adminPage.selectTokenServicesTab()
await adminPage.selectTokenInfosTab()
const iconURL = `https://cdn-icons-png.flaticon.com/128/2989/2989898.png`
Expand Down Expand Up @@ -102,8 +104,41 @@ test.skip(`@Admin Delete/Create TokenInfo`, async ({ newHomeGoerli, tokenPage, a
LlamaTickerURL: iconURL,
})

await newHomeGoerli.openAddress(tokenAddr)
await newHomeGoerli.delay(3000)
await tokenPage.selectProjectInfo()
await tokenPage.actions.verifyElementIsDisplayed(`text=${uniqueSupportURL}`)
// await newHomeGoerli.openAddress(tokenAddr)
// await newHomeGoerli.delay(3000)
// await tokenPage.selectProjectInfo()
// await tokenPage.actions.verifyElementIsDisplayed(`text=${uniqueSupportURL}`)
})

test(`@Admin Delete/Create Address`, async ({ newHomeGoerli, tokenPage, adminPage }) => {
const addr = `0x54FA517F05e11Ffa87f4b22AE87d91Cec0C2D7E1`
await adminPage.actions.clickElement(`section >> nth=1 >> text=/Metadata/`)
await adminPage.actions.clickElement(`section >> nth=1 >> text=/Addresses/`)
await adminPage.actions.clickElement(`section >> nth=5 >> text=/Create new/`)
await adminPage.actions.enterElementText(`input >> nth=0`, addr)
await adminPage.actions.clickElement(`section >> nth=5 >> text=/Save/`)

await adminPage.filterByAddress(addr)
await adminPage.selectFirstListElement()
await adminPage.actions.clickElement(`section >> nth=5 >> text=/Delete/`)
await adminPage.actions.clickElement(`button[label="Confirm"]`)
})

test(`@Admin Delete/Create Public tag`, async ({ newHomeGoerli, tokenPage, adminPage }) => {
const publicTag = `PlaywrightTestTag`
const slug = faker.random.alphaNumeric(8)
await adminPage.actions.clickElement(`section >> nth=1 >> text=/Metadata/`)
await adminPage.actions.clickElement(`section >> nth=1 >> text=/^Public Tags/`)
await adminPage.actions.clickElement(`section >> nth=5 >> text=/Create new/`)
await adminPage.actions.enterElementText(`input[name="name"]`, publicTag)
await adminPage.actions.enterElementText(`input[name="slug"]`, slug)
await adminPage.actions.enterElementText(`input[name="ordinal"]`, `0`)
await adminPage.actions.clickElement(`input[id="react-select-4-input"]`)
await adminPage.actions.clickElement(`section >> nth=5 >> text=/classifier/ >> nth=1`)
await adminPage.actions.clickElement(`section >> nth=5 >> text=/Save/`)

await adminPage.filterByInputRef(`filter-slug`, slug)
await adminPage.selectFirstListElement()
await adminPage.actions.clickElement(`section >> nth=5 >> text=/Delete/`)
await adminPage.actions.clickElement(`button[label="Confirm"]`)
})

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / E2E tests

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (mainnet)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (gnosis)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (etc)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (neon)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (gnosis_chiado)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (base)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (fuse)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (etc_mordor)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (athens_3)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Admin console tests

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (base)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / E2E comparison tests

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (base_sepolia)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (fuse_testnet)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (mainnet)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (goerli)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (astar)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (optimism_goerli)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (immutable)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (phoenix)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (pegasus)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shibarium_testnet)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (rootstock)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (neon_devnet)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shibarium_mainnet)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shimmer_mainnet)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (zk_sync)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shimmer)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (optimism)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shiden)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (sepolia)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (stability)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Tests

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / Smoke tests (shibuya)

Newline required at end of file but not found

Check failure on line 144 in tests/e2e/tests/functional/Admin.test.ts

View workflow job for this annotation

GitHub Actions / tests / Tests

Newline required at end of file but not found

0 comments on commit 932346e

Please sign in to comment.