Skip to content

Commit 0a65ea3

Browse files
committed
Playwright Magento version tag
1 parent d6d73f9 commit 0a65ea3

File tree

9 files changed

+30
-24
lines changed

9 files changed

+30
-24
lines changed

.github/workflows/playwright.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ jobs:
9595
- name: Use rapidez/core from source
9696
run: composer config repositories.core path ../core
9797

98+
- name: Make the Magento version available as env variable
99+
run: echo "MAGENTO_VERSION=${{ matrix.magento-version }}" >> $GITHUB_ENV
100+
98101
- name: Get commit hash and tag of the core
99102
working-directory: ./rapidez/core
100103
run: |

tests/playwright/cart.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { ProductPage } from './pages/ProductPage'
33
import { CartPage } from './pages/CartPage'
44
import { BasePage } from './pages/BasePage'
55

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

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

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

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

35-
test('wcag', async ({ page }, testInfo) => {
35+
test('wcag', BasePage.tags, async ({ page }, testInfo) => {
3636
const product = await new ProductPage(page).addToCart(process.env.PRODUCT_URL_SIMPLE)
3737
await new CartPage(page).gotoCart()
3838
await new BasePage(page).wcag(testInfo)

tests/playwright/category.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { test, expect } from '@playwright/test'
22
import { BasePage } from './pages/BasePage'
33

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

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

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

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

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

44-
test('wcag', async ({ page }, testInfo) => {
44+
test('wcag', BasePage.tags, async ({ page }, testInfo) => {
4545
await page.goto(process.env.CATEGORY_URL_SIMPLE)
4646
await new BasePage(page).wcag(testInfo)
4747
})

tests/playwright/checkout.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { test, expect } from '@playwright/test'
2+
import { BasePage } from './pages/BasePage'
23
import { ProductPage } from './pages/ProductPage'
34
import { CheckoutPage } from './pages/CheckoutPage'
45
import { AccountPage } from './pages/AccountPage'
56

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

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

@@ -19,7 +20,7 @@ checkoutTypes.forEach((type) => {
1920
])
2021
})
2122

22-
test(type + ' - as user', async ({ page }) => {
23+
test(type + ' - as user', BasePage.tags, async ({ page }) => {
2324
const productPage = new ProductPage(page)
2425
const checkoutPage = new CheckoutPage(page, type)
2526
const accountPage = new AccountPage(page)

tests/playwright/general.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test, expect } from '@playwright/test'
22
import { BasePage } from './pages/BasePage'
33

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

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

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

2222
await page.goto('/')

tests/playwright/homepage.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { test, expect } from '@playwright/test'
22
import { BasePage } from './pages/BasePage'
33

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

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

14-
test('lighthouse', async ({ page }) => {
14+
test('lighthouse', BasePage.tags, async ({ page }) => {
1515
await new BasePage(page).lighthouse('/')
1616
})

tests/playwright/pages/BasePage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import playwright from 'playwright'
55
import lighthouseMobileConfig from 'lighthouse/core/config/lr-mobile-config.js'
66

77
export class BasePage {
8+
static tags = { tag: process.env.MAGENTO_VERSION ? '@'+process.env.MAGENTO_VERSION : null }
9+
810
constructor(page) {
911
this.page = page
1012
}

tests/playwright/product.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import { test, expect } from '@playwright/test'
22
import { BasePage } from './pages/BasePage'
33

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

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

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

19-
test('wcag', async ({ page }, testInfo) => {
19+
test('wcag', BasePage.tags, async ({ page }, testInfo) => {
2020
await page.goto(process.env.PRODUCT_URL_SIMPLE)
2121
await new BasePage(page).wcag(testInfo)
2222
})
2323

24-
test('lighthouse', async ({ page }) => {
24+
test('lighthouse', BasePage.tags, async ({ page }) => {
2525
await new BasePage(page).lighthouse(process.env.PRODUCT_URL_SIMPLE)
2626
})

tests/playwright/search.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { test, expect } from '@playwright/test'
22
import { ProductPage } from './pages/ProductPage'
33
import { BasePage } from './pages/BasePage'
44

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

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

0 commit comments

Comments
 (0)