Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/Opengraph #8241

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions tests/e2e/opengraph-collection.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { expect, test } from './fixtures'

//checks collection metadata

const collectionMetadata = [
{
metaLocator: '[name="name"]',
attr: 'content',
content: 'KodaDot NFT Marketplace',
},
{
metaLocator: '[name="description"]',
attr: 'content',
content: 'Amazing collection of generative AI waifus ❤️ ',
},
{
metaLocator: '[property="og:url"]',
attr: 'content',
content: '/ahk/collection/165',
},
{
metaLocator: '[property="og:title"]',
attr: 'content',
content: 'Berlin (Generative) Waifus',
},
{
metaLocator: '[property="og:description"]',
attr: 'content',
content: 'Amazing collection of generative AI waifus ❤️ ',
},
{
metaLocator: '[property="og:image"]',
attr: 'content',
content:
'https://og-image-green-seven.vercel.app/Berlin%20(Generative)%20Waifus.jpeg?price=Items%3A12&image=https%3A%2F%2Fimage-beta.w.kodadot.xyz%2Fipfs%2Fbafybeicaq3tyi5z3uj2oqkern656y2cqnvbu6yjmzo5b23vnilndh7kezq',
},
{
metaLocator: '[property="twitter:site"]',
attr: 'content',
content: '@KodaDot',
},
{
metaLocator: '[property="twitter:title"]',
attr: 'content',
content: 'KodaDot - NFT Market Explorer',
},
{
metaLocator: '[property="twitter:description"]',
attr: 'content',
content: 'One Stop NFT Shop on Polkadot',
},
]

test('Collection Opengraph', async ({ page }) => {
await page.goto('/ahk/collection/165')
for (const data of collectionMetadata) {
await expect(page.locator(`meta${data.metaLocator}`)).toHaveAttribute(
data.attr,
data.content,
)
await expect(page.locator(`meta${data.metaLocator}`)).toHaveCount(1)
}
})
70 changes: 70 additions & 0 deletions tests/e2e/opengraph-item.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { expect, test } from './fixtures'

const itemMetadata = [
{
metaLocator: '[name="name"]',
attr: 'content',
content: 'KodaDot NFT Marketplace',
},
{
metaLocator: '[name="description"]',
attr: 'content',
content: 'Konnichiwa!',
},
{
metaLocator: '[property="og:url"]',
attr: 'content',
content: 'http://localhost:9090',
},
{
metaLocator: '[property="og:title"]',
attr: 'content',
content: 'Berlin summer waifu #2',
},
{
metaLocator: '[property="og:description"]',
attr: 'content',
content: 'Konnichiwa!',
},
{
metaLocator: '[property="og:image"]',
attr: 'content',
content:
'2Fipfs%2Fbafybeifjk7i2o4xycsbg2dhiciwp4idqzarhschiuimznyrj6cb77a2pry',
},
{
metaLocator: '[property="twitter:site"]',
attr: 'content',
content: '@KodaDot',
},
{
metaLocator: '[property="twitter:title"]',
attr: 'content',
content: 'KodaDot - NFT Market Explorer',
},
{
metaLocator: '[property="twitter:description"]',
attr: 'content',
content: 'One Stop NFT Shop on Polkadot',
},
{
metaLocator: '[property="twitter:image"]',
attr: 'content',
content: 'http://localhost:9090/k_card.png',
},
]

test('Item Opengraph', async ({ page }) => {
await page.goto('/ahk/gallery/165-2')
for (const data of itemMetadata) {
await expect(page.locator(`meta${data.metaLocator}`)).toHaveAttribute(
data.attr,
new RegExp(data.content),
)
await expect(page.locator(`meta${data.metaLocator}`)).toHaveCount(1)
}
await expect(page.getByTestId('metadata-link')).toHaveAttribute(
'href',
'https://image-beta.w.kodadot.xyz/ipfs/bafkreicpxyw67alyt53ql4sq5mo5vj23633igsxxyqowbui2qg4322e4wi',
)
})
107 changes: 0 additions & 107 deletions tests/e2e/opengraph.ts

This file was deleted.