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

New Playwright tests and modifications #7267

Merged
merged 55 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
961f617
data-test id footer
prury Sep 13, 2023
cfc67e1
data-test id create collection
prury Sep 13, 2023
666832e
data-test id search
prury Sep 13, 2023
e2ff510
data-test id search searchsuggestion
prury Sep 13, 2023
8925da5
fixture relocation
prury Sep 13, 2023
de69f56
new tests and some tweaks
prury Sep 13, 2023
d3ecdcd
code organization
prury Sep 14, 2023
ead2649
data test id name change
prury Sep 14, 2023
eb445f8
create collection separation and improvement
prury Sep 14, 2023
7aba957
footer test separation
prury Sep 14, 2023
134d52b
danger class modification
prury Sep 14, 2023
4299176
better redirect syntax
prury Sep 15, 2023
b108a87
small modifications
prury Sep 15, 2023
3c00f61
opengraph test conversion
prury Sep 15, 2023
36e6294
adding global timeout
prury Sep 15, 2023
eabc874
testing 4 workers
prury Sep 15, 2023
7265bb6
lots of improvements
prury Sep 15, 2023
040e8d7
2 workers
prury Sep 15, 2023
4b55075
back to no workers
prury Sep 16, 2023
a20584b
action time 15m
prury Sep 16, 2023
06a8ece
deactivating footer test
prury Sep 16, 2023
7d2559c
reduced global timeout
prury Sep 16, 2023
7748a72
removed search wait for network response
prury Sep 16, 2023
3fbfcce
code smells
prury Sep 18, 2023
6c77011
Merge branch 'kodadot:main' into converting-tests
prury Sep 18, 2023
76abf6f
remove double building
prury Sep 18, 2023
3596fd0
needs build first
prury Sep 18, 2023
512bb0d
install pnpm
prury Sep 18, 2023
4db8a75
fixing command
prury Sep 18, 2023
21f12ef
proper command npm
prury Sep 18, 2023
1b6c0db
trying npx
prury Sep 18, 2023
31ed0ac
removing work directory
prury Sep 18, 2023
ce22e19
working directory for tests
prury Sep 18, 2023
ca7a022
path again
prury Sep 18, 2023
b8131f0
action checkout
prury Sep 18, 2023
43b9a63
changing back to pnpm commands
prury Sep 18, 2023
48633a5
dependencies
prury Sep 18, 2023
9d63fca
Revert "dependencies"
prury Sep 18, 2023
3914ec9
Revert "changing back to pnpm commands"
prury Sep 18, 2023
1d029f0
Revert "action checkout"
prury Sep 18, 2023
28609e4
Revert "path again"
prury Sep 18, 2023
d70fbc2
Revert "working directory for tests"
prury Sep 18, 2023
9f0f4e7
Revert "removing work directory"
prury Sep 18, 2023
f6ddb57
Revert "trying npx"
prury Sep 18, 2023
b7923bd
Revert "proper command npm"
prury Sep 18, 2023
47b8e99
Revert "fixing command"
prury Sep 18, 2023
ac72f6d
Revert "install pnpm"
prury Sep 18, 2023
371fabf
Revert "needs build first"
prury Sep 18, 2023
c74031e
Revert "remove double building"
prury Sep 18, 2023
ac8a254
Merge branch 'kodadot:main' into converting-tests
prury Sep 18, 2023
0db702f
create collection changes
prury Sep 18, 2023
8d4a877
collection test simplification
prury Sep 18, 2023
d99d5b0
removing variable chains
prury Sep 18, 2023
8d129d7
Merge branch 'kodadot:main' into converting-tests
prury Sep 20, 2023
ee485d5
Merge branch 'kodadot:main' into converting-tests
prury Sep 21, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 10
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions components/TheFooter.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<footer class="footer-container section">
<footer class="footer-container section" data-testid="footer-container">
<div
class="footer-container-inner is-flex is-align-items-start is-justify-content-space-between">
<section class="footer-container-subs is-flex is-flex-direction-column">
<h2 class="subtitle is-5">
{{ $t('footer.subscribe') }}
</h2>
<div class="is-flex is-align-items-center footer-container-subs-items">
<div id="custom-substack-embed"></div>
<div id="custom-substack-embed" data-testid="footer-subscribe"></div>

<script>
window.CustomSubstackWidget = {
Expand Down
20 changes: 16 additions & 4 deletions components/create/CreateCollection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<NeoField
:label="`${$t('mint.collection.name.label')} *`"
required
data-testid="collection-name"
:error="!name">
prury marked this conversation as resolved.
Show resolved Hide resolved
<NeoInput v-model="name" required />
</NeoField>
Expand All @@ -38,13 +39,15 @@
type="textarea"
has-counter
maxlength="1000"
height="10rem" />
height="10rem"
data-testid="collection-desc" />
</NeoField>

<!-- collection max nfts -->
<NeoField
v-if="!isBasilisk"
:label="$t('Maximum NFTs in collection')"
data-testid="collection-maxAmount"
required>
<div class="w-full">
<div class="is-flex is-justify-content-space-between">
Expand All @@ -65,7 +68,11 @@
<NeoField :label="`${$t('mint.blockchain.label')} *`">
<div>
<p>{{ $t('mint.blockchain.message') }}</p>
<NeoSelect v-model="selectBlockchain" class="mt-3" expanded>
<NeoSelect
v-model="selectBlockchain"
class="mt-3"
data-testid="collection-chain"
expanded>
<option v-for="menu in menus" :key="menu.value" :value="menu.value">
{{ menu.text }}
</option>
Expand Down Expand Up @@ -96,11 +103,15 @@
<div class="monospace">
<p class="has-text-weight-medium is-size-6 has-text-info">
<span>{{ $t('mint.deposit') }}:</span>
<span>{{ totalCollectionDeposit }} {{ chainSymbol }}</span>
<span data-testid="collection-deposit"
>{{ totalCollectionDeposit }} {{ chainSymbol }}</span
>
</p>
<p>
<span>{{ $t('general.balance') }}: </span>
<span>{{ balance }} {{ chainSymbol }}</span>
<span data-testid="collection-balance"
>{{ balance }} {{ chainSymbol }}</span
>
</p>
<nuxt-link v-if="isBasilisk" :to="`/${currentChain}/assets`">
{{ $t('general.tx.feesPaidIn', [chainSymbol]) }}
Expand All @@ -119,6 +130,7 @@
:label="`${canDeposit ? 'Create Collection' : 'Not Enough Funds'}`"
type="submit"
size="medium"
data-testid="collection-create"
:loading="isLoading"
:disabled="!canDeposit" />

Expand Down
1 change: 1 addition & 0 deletions components/search/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
ref="searchRef"
v-model="name"
:query="query"
data-testid="search-bar"
@redirect="redirectToGalleryPageIfNeed"
@enter="nativeSearch"
@blur="onBlur" />
Expand Down
4 changes: 3 additions & 1 deletion components/search/SearchSuggestion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<NeoTabItem
label="Collections"
value="Collections"
data-testid="collection-tab"
item-header-class="has-text-left is-block mb-0 pb-4 px-0 pt-0">
<div v-if="isCollectionResultLoading">
<SearchResultItem
Expand Down Expand Up @@ -97,7 +98,8 @@
<NeoTabItem
label="NFTs"
value="NFTs"
item-header-class="has-text-left is-block mb-0 pb-4 px-0 pt-0">
item-header-class="has-text-left is-block mb-0 pb-4 px-0 pt-0"
data-testid="nft-tab">
<div v-if="isNFTResultLoading">
<SearchResultItem
v-for="item in searchSuggestionEachTypeMaxNum"
Expand Down
1 change: 1 addition & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default defineConfig({
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
timeout: 1 * 60 * 1000,
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:9090',
Expand Down
63 changes: 63 additions & 0 deletions tests/e2e/createcollection.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { expect, test } from '@playwright/test'

test('Fill fields to check if they work', async ({ page }) => {
await page.goto('/create/collection')
//upload image logo
await page.setInputFiles('input[type="file"]', 'tests/e2e/unsplash-image.jpg')
//checks if Collection Name Title Exists
await expect(
page
.getByTestId('collection-name')
.filter({ has: page.getByText('Collection Name') })
).toHaveCount(1)
await page
.getByTestId('collection-name')
.locator('input')
.fill('Best Collection Name')
// Fill collection Description
await page.getByTestId('collection-desc').fill('Best Collection Ever Created')
//active unlimited items switch
const collectionAmount = page.getByTestId('collection-maxAmount')
await collectionAmount.locator('.o-switch').click()
await expect(
collectionAmount.getByPlaceholder('1 is the minimum')
).toBeVisible()
//Check if button exists
await expect(page.getByTestId('collection-create')).toBeVisible()
await expect(
page
.getByTestId('collection-create')
.filter({ has: page.getByText('Not Enough Funds') })
).toHaveCount(1)
})

test('Check if chain change works using the dropdown', async ({ page }) => {
//E2E connection
await page.goto('/e2e-login')
await page.waitForTimeout(10000)
await expect(page.getByTestId('mockAddress')).toHaveText('true')
await page.goto('/create/collection')
expect(page.getByTestId('collection-chain')).toBeVisible()
await page.getByTestId('collection-chain').selectOption('KusamaHub [Beta]')
//Check if balances and deposits shows
await expect(page.getByTestId('collection-deposit')).toBeVisible({
timeout: 30000,
})
await expect(page.getByTestId('collection-balance')).toBeVisible({
timeout: 30000,
})
await page.getByTestId('collection-chain').selectOption('RMRK2')
})

test('Show warning message on field when collection name empty', async ({
page,
}) => {
await page.goto('/create/collection')
// defines a variable containing the collection name data-testid
const collectionName = page.getByTestId('collection-name')
// Fill and check if Collection Name works properly by checking warning
await collectionName.locator('input').fill('Kodadot Warning Test')
await collectionName.locator('input').fill('')
await page.getByTestId('collection-desc').click()
await expect(collectionName.locator('.o-field__message-danger')).toBeVisible()
})
120 changes: 120 additions & 0 deletions tests/e2e/footer.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { expect, test } from '@playwright/test'

const footerLinks = [
{
linkName: 'Ambassador Program',
linkAddress:
'https://hello.kodadot.xyz/be-part-of-kodadot/kodadots-programs/ambassador-program',
},
{
linkName: 'Artist Ambassador',
linkAddress:
'https://hello.kodadot.xyz/be-part-of-kodadot/kodadots-programs/artist-ambassador-program',
},
{
linkName: 'Referral Program',
linkAddress:
'https://hello.kodadot.xyz/be-part-of-kodadot/kodadots-programs/artist-referral-program',
},
{
linkName: 'Developers',
linkAddress: 'https://developers.kodadot.xyz/',
},
{
linkName: 'FAQ',
linkAddress: 'https://hello.kodadot.xyz/ecosystem/faq',
},
{
linkName: 'Tutorial',
linkAddress: 'https://hello.kodadot.xyz/tutorial/wallet',
},
{
linkName: 'About',
linkAddress: 'https://hello.kodadot.xyz/about-us/who-are-we',
},
{
linkName: 'Careers',
linkAddress:
'https://hello.kodadot.xyz/be-part-of-kodadot/join-as-a-developer/hiring',
},
{
linkName: 'Press Kit',
linkAddress: 'https://github.com/kodadot/kodadot-presskit/tree/main/pre-v4',
},
{
linkName: 'MerchShop',
linkAddress: 'https://shop.kodadot.xyz/',
},
]

const footerSocialMediaLinks = [
{
linkName: 'Twitter',
linkAddress: 'https://twitter.com/KodaDot',
},
{
linkName: 'Discord',
linkAddress: 'https://discord.com/invite/u6ymnbz4PR',
},
{
linkName: 'Substack',
linkAddress: 'https://kodadot.substack.com',
},
//{
// linkName: 'Medium',
// linkAddress: 'https://medium.com/kodadot',
//},
{
linkName: 'Youtube',
linkAddress: 'https://www.youtube.com/channel/UCEULduld5NrqOL49k1KVjoA',
},
//{
// linkName: 'Instagram',
// linkAddress: 'https://instagram.com/kodadot.xyz',
// },
{
linkName: 'Reddit',
linkAddress: 'https://www.reddit.com/r/KodaDot/',
},
]

test('Check Footer Subscription', async ({ page }) => {
await page.goto('/')
const footerSubscribe = page.getByTestId('footer-subscribe')
await page.getByPlaceholder('jane.doe@kodadot.xyz').fill('a')
await footerSubscribe.locator('button').click()
await expect(footerSubscribe.locator('.error')).toBeVisible()
})

test('Check Footer links', async ({ page }) => {
await page.goto('/')
for (const data of footerLinks) {
prury marked this conversation as resolved.
Show resolved Hide resolved
const footer = page.getByTestId('footer-container')
const newTabPromise = page.waitForEvent('popup')
await footer.getByRole('link', { name: data.linkName }).click()
const newTab = await newTabPromise
await newTab.waitForLoadState()
await expect(newTab).toHaveURL(data.linkAddress)
await newTab.close()
}
})

test('Check blog link', async ({ page }) => {
await page.goto('/')
const footer = page.getByTestId('footer-container')
await footer.getByRole('link', { name: 'Blog' }).click()
await expect(page).toHaveURL('http://localhost:9090/blog')
})

test('Check Social Media Links', async ({ page }) => {
await page.goto('/')
for (const data of footerSocialMediaLinks) {
const socialMedia = page.locator('.footer-container-socials-list')
const newTabPromise = page.waitForEvent('popup')
await socialMedia.locator(`[aria-label="${data.linkName}"]`).click()
const newTab = await newTabPromise
await newTab.waitForLoadState()
await expect(newTab).toHaveURL(data.linkAddress)
await newTab.close()
}
})
11 changes: 2 additions & 9 deletions tests/e2e/language.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import { expect, test } from '@playwright/test'

test('Check Language translations', async ({ page }) => {
await page.goto('/e2e-login')
await page.waitForTimeout(5000)
await page.waitForTimeout(10000)
await expect(page.getByTestId('mockAddress')).toHaveText('true')
await page.goto('/')
await page.goto('')
//DE
await page.getByTestId('profileDropdown').click()
await page.getByTestId('sidebar-language').click()
await expect(page.getByRole('menu')).toBeVisible()
//await expect(page.getByTestId('skeleton-multiple-balances')).toHaveCount(0)
await page.getByTestId('sidebar-language-de').click()
await page.getByTestId('profileDropdown').click()
await expect(
page.getByTestId('create').filter({ has: page.getByText('Erstellen') })
).toHaveCount(1)
Expand All @@ -21,11 +20,8 @@ test('Check Language translations', async ({ page }) => {
.filter({ has: page.getByText('Letzte Verkäufe') })
).toHaveCount(1)
//FR
await page.getByTestId('profileDropdown').click()
await page.getByTestId('sidebar-language').click()
await expect(page.getByRole('menu')).toBeVisible()
await page.getByTestId('sidebar-language-fr').click()
await page.getByTestId('profileDropdown').click()
await expect(
page.getByTestId('create').filter({ has: page.getByText('Créer') })
).toHaveCount(1)
Expand All @@ -35,11 +31,8 @@ test('Check Language translations', async ({ page }) => {
.filter({ has: page.getByText('Dernières ventes') })
).toHaveCount(1)
//ES
await page.getByTestId('profileDropdown').click()
await page.getByTestId('sidebar-language').click()
await expect(page.getByRole('menu')).toBeVisible()
await page.getByTestId('sidebar-language-es').click()
await page.getByTestId('profileDropdown').click()
await expect(
page.getByTestId('create').filter({ has: page.getByText('Crear') })
).toHaveCount(1)
Expand Down
Loading