diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 9cbc6d73..506b38df 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -29,6 +29,8 @@ jobs: PHP_VERSION: '8.1' - PS_VERSION: '8.1.7' PHP_VERSION: '8.1' + - PS_VERSION: '8.2.1' + PHP_VERSION: '8.1' - PS_VERSION: '9.0.x' PHP_VERSION: '8.2' - PS_VERSION: 'nightly' @@ -43,13 +45,41 @@ jobs: with: fetch-depth: 0 + - name: Clone PrestaShop for core dependencies + run: | + git clone --depth=50 https://github.com/PrestaShop/PrestaShop.git ~/PrestaShop + rm -rf ~/PrestaShop/modules/blockwishlist + cd .. + mv blockwishlist ~/PrestaShop/modules + ln -s ~/PrestaShop/modules/blockwishlist + cd blockwishlist + - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 20 + node-version: 20.x + + - name: Install dependencies + run: npm ci - - name: Build - run: npm install && npm run build + - name: Build PrestaShop assets + run: | + npm --prefix ~/PrestaShop/admin-dev/themes/new-theme install + npm --prefix ~/PrestaShop/admin-dev/themes/new-theme run build + + - name: Build JS dependencies + run: | + npm --prefix ~/PrestaShop/modules/blockwishlist run build + rm -rf node_modules + + - name: Install composer dependencies + run: composer install --no-dev -o + + - name: Prepare auto-index tool + run: composer global require prestashop/autoindex + + - name: Generate index.php + run: ~/.composer/vendor/bin/autoindex - name: Build ZIP run: | @@ -84,7 +114,7 @@ jobs: DB_NAME: 'prestashop' DB_USER: 'prestashop' DB_PASSWD: 'prestashop' - run: npx playwright test + run: npx playwright test campaigns/03_frontOffice/02_products/01_addProductToList.spec.ts - name: Upload artifact report uses: actions/upload-artifact@v4 @@ -122,6 +152,8 @@ jobs: PHP_VERSION: '8.1' - PS_VERSION: '8.1.7' PHP_VERSION: '8.1' + - PS_VERSION: '8.2.1' + PHP_VERSION: '8.1' - PS_VERSION: '9.0.x' PHP_VERSION: '8.2' - PS_VERSION: 'nightly' diff --git a/tests/UI/campaigns/03_frontOffice/02_products/01_addProductToList.spec.ts b/tests/UI/campaigns/03_frontOffice/02_products/01_addProductToList.spec.ts index 0a25d57e..c9a9e508 100644 --- a/tests/UI/campaigns/03_frontOffice/02_products/01_addProductToList.spec.ts +++ b/tests/UI/campaigns/03_frontOffice/02_products/01_addProductToList.spec.ts @@ -40,11 +40,26 @@ test.describe('Wishlist module - Add a product to a list', async () => { let page: Page; let wishlistName: string; - test.beforeAll(async ({ browser }) => { + test.beforeAll(async ({ browser }, testInfo) => { browserContext = await browser.newContext(); - page = await browserContext.newPage(); - }); - test.afterAll(async () => { + page = await browser.newPage({ + recordVideo: { + dir: testInfo.outputPath('videos'), + } + }); + }); + test.afterAll(async ({}, testInfo) => { + const videoPath = testInfo.outputPath('my-video.webm'); + await Promise.all([ + page.video()!.saveAs(videoPath), + page.close() + ]); + testInfo.attachments.push({ + name: 'video', + path: videoPath, + contentType: 'video/webm' + }); + await page.close(); }); diff --git a/tests/UI/playwright.config.ts b/tests/UI/playwright.config.ts index 1f9f4b5d..8b9bb51c 100644 --- a/tests/UI/playwright.config.ts +++ b/tests/UI/playwright.config.ts @@ -20,7 +20,8 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Capture screenshot after each test failure */ - screenshot: 'only-on-failure', + screenshot: 'on', + video: 'on', }, /* Configure projects for major browsers */