Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ jobs:
- name: Use rapidez/core from source
run: composer config repositories.core path ../core

- name: Make the Magento version available as env variable
run: echo "MAGENTO_VERSION=${{ matrix.magento-version }}" >> $GITHUB_ENV

- name: Get commit hash and tag of the core
working-directory: ./rapidez/core
run: |
Expand Down
10 changes: 5 additions & 5 deletions tests/playwright/cart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { ProductPage } from './pages/ProductPage'
import { CartPage } from './pages/CartPage'
import { BasePage } from './pages/BasePage'

test('add product simple', async ({ page }) => {
test('add product simple', BasePage.tags, async ({ page }) => {
const product = await new ProductPage(page).addToCart(process.env.PRODUCT_URL_SIMPLE)
await new CartPage(page).firstItemIs(product)
await new BasePage(page).screenshot('fullpage-footer')
})

test('add product simple twice', async ({ page }) => {
test('add product simple twice', BasePage.tags, async ({ page }) => {
await new ProductPage(page).addToCart(process.env.PRODUCT_URL_SIMPLE, 2)
await new CartPage(page).firstItemQtyIs(2)
})

test('change quantity', async ({ page }) => {
test('change quantity', BasePage.tags, async ({ page }) => {
const product = await new ProductPage(page).addToCart(process.env.PRODUCT_URL_SIMPLE)
// TODO: Extract to CartPage?
await page.goto('/cart')
Expand All @@ -23,7 +23,7 @@ test('change quantity', async ({ page }) => {
await expect(page.getByTestId('cart-item')).toContainText((product.price * 5).toString())
})

test('remove product', async ({ page }) => {
test('remove product', BasePage.tags, async ({ page }) => {
const product = await new ProductPage(page).addToCart(process.env.PRODUCT_URL_SIMPLE)
// TODO: Extract to CartPage?
await page.goto('/cart')
Expand All @@ -32,7 +32,7 @@ test('remove product', async ({ page }) => {
await expect(page.getByTestId('cart-item')).toHaveCount(0)
})

test('wcag', async ({ page }, testInfo) => {
test('wcag', BasePage.tags, async ({ page }, testInfo) => {
const product = await new ProductPage(page).addToCart(process.env.PRODUCT_URL_SIMPLE)
await new CartPage(page).gotoCart()
await new BasePage(page).wcag(testInfo)
Expand Down
10 changes: 5 additions & 5 deletions tests/playwright/category.spec.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { test, expect } from '@playwright/test'
import { BasePage } from './pages/BasePage'

test('category with simple products', async ({ page }) => {
test('category with simple products', BasePage.tags, async ({ page }) => {
await page.goto(process.env.CATEGORY_URL_SIMPLE)
await new BasePage(page).screenshot('fullpage-footer-images')
})

test('category with configurable products', async ({ page }) => {
test('category with configurable products', BasePage.tags, async ({ page }) => {
await page.goto(process.env.CATEGORY_URL_CONFIGURABLE)
await new BasePage(page).screenshot('fullpage-footer-images')
})

test('category pagination', async ({ page }) => {
test('category pagination', BasePage.tags, async ({ page }) => {
await page.goto(process.env.CATEGORY_URL_SIMPLE)
await expect(page.getByTestId('listing-item')).toHaveCount(12)
const firstProductPage1 = await page.getByTestId('listing-item').first().textContent()
Expand All @@ -22,7 +22,7 @@ test('category pagination', async ({ page }) => {
await new BasePage(page).screenshot('fullpage-footer-images')
})

test('category filter', async ({ page }) => {
test('category filter', BasePage.tags, async ({ page }) => {
await page.goto(process.env.CATEGORY_URL_SIMPLE)
await expect(page.getByTestId('listing-item')).toHaveCount(12)

Expand All @@ -41,7 +41,7 @@ test('category filter', async ({ page }) => {
await new BasePage(page).screenshot('fullpage-footer-images')
})

test('wcag', async ({ page }, testInfo) => {
test('wcag', BasePage.tags, async ({ page }, testInfo) => {
await page.goto(process.env.CATEGORY_URL_SIMPLE)
await new BasePage(page).wcag(testInfo)
})
5 changes: 3 additions & 2 deletions tests/playwright/checkout.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { test, expect } from '@playwright/test'
import { BasePage } from './pages/BasePage'
import { ProductPage } from './pages/ProductPage'
import { CheckoutPage } from './pages/CheckoutPage'
import { AccountPage } from './pages/AccountPage'

const checkoutTypes = ['default', 'onestep']

checkoutTypes.forEach((type) => {
test(type + ' - as guest', async ({ page }) => {
test(type + ' - as guest', BasePage.tags, async ({ page }) => {
const productPage = new ProductPage(page)
const checkoutPage = new CheckoutPage(page, type)

Expand All @@ -19,7 +20,7 @@ checkoutTypes.forEach((type) => {
])
})

test(type + ' - as user', async ({ page }) => {
test(type + ' - as user', BasePage.tags, async ({ page }) => {
const productPage = new ProductPage(page)
const checkoutPage = new CheckoutPage(page, type)
const accountPage = new AccountPage(page)
Expand Down
4 changes: 2 additions & 2 deletions tests/playwright/general.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test'
import { BasePage } from './pages/BasePage'

test('cookie', async ({ page }) => {
test('cookie', BasePage.tags, async ({ page }) => {
const acceptCookiesButton = page.getByTestId('accept-cookies')

await page.goto('/?show-cookie-notice')
Expand All @@ -16,7 +16,7 @@ test('cookie', async ({ page }) => {
await expect(cookieNotice).not.toBeNull()
})

test('newsletter', async ({ page }) => {
test('newsletter', BasePage.tags, async ({ page }) => {
const email = `wayne+${Date.now()}@enterprises.com`

await page.goto('/')
Expand Down
6 changes: 3 additions & 3 deletions tests/playwright/homepage.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { test, expect } from '@playwright/test'
import { BasePage } from './pages/BasePage'

test('homepage', async ({ page }) => {
test('homepage', BasePage.tags, async ({ page }, testInfo) => {
await page.goto('/')
await new BasePage(page).screenshot('fullpage-footer')
})

test('wcag', async ({ page }, testInfo) => {
test('wcag', BasePage.tags, async ({ page }, testInfo) => {
await page.goto('/')
await new BasePage(page).wcag(testInfo, 'page-has-heading-one')
})

test('lighthouse', async ({ page }) => {
test('lighthouse', BasePage.tags, async ({ page }) => {
await new BasePage(page).lighthouse('/')
})
2 changes: 2 additions & 0 deletions tests/playwright/pages/BasePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import playwright from 'playwright'
import lighthouseMobileConfig from 'lighthouse/core/config/lr-mobile-config.js'

export class BasePage {
static tags = { tag: process.env.MAGENTO_VERSION ? '@' + process.env.MAGENTO_VERSION : null }

constructor(page) {
this.page = page
}
Expand Down
10 changes: 5 additions & 5 deletions tests/playwright/product.spec.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { test, expect } from '@playwright/test'
import { BasePage } from './pages/BasePage'

test('product simple', async ({ page }) => {
test('product simple', BasePage.tags, async ({ page }) => {
await page.goto(process.env.PRODUCT_URL_SIMPLE)
await new BasePage(page).screenshot('fullpage-footer')
})

test('product configurable', async ({ page }) => {
test('product configurable', BasePage.tags, async ({ page }) => {
await page.goto(process.env.PRODUCT_URL_CONFIGURABLE)
await new BasePage(page).screenshot('fullpage-footer')
})

test('product grouped', async ({ page }) => {
test('product grouped', BasePage.tags, async ({ page }) => {
await page.goto(process.env.PRODUCT_URL_GROUPED)
await new BasePage(page).screenshot('fullpage-footer')
})

test('wcag', async ({ page }, testInfo) => {
test('wcag', BasePage.tags, async ({ page }, testInfo) => {
await page.goto(process.env.PRODUCT_URL_SIMPLE)
await new BasePage(page).wcag(testInfo)
})

test('lighthouse', async ({ page }) => {
test('lighthouse', BasePage.tags, async ({ page }) => {
await new BasePage(page).lighthouse(process.env.PRODUCT_URL_SIMPLE)
})
4 changes: 2 additions & 2 deletions tests/playwright/search.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { test, expect } from '@playwright/test'
import { ProductPage } from './pages/ProductPage'
import { BasePage } from './pages/BasePage'

test('search page', async ({ page }) => {
test('search page', BasePage.tags, async ({ page }) => {
const product = await new ProductPage(page).goto(process.env.PRODUCT_URL_SIMPLE)
await page.goto('/search?q=' + product.name)
await page.waitForLoadState('networkidle')
await expect(page.getByTestId('listing-item').first()).toContainText(product.name)
await new BasePage(page).screenshot()
})

test('autocomplete', async ({ page }) => {
test('autocomplete', BasePage.tags, async ({ page }) => {
const product = await new ProductPage(page).goto(process.env.PRODUCT_URL_SIMPLE)
await page.goto('/')
await page.getByTestId('autocomplete-input').click()
Expand Down