From 0e61a1e559e114cc04e8aa7e1f3e023a6ca6f675 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Wed, 30 Jul 2025 17:03:14 -0400 Subject: [PATCH 01/20] feat: initial test --- .gitignore | 2 + package-lock.json | 60 ++++++++++ package.json | 9 +- playwright.config.js | 52 +++++++++ tests/pdp/integration.spec.js | 201 ++++++++++++++++++++++++++++++++++ tests/utils/test-helpers.js | 129 ++++++++++++++++++++++ 6 files changed, 452 insertions(+), 1 deletion(-) create mode 100644 playwright.config.js create mode 100644 tests/pdp/integration.spec.js create mode 100644 tests/utils/test-helpers.js diff --git a/.gitignore b/.gitignore index e86162c9..7f87c0e0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ coverage/* logs/* node_modules/* .vscode +playwright-report/* +test-results/* helix-importer-ui .DS_Store diff --git a/package-lock.json b/package-lock.json index e7e1549f..7fc3d952 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ }, "devDependencies": { "@babel/eslint-parser": "7.25.1", + "@playwright/test": "^1.40.0", "eslint": "8.57.0", "eslint-config-airbnb-base": "15.0.0", "eslint-plugin-import": "2.29.1", @@ -604,6 +605,21 @@ "node": ">= 8" } }, + "node_modules/@playwright/test": { + "version": "1.54.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.54.1.tgz", + "integrity": "sha512-FS8hQ12acieG2dYSksmLOF7BNxnVf2afRJdCuM1eMSxj6QTSE6G4InGF7oApGgDb65MX7AwMVlIkpru0yZA4Xw==", + "dev": true, + "dependencies": { + "playwright": "1.54.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -1913,6 +1929,20 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -3285,6 +3315,36 @@ "node": ">=4" } }, + "node_modules/playwright": { + "version": "1.54.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.54.1.tgz", + "integrity": "sha512-peWpSwIBmSLi6aW2auvrUtf2DqY16YYcCMO8rTVx486jKmDTJg7UAhyrraP98GB8BoPURZP8+nxO7TSd4cPr5g==", + "dev": true, + "dependencies": { + "playwright-core": "1.54.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.54.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.1.tgz", + "integrity": "sha512-Nbjs2zjj0htNhzgiy5wu+3w09YetDx5pkrpI/kZotDlDUaYk0HVA5xrBVPdow4SAUIlhgKcJeJg4GRKW6xHusA==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", diff --git a/package.json b/package.json index c6ce5a39..dc91ee93 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,13 @@ "build:json:models": "merge-json-cli -i \"ue/models/component-models.json\" -o \"component-models.json\"", "build:json:definitions": "merge-json-cli -i \"ue/models/component-definition.json\" -o \"component-definition.json\"", "build:json:filters": "merge-json-cli -i \"ue/models/component-filters.json\" -o \"component-filters.json\"", - "prepare": "husky" + "prepare": "husky", + "test": "playwright test", + "test:ui": "playwright test --ui", + "test:headed": "playwright test --headed", + "test:debug": "playwright test --debug", + "test:install": "playwright install", + "test:report": "playwright show-report" }, "repository": { "type": "git", @@ -25,6 +31,7 @@ "homepage": "https://github.com/adobe/aem-boilerplate#readme", "devDependencies": { "@babel/eslint-parser": "7.25.1", + "@playwright/test": "^1.40.0", "eslint": "8.57.0", "eslint-config-airbnb-base": "15.0.0", "eslint-plugin-import": "2.29.1", diff --git a/playwright.config.js b/playwright.config.js new file mode 100644 index 00000000..ff720d1c --- /dev/null +++ b/playwright.config.js @@ -0,0 +1,52 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import { defineConfig, devices } from '@playwright/test'; + +/** + * @see https://playwright.dev/docs/test-configuration + */ +export default defineConfig({ + testDir: './tests', + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* 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. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + baseURL: process.env.BASE_URL || 'https://main--vitamix--aemsites.aem.network', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + + /* Take screenshot on failure */ + screenshot: 'only-on-failure', + + /* Record video on failure */ + video: 'retain-on-failure', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + { + name: 'Mobile Chrome', + use: { ...devices['Pixel 5'] }, + }, + ], + + /* Run your local dev server before starting the tests */ + // webServer: { + // command: 'npm run start', + // url: 'http://127.0.0.1:3000', + // reuseExistingServer: !process.env.CI, + // }, +}); diff --git a/tests/pdp/integration.spec.js b/tests/pdp/integration.spec.js new file mode 100644 index 00000000..246e0c07 --- /dev/null +++ b/tests/pdp/integration.spec.js @@ -0,0 +1,201 @@ +/* eslint-disable no-console */ +import { test, expect } from '@playwright/test'; +import { + getCurrentBranch, + buildProductUrl, + assertPDPElements, + assertElementExists, + assertElementText, + waitForElement, +} from '../utils/test-helpers.js'; + +/** + * Integration tests for Product Detail Pages (PDP) + * These tests verify that key elements exist and function correctly + */ + +test.describe('PDP Integration Tests', () => { + let currentBranch; + + test.beforeAll(async () => { + currentBranch = await getCurrentBranch(); + console.log(`Running tests against branch: ${currentBranch}`); + }); + + test.describe('Ascent X3 Product Page', () => { + const productPath = '/us/en_us/products/ascent-x3'; + + test('should load Ascent X3 product page with all required elements', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + console.log(`Testing URL: ${productUrl}`); + + // Navigate to the product page + await page.goto(productUrl); + + // Wait for page to load + await page.waitForLoadState('networkidle'); + + // Assert that the page title contains the product name + await expect(page).toHaveTitle(/Ascent X3/i); + + // Assert that key PDP elements exist + await assertPDPElements(page); + + // Assert specific elements for this product + await assertElementExists(page, '.pdp-gallery', 'Product Gallery'); + await assertElementExists(page, '.pdp-title', 'Product Title'); + await assertElementExists(page, '.pdp-pricing', 'Product Pricing'); + await assertElementExists(page, '.pdp-add-to-cart-button', 'Add to Cart Button'); + + // Assert that the product title contains "Ascent X3" + await assertElementText(page, 'h1', 'Ascent X3', 'Product Title'); + + // Assert that pricing information is displayed + const pricingElement = page.locator('.pdp-pricing'); + await expect(pricingElement).toBeVisible(); + + // Assert that product options are available (if this product has variants) + const optionsContainer = page.locator('.pdp-options'); + if (await optionsContainer.count() > 0) { + await expect(optionsContainer).toBeVisible(); + console.log('✓ Product options are available'); + } + + // Assert that specifications section exists + await assertElementExists(page, '.specifications', 'Product Specifications'); + + // Assert that FAQ section exists + await assertElementExists(page, '.faq-container', 'FAQ Section'); + + // Assert that share buttons exist + await assertElementExists(page, '.pdp-share-container', 'Share Buttons'); + + // Assert that compare functionality exists + await assertElementExists(page, '.pdp-compare-container', 'Compare Functionality'); + }); + + test('should display product images in gallery', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + + // Wait for gallery to load + await waitForElement(page, '.gallery'); + + // Assert that product images are displayed + const images = page.locator('.gallery img'); + await expect(images.first()).toBeVisible(); + + // Assert that multiple images are available (if applicable) + const imageCount = await images.count(); + expect(imageCount).toBeGreaterThan(0); + console.log(`✓ Product gallery contains ${imageCount} images`); + }); + + test('should have functional add to cart button', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + + // Wait for add to cart button + await waitForElement(page, '.pdp-add-to-cart-button'); + + // Assert that add to cart button is enabled + const addToCartButton = page.locator('.pdp-add-to-cart-button'); + await expect(addToCartButton).toBeEnabled(); + + // Assert that button has proper text + await expect(addToCartButton).toContainText(/add to cart/i); + + console.log('✓ Add to Cart button is functional'); + }); + + test('should display product specifications', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + + // Wait for specifications section + await waitForElement(page, '.specifications'); + + // Assert that specifications content is present + const specsContent = page.locator('.specifications'); + await expect(specsContent).toBeVisible(); + + // Assert that specifications have content + const specsText = await specsContent.textContent(); + expect(specsText.length).toBeGreaterThan(0); + + console.log('✓ Product specifications are displayed'); + }); + + test('should have working share functionality', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + + // Wait for share container + await waitForElement(page, '.pdp-share-container'); + + // Assert that share buttons exist + const shareButtons = page.locator('.pdp-share-container a'); + await expect(shareButtons.first()).toBeVisible(); + + // Assert that multiple share options are available + const shareCount = await shareButtons.count(); + expect(shareCount).toBeGreaterThan(0); + + console.log(`✓ Share functionality has ${shareCount} options`); + }); + }); + + test.describe('Product Page Navigation', () => { + test('should handle product variant selection', async ({ page }) => { + const productUrl = buildProductUrl('/us/en_us/products/ascent-x3', currentBranch); + await page.goto(productUrl); + + // Look for variant options (like color selection) + const variantOptions = page.locator('.pdp-options button, .pdp-options input[type="radio"]'); + + if (await variantOptions.count() > 0) { + // Click on the first variant option + await variantOptions.first().click(); + + // Wait for any updates to complete + await page.waitForTimeout(1000); + + // Assert that the selection was made + await expect(variantOptions.first()).toHaveAttribute('aria-selected', 'true'); + + console.log('✓ Product variant selection works'); + } else { + console.log('ℹ No variant options found for this product'); + } + }); + + test('should display free shipping message when eligible', async ({ page }) => { + const productUrl = buildProductUrl('/us/en_us/products/ascent-x3', currentBranch); + await page.goto(productUrl); + + // Check for free shipping message + const freeShippingElement = page.locator('.pdp-free-shipping-container'); + + if (await freeShippingElement.count() > 0) { + await expect(freeShippingElement).toBeVisible(); + await expect(freeShippingElement).toContainText(/free shipping/i); + console.log('✓ Free shipping message is displayed'); + } else { + console.log('ℹ Product is not eligible for free shipping'); + } + }); + }); + + test.describe('Cross-browser Compatibility', () => { + test('should work across different browsers', async ({ page, browserName }) => { + const productUrl = buildProductUrl('/us/en_us/products/ascent-x3', currentBranch); + await page.goto(productUrl); + + // Basic functionality test that works across browsers + await expect(page.locator('h1')).toBeVisible(); + await expect(page.locator('.pdp-buy-box')).toBeVisible(); + + console.log(`✓ Basic PDP functionality works in ${browserName}`); + }); + }); +}); diff --git a/tests/utils/test-helpers.js b/tests/utils/test-helpers.js new file mode 100644 index 00000000..386d20de --- /dev/null +++ b/tests/utils/test-helpers.js @@ -0,0 +1,129 @@ +/* eslint-disable no-console */ +/* eslint-disable global-require */ +import { expect } from '@playwright/test'; + +/** + * Utility functions for Vitamix integration tests + */ + +/** + * Get the base URL for the current branch + * @param {string} branch - The branch name (defaults to 'main') + * @returns {string} The base URL for the branch + */ +export function getBaseUrl(branch = 'main') { + const baseUrl = process.env.BASE_URL || `https://${branch}--vitamix--aemsites.aem.network`; + return baseUrl; +} + +/** + * Get the current branch name from environment or git + * @returns {Promise} The current branch name + */ +export async function getCurrentBranch() { + // Check if branch is provided via environment variable + if (process.env.BRANCH) { + return process.env.BRANCH; + } + + // Try to get branch from git (if available) + try { + const { execSync } = require('child_process'); + const branch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim(); + return branch; + } catch (error) { + console.warn('Could not determine git branch, using "main"'); + return 'main'; + } +} + +/** + * Build a product URL for testing + * @param {string} productPath - The product path (e.g., '/us/en_us/products/ascent-x3') + * @param {string} branch - The branch name + * @returns {string} The full product URL + */ +export function buildProductUrl(productPath, branch = 'main') { + const baseUrl = getBaseUrl(branch); + return `${baseUrl}${productPath}`; +} + +/** + * Common assertions for PDP elements + * @param {import('@playwright/test').Page} page - Playwright page object + */ +export async function assertPDPElements(page) { + // Wait for the page to load + await page.waitForLoadState('networkidle'); + + // Assert that key PDP elements exist + await expect(page.locator('h1')).toBeVisible(); + await expect(page.locator('.pdp-buy-box')).toBeVisible(); + await expect(page.locator('.gallery')).toBeVisible(); + + // Assert that pricing information is present + const pricingElement = page.locator('.pdp-pricing'); + await expect(pricingElement).toBeVisible(); + + // Assert that add to cart button exists + const addToCartButton = page.locator('.pdp-add-to-cart-button'); + await expect(addToCartButton).toBeVisible(); + + // Assert that product options exist (if applicable) + const optionsContainer = page.locator('.pdp-options'); + if (await optionsContainer.count() > 0) { + await expect(optionsContainer).toBeVisible(); + } + + // Assert that product details section exists + const detailsSection = page.locator('.details'); + await expect(detailsSection).toBeVisible(); + + // Assert that specifications section exists + const specsSection = page.locator('.specifications'); + await expect(specsSection).toBeVisible(); + + // Assert that FAQ section exists + const faqSection = page.locator('.faq-container'); + await expect(faqSection).toBeVisible(); + + // Assert that share buttons exist + const shareContainer = page.locator('.pdp-share-container'); + await expect(shareContainer).toBeVisible(); +} + +/** + * Assert that a specific element exists and is visible + * @param {import('@playwright/test').Page} page - Playwright page object + * @param {string} selector - CSS selector for the element + * @param {string} description - Description of the element for error messages + */ +export async function assertElementExists(page, selector, description) { + const element = page.locator(selector); + await expect(element).toBeVisible(); + console.log(`✓ ${description} is visible`); +} + +/** + * Assert that a specific element contains expected text + * @param {import('@playwright/test').Page} page - Playwright page object + * @param {string} selector - CSS selector for the element + * @param {string} expectedText - Expected text content + * @param {string} description - Description of the element for error messages + */ +export async function assertElementText(page, selector, expectedText, description) { + const element = page.locator(selector); + await expect(element).toContainText(expectedText); + console.log(`✓ ${description} contains expected text: "${expectedText}"`); +} + +/** + * Wait for and assert that a specific element is present + * @param {import('@playwright/test').Page} page - Playwright page object + * @param {string} selector - CSS selector for the element + * @param {number} timeout - Timeout in milliseconds (default: 10000) + */ +export async function waitForElement(page, selector, timeout = 10000) { + await page.waitForSelector(selector, { timeout }); + console.log(`✓ Element found: ${selector}`); +} From 2bd91796096915825c9e1f59f11f52cf25bf10b9 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Wed, 30 Jul 2025 17:04:42 -0400 Subject: [PATCH 02/20] fix: add workflow --- .github/workflows/test.yml | 82 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..8c6a7b11 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,82 @@ +name: Integration Tests + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + browser: [chromium, firefox, webkit] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Get branch name + id: branch + run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + + - name: Run Playwright tests + env: + BRANCH: ${{ steps.branch.outputs.branch }} + BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network + run: npx playwright test --reporter=html + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-report-${{ matrix.browser }} + path: playwright-report/ + retention-days: 30 + + - name: Upload test results to GitHub + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-report-${{ matrix.browser }} + path: playwright-report/ + retention-days: 30 + + test-mobile: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Get branch name + id: branch + run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + + - name: Run Playwright tests on mobile + env: + BRANCH: ${{ steps.branch.outputs.branch }} + BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network + run: npx playwright test --project="Mobile Chrome" --project="Mobile Safari" \ No newline at end of file From 9f738be7a75e1e38f336c92bffc64c822ba71be1 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Thu, 31 Jul 2025 10:50:25 -0400 Subject: [PATCH 03/20] fix: tests --- .github/workflows/test.yml | 1 - tests/pdp/integration.spec.js | 19 ++++++++++--------- tests/utils/test-helpers.js | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c6a7b11..05284cf1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,6 @@ name: Integration Tests on: push: - pull_request: jobs: test: diff --git a/tests/pdp/integration.spec.js b/tests/pdp/integration.spec.js index 246e0c07..1ed7b50c 100644 --- a/tests/pdp/integration.spec.js +++ b/tests/pdp/integration.spec.js @@ -42,20 +42,21 @@ test.describe('PDP Integration Tests', () => { await assertPDPElements(page); // Assert specific elements for this product - await assertElementExists(page, '.pdp-gallery', 'Product Gallery'); - await assertElementExists(page, '.pdp-title', 'Product Title'); - await assertElementExists(page, '.pdp-pricing', 'Product Pricing'); - await assertElementExists(page, '.pdp-add-to-cart-button', 'Add to Cart Button'); + await assertElementExists(page, '.gallery', 'Product Gallery'); + await assertElementExists(page, '.title h1', 'Product Title'); + await assertElementExists(page, '.pricing', 'Product Pricing'); + await assertElementExists(page, '.pricing-final', 'Product Pricing'); + await assertElementExists(page, '.quantity-container button', 'Add to Cart Button'); // Assert that the product title contains "Ascent X3" - await assertElementText(page, 'h1', 'Ascent X3', 'Product Title'); + await assertElementText(page, 'h1', 'Ascent® X3', 'Product Title'); // Assert that pricing information is displayed - const pricingElement = page.locator('.pdp-pricing'); + const pricingElement = page.locator('.pricing'); await expect(pricingElement).toBeVisible(); // Assert that product options are available (if this product has variants) - const optionsContainer = page.locator('.pdp-options'); + const optionsContainer = page.locator('.pdp-color-options'); if (await optionsContainer.count() > 0) { await expect(optionsContainer).toBeVisible(); console.log('✓ Product options are available'); @@ -96,10 +97,10 @@ test.describe('PDP Integration Tests', () => { await page.goto(productUrl); // Wait for add to cart button - await waitForElement(page, '.pdp-add-to-cart-button'); + await waitForElement(page, '.quantity-container button'); // Assert that add to cart button is enabled - const addToCartButton = page.locator('.pdp-add-to-cart-button'); + const addToCartButton = page.locator('.quantity-container button'); await expect(addToCartButton).toBeEnabled(); // Assert that button has proper text diff --git a/tests/utils/test-helpers.js b/tests/utils/test-helpers.js index 386d20de..e1fb970b 100644 --- a/tests/utils/test-helpers.js +++ b/tests/utils/test-helpers.js @@ -62,15 +62,15 @@ export async function assertPDPElements(page) { await expect(page.locator('.gallery')).toBeVisible(); // Assert that pricing information is present - const pricingElement = page.locator('.pdp-pricing'); + const pricingElement = page.locator('.pricing-final'); await expect(pricingElement).toBeVisible(); // Assert that add to cart button exists - const addToCartButton = page.locator('.pdp-add-to-cart-button'); + const addToCartButton = page.locator('.quantity-container button'); await expect(addToCartButton).toBeVisible(); // Assert that product options exist (if applicable) - const optionsContainer = page.locator('.pdp-options'); + const optionsContainer = page.locator('.pdp-color-options'); if (await optionsContainer.count() > 0) { await expect(optionsContainer).toBeVisible(); } From 2aab34b889f4868295dee2ff0f057216457f4e63 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Thu, 31 Jul 2025 10:58:26 -0400 Subject: [PATCH 04/20] fix: don't try and upload results --- .github/workflows/test.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05284cf1..56dfcce1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - browser: [chromium, firefox, webkit] + browser: [chromium] steps: - uses: actions/checkout@v4 @@ -35,22 +35,6 @@ jobs: BRANCH: ${{ steps.branch.outputs.branch }} BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network run: npx playwright test --reporter=html - - - name: Upload test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: playwright-report-${{ matrix.browser }} - path: playwright-report/ - retention-days: 30 - - - name: Upload test results to GitHub - if: always() - uses: actions/upload-artifact@v4 - with: - name: playwright-report-${{ matrix.browser }} - path: playwright-report/ - retention-days: 30 test-mobile: runs-on: ubuntu-latest @@ -78,4 +62,4 @@ jobs: env: BRANCH: ${{ steps.branch.outputs.branch }} BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network - run: npx playwright test --project="Mobile Chrome" --project="Mobile Safari" \ No newline at end of file + run: npx playwright test --project="Mobile Chrome" \ No newline at end of file From b5e0a0fd22a5d34216416249b9c95483e30947e4 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Thu, 31 Jul 2025 11:20:17 -0400 Subject: [PATCH 05/20] fix: rework workflow --- .github/workflows/test-setup.yml | 36 ++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 28 ++++++++----------------- 2 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/test-setup.yml diff --git a/.github/workflows/test-setup.yml b/.github/workflows/test-setup.yml new file mode 100644 index 00000000..3cd0d8df --- /dev/null +++ b/.github/workflows/test-setup.yml @@ -0,0 +1,36 @@ +name: Test Setup + +on: + workflow_call: + inputs: + project: + required: true + type: string + outputs: + branch: + description: "Branch name" + value: ${{ jobs.setup.outputs.branch }} + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.branch.outputs.branch }} + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Get branch name + id: branch + run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 56dfcce1..9e00fb40 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,9 +4,12 @@ on: push: jobs: + setup: + uses: ./.github/workflows/test-setup.yml + test: + needs: setup runs-on: ubuntu-latest - strategy: matrix: browser: [chromium] @@ -23,20 +26,14 @@ jobs: - name: Install dependencies run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - - name: Get branch name - id: branch - run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - - name: Run Playwright tests env: - BRANCH: ${{ steps.branch.outputs.branch }} - BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network + BRANCH: ${{ needs.setup.outputs.branch }} + BASE_URL: https://${{ needs.setup.outputs.branch }}--vitamix--aemsites.aem.network run: npx playwright test --reporter=html test-mobile: + needs: setup runs-on: ubuntu-latest steps: @@ -51,15 +48,8 @@ jobs: - name: Install dependencies run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - - name: Get branch name - id: branch - run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - - name: Run Playwright tests on mobile env: - BRANCH: ${{ steps.branch.outputs.branch }} - BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network + BRANCH: ${{ needs.setup.outputs.branch }} + BASE_URL: https://${{ needs.setup.outputs.branch }}--vitamix--aemsites.aem.network run: npx playwright test --project="Mobile Chrome" \ No newline at end of file From 777ea3185e0b1d71fa3d233f0682d5a700645f57 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Thu, 31 Jul 2025 11:25:26 -0400 Subject: [PATCH 06/20] fix: revert setup --- .github/workflows/test-setup.yml | 36 -------------------------------- .github/workflows/test.yml | 28 +++++++++++++++++-------- 2 files changed, 19 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/test-setup.yml diff --git a/.github/workflows/test-setup.yml b/.github/workflows/test-setup.yml deleted file mode 100644 index 3cd0d8df..00000000 --- a/.github/workflows/test-setup.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Test Setup - -on: - workflow_call: - inputs: - project: - required: true - type: string - outputs: - branch: - description: "Branch name" - value: ${{ jobs.setup.outputs.branch }} - -jobs: - setup: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.branch.outputs.branch }} - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js 20 - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - - name: Get branch name - id: branch - run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9e00fb40..56dfcce1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,12 +4,9 @@ on: push: jobs: - setup: - uses: ./.github/workflows/test-setup.yml - test: - needs: setup runs-on: ubuntu-latest + strategy: matrix: browser: [chromium] @@ -26,14 +23,20 @@ jobs: - name: Install dependencies run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Get branch name + id: branch + run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + - name: Run Playwright tests env: - BRANCH: ${{ needs.setup.outputs.branch }} - BASE_URL: https://${{ needs.setup.outputs.branch }}--vitamix--aemsites.aem.network + BRANCH: ${{ steps.branch.outputs.branch }} + BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network run: npx playwright test --reporter=html test-mobile: - needs: setup runs-on: ubuntu-latest steps: @@ -48,8 +51,15 @@ jobs: - name: Install dependencies run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Get branch name + id: branch + run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + - name: Run Playwright tests on mobile env: - BRANCH: ${{ needs.setup.outputs.branch }} - BASE_URL: https://${{ needs.setup.outputs.branch }}--vitamix--aemsites.aem.network + BRANCH: ${{ steps.branch.outputs.branch }} + BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network run: npx playwright test --project="Mobile Chrome" \ No newline at end of file From d612eeb10d385b9125e427b33e9e533addeba6e0 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Thu, 31 Jul 2025 11:54:14 -0400 Subject: [PATCH 07/20] fix: workflow update --- .github/workflows/test.yml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 56dfcce1..4c76daff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,40 +24,18 @@ jobs: run: npm ci - name: Install Playwright Browsers - run: npx playwright install --with-deps + run: npx playwright install chromium --with-deps - name: Get branch name id: branch run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - - name: Run Playwright tests + - name: Run Playwright tests on desktop env: BRANCH: ${{ steps.branch.outputs.branch }} BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network run: npx playwright test --reporter=html - - test-mobile: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js 20 - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - - name: Get branch name - id: branch - run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - + - name: Run Playwright tests on mobile env: BRANCH: ${{ steps.branch.outputs.branch }} From c97af15fe192e147e0a4f274dce553555d185dd8 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Thu, 31 Jul 2025 21:05:32 -0400 Subject: [PATCH 08/20] fix: tests --- tests/pdp/integration.spec.js | 185 +++++++++++----------------------- tests/utils/test-helpers.js | 88 +++++++++------- 2 files changed, 111 insertions(+), 162 deletions(-) diff --git a/tests/pdp/integration.spec.js b/tests/pdp/integration.spec.js index 1ed7b50c..c19a529b 100644 --- a/tests/pdp/integration.spec.js +++ b/tests/pdp/integration.spec.js @@ -4,9 +4,10 @@ import { getCurrentBranch, buildProductUrl, assertPDPElements, - assertElementExists, - assertElementText, waitForElement, + assertSaleableElements, + assertOptionElements, + assertElementText, } from '../utils/test-helpers.js'; /** @@ -25,178 +26,106 @@ test.describe('PDP Integration Tests', () => { test.describe('Ascent X3 Product Page', () => { const productPath = '/us/en_us/products/ascent-x3'; - test('should load Ascent X3 product page with all required elements', async ({ page }) => { + test('should load Ascent X3 (configurable) product page with all required elements', async ({ page }) => { const productUrl = buildProductUrl(productPath, currentBranch); console.log(`Testing URL: ${productUrl}`); - // Navigate to the product page await page.goto(productUrl); // Wait for page to load await page.waitForLoadState('networkidle'); - // Assert that the page title contains the product name await expect(page).toHaveTitle(/Ascent X3/i); - - // Assert that key PDP elements exist await assertPDPElements(page); - - // Assert specific elements for this product - await assertElementExists(page, '.gallery', 'Product Gallery'); - await assertElementExists(page, '.title h1', 'Product Title'); - await assertElementExists(page, '.pricing', 'Product Pricing'); - await assertElementExists(page, '.pricing-final', 'Product Pricing'); - await assertElementExists(page, '.quantity-container button', 'Add to Cart Button'); - - // Assert that the product title contains "Ascent X3" - await assertElementText(page, 'h1', 'Ascent® X3', 'Product Title'); - - // Assert that pricing information is displayed - const pricingElement = page.locator('.pricing'); - await expect(pricingElement).toBeVisible(); - - // Assert that product options are available (if this product has variants) - const optionsContainer = page.locator('.pdp-color-options'); - if (await optionsContainer.count() > 0) { - await expect(optionsContainer).toBeVisible(); - console.log('✓ Product options are available'); - } - - // Assert that specifications section exists - await assertElementExists(page, '.specifications', 'Product Specifications'); - - // Assert that FAQ section exists - await assertElementExists(page, '.faq-container', 'FAQ Section'); - - // Assert that share buttons exist - await assertElementExists(page, '.pdp-share-container', 'Share Buttons'); - - // Assert that compare functionality exists - await assertElementExists(page, '.pdp-compare-container', 'Compare Functionality'); + await assertSaleableElements(page); + await assertOptionElements(page); }); - test('should display product images in gallery', async ({ page }) => { - const productUrl = buildProductUrl(productPath, currentBranch); + test('should deeplink to Ascent X3 variant', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch, { + color: 'polar-white', + }); + console.log(`Testing URL: ${productUrl}`); + + // Navigate to the product page await page.goto(productUrl); - // Wait for gallery to load - await waitForElement(page, '.gallery'); + // Wait for page to load + await page.waitForLoadState('networkidle'); - // Assert that product images are displayed - const images = page.locator('.gallery img'); - await expect(images.first()).toBeVisible(); + await expect(page).toHaveTitle(/Ascent X3/i); + await assertPDPElements(page); + await assertPDPElements(page); + await assertSaleableElements(page); + await assertOptionElements(page); - // Assert that multiple images are available (if applicable) - const imageCount = await images.count(); - expect(imageCount).toBeGreaterThan(0); - console.log(`✓ Product gallery contains ${imageCount} images`); + assertElementText(page, '.selected-option-label', 'Color: Polar White', 'Selected Variant Label'); }); - test('should have functional add to cart button', async ({ page }) => { + test('add to cart button should work', async ({ page }) => { + await page.route('**/graphql', async (route) => { + const requestBody = route.request().postDataJSON(); + expect(requestBody.variables).toEqual({ + cartItems: [ + { + sku: 'Ascent X3', + quantity: '1', + selected_options: [ + 'Y29uZmlndXJhYmxlLzkzLzUzNA==', + 'Y3VzdG9tLW9wdGlvbi8zMDAyLzM5NDE=', + ], + }, + ], + }); + + // Log the arguments that were passed to addToCart + console.log('✓ Add to Cart function called with correct variables'); + await route.fulfill({ + status: 200, + }); + }); + const productUrl = buildProductUrl(productPath, currentBranch); await page.goto(productUrl); // Wait for add to cart button await waitForElement(page, '.quantity-container button'); - // Assert that add to cart button is enabled const addToCartButton = page.locator('.quantity-container button'); - await expect(addToCartButton).toBeEnabled(); - - // Assert that button has proper text await expect(addToCartButton).toContainText(/add to cart/i); - console.log('✓ Add to Cart button is functional'); - }); - - test('should display product specifications', async ({ page }) => { - const productUrl = buildProductUrl(productPath, currentBranch); - await page.goto(productUrl); - - // Wait for specifications section - await waitForElement(page, '.specifications'); + // Click the add to cart button + await addToCartButton.click(); - // Assert that specifications content is present - const specsContent = page.locator('.specifications'); - await expect(specsContent).toBeVisible(); + await page.waitForTimeout(3000); - // Assert that specifications have content - const specsText = await specsContent.textContent(); - expect(specsText.length).toBeGreaterThan(0); - - console.log('✓ Product specifications are displayed'); - }); - - test('should have working share functionality', async ({ page }) => { - const productUrl = buildProductUrl(productPath, currentBranch); - await page.goto(productUrl); - - // Wait for share container - await waitForElement(page, '.pdp-share-container'); - - // Assert that share buttons exist - const shareButtons = page.locator('.pdp-share-container a'); - await expect(shareButtons.first()).toBeVisible(); - - // Assert that multiple share options are available - const shareCount = await shareButtons.count(); - expect(shareCount).toBeGreaterThan(0); - - console.log(`✓ Share functionality has ${shareCount} options`); + // should redirect to the cart page + const currentUrl = new URL(page.url()); + expect(currentUrl.pathname).toBe('/us/en_us/checkout/cart/'); + console.log('✓ Add to Cart button is functional'); }); }); - test.describe('Product Page Navigation', () => { + test.describe('Variant Selection', () => { test('should handle product variant selection', async ({ page }) => { const productUrl = buildProductUrl('/us/en_us/products/ascent-x3', currentBranch); await page.goto(productUrl); + await page.waitForLoadState('networkidle'); - // Look for variant options (like color selection) - const variantOptions = page.locator('.pdp-options button, .pdp-options input[type="radio"]'); + // Look for variant options + const variantOptions = page.locator('.pdp-color-options .pdp-color-swatch'); if (await variantOptions.count() > 0) { - // Click on the first variant option - await variantOptions.first().click(); + await variantOptions.nth(1).click(); // Wait for any updates to complete await page.waitForTimeout(1000); - - // Assert that the selection was made - await expect(variantOptions.first()).toHaveAttribute('aria-selected', 'true'); + assertElementText(page, '.selected-option-label', 'Color: Polar White', 'Selected Variant Label'); console.log('✓ Product variant selection works'); } else { console.log('ℹ No variant options found for this product'); } }); - - test('should display free shipping message when eligible', async ({ page }) => { - const productUrl = buildProductUrl('/us/en_us/products/ascent-x3', currentBranch); - await page.goto(productUrl); - - // Check for free shipping message - const freeShippingElement = page.locator('.pdp-free-shipping-container'); - - if (await freeShippingElement.count() > 0) { - await expect(freeShippingElement).toBeVisible(); - await expect(freeShippingElement).toContainText(/free shipping/i); - console.log('✓ Free shipping message is displayed'); - } else { - console.log('ℹ Product is not eligible for free shipping'); - } - }); - }); - - test.describe('Cross-browser Compatibility', () => { - test('should work across different browsers', async ({ page, browserName }) => { - const productUrl = buildProductUrl('/us/en_us/products/ascent-x3', currentBranch); - await page.goto(productUrl); - - // Basic functionality test that works across browsers - await expect(page.locator('h1')).toBeVisible(); - await expect(page.locator('.pdp-buy-box')).toBeVisible(); - - console.log(`✓ Basic PDP functionality works in ${browserName}`); - }); }); }); diff --git a/tests/utils/test-helpers.js b/tests/utils/test-helpers.js index e1fb970b..cf015dc5 100644 --- a/tests/utils/test-helpers.js +++ b/tests/utils/test-helpers.js @@ -43,9 +43,22 @@ export async function getCurrentBranch() { * @param {string} branch - The branch name * @returns {string} The full product URL */ -export function buildProductUrl(productPath, branch = 'main') { +export function buildProductUrl(productPath, branch = 'main', queryParams = {}) { const baseUrl = getBaseUrl(branch); - return `${baseUrl}${productPath}`; + const queryString = new URLSearchParams(queryParams).toString(); + return `${baseUrl}${productPath}${queryString ? `?${queryString}` : ''}`; +} + +/** + * Assert that a specific element exists and is visible + * @param {import('@playwright/test').Page} page - Playwright page object + * @param {string} selector - CSS selector for the element + * @param {string} description - Description of the element for error messages + */ +export async function assertElementExists(page, selector, description) { + const element = page.locator(selector); + await expect(element).toBeVisible(); + console.log(`✓ ${description} is visible`); } /** @@ -57,51 +70,58 @@ export async function assertPDPElements(page) { await page.waitForLoadState('networkidle'); // Assert that key PDP elements exist - await expect(page.locator('h1')).toBeVisible(); - await expect(page.locator('.pdp-buy-box')).toBeVisible(); - await expect(page.locator('.gallery')).toBeVisible(); - - // Assert that pricing information is present - const pricingElement = page.locator('.pricing-final'); - await expect(pricingElement).toBeVisible(); + await assertElementExists(page, '.title h1', 'Product Title'); + await assertElementExists(page, '.pdp-buy-box', 'Product Gallery'); + await assertElementExists(page, '.gallery', 'Product Gallery'); - // Assert that add to cart button exists - const addToCartButton = page.locator('.quantity-container button'); - await expect(addToCartButton).toBeVisible(); + // Assert that product images are displayed + const images = page.locator('.gallery img'); + await expect(images.first()).toBeVisible(); - // Assert that product options exist (if applicable) - const optionsContainer = page.locator('.pdp-color-options'); - if (await optionsContainer.count() > 0) { - await expect(optionsContainer).toBeVisible(); - } - - // Assert that product details section exists - const detailsSection = page.locator('.details'); - await expect(detailsSection).toBeVisible(); + // Assert that multiple images are available (if applicable) + const imageCount = await images.count(); + expect(imageCount).toBeGreaterThan(0); // Assert that specifications section exists - const specsSection = page.locator('.specifications'); - await expect(specsSection).toBeVisible(); + await assertElementExists(page, '.specifications', 'Product Specifications'); // Assert that FAQ section exists - const faqSection = page.locator('.faq-container'); - await expect(faqSection).toBeVisible(); + await assertElementExists(page, '.faq-container', 'FAQ Section'); // Assert that share buttons exist - const shareContainer = page.locator('.pdp-share-container'); - await expect(shareContainer).toBeVisible(); + await assertElementExists(page, '.pdp-share-container', 'Share Buttons'); + + // Assert that compare functionality exists + await assertElementExists(page, '.pdp-compare-container', 'Compare Functionality'); } /** - * Assert that a specific element exists and is visible + * Common assertions for PDP elements * @param {import('@playwright/test').Page} page - Playwright page object - * @param {string} selector - CSS selector for the element - * @param {string} description - Description of the element for error messages */ -export async function assertElementExists(page, selector, description) { - const element = page.locator(selector); - await expect(element).toBeVisible(); - console.log(`✓ ${description} is visible`); +export async function assertSaleableElements(page) { + // Wait for the page to load + await page.waitForLoadState('networkidle'); + + await assertElementExists(page, '.pricing', 'Product Pricing'); + await assertElementExists(page, '.pricing-final', 'Product Pricing'); + await assertElementExists(page, '.quantity-container button', 'Add to Cart Button'); +} + +/** + * Common assertions for PDP elements + * @param {import('@playwright/test').Page} page - Playwright page object + */ +export async function assertOptionElements(page) { + // Wait for the page to load + await page.waitForLoadState('networkidle'); + + // Assert that product options are available (if this product has variants) + const optionsContainer = page.locator('.pdp-color-options'); + if (await optionsContainer.count() > 0) { + await expect(optionsContainer).toBeVisible(); + console.log('✓ Product options are available'); + } } /** From ff90023e3d2ce3f21aa4dbd4ddfaf4d2961748a2 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Fri, 1 Aug 2025 14:19:40 -0400 Subject: [PATCH 09/20] fix: more tests + readme --- README.md | 88 +++++++++++++ tests/pdp/integration.spec.js | 229 +++++++++++++++++++++++++++++++++- tests/utils/test-helpers.js | 15 ++- 3 files changed, 322 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index eee4d6cc..b235617a 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,91 @@ npm run lint ## URL Syntax https://{branch}--vitamix--aemsites.aem.page/ + +## Tests + +### Overview + +This project uses Playwright for end-to-end testing. The tests verify that key elements exist and function correctly across different product configurations. + +### Available Test Commands + +#### Basic Test Commands + +```bash +# Runs all Playwright tests in headless mode with parallel execution +npm test + +# Opens Playwright's interactive UI mode for debugging and test development +npm run test:ui + +# Runs tests with visible browser windows (useful for debugging) +npm run test:headed + +# Runs tests in debug mode with step-by-step execution +npm run test:debug + +# Installs required browser binaries for Playwright +npm run test:install + +# Opens the HTML test report in your browser +npm run test:report +``` + +### Running Tests via Command Line + +> Before any tests will work you must run `npm run test:install` to install the browser dependancies + +#### Run All Tests +```bash +npm test +``` + +#### Run Specific Test File +```bash +npx playwright test tests/pdp/integration.spec.js +``` + +#### Run Tests with Specific Browser +```bash +# Run only on Chromium +npx playwright test --project=chromium + +# Run only on Mobile Chrome +npx playwright test --project="Mobile Chrome" +``` + +#### Run Tests with Custom Base URL (Branch) +```bash +BASE_URL=https://main--vitamix--aemsites.aem.network npm test +``` + +#### Run Tests for Specific Branch +```bash +BRANCH=staging npm test +``` + +#### Running Tests in CI + +```bash +# Install dependencies +npm ci + +# Install Playwright browsers +npm run test:install + +# Run tests +npm test +``` + +### Debugging Tests in VSCode + +There are two VCCode launch configurations to debug the tests. There is also an optional `Playwright Test for VS Code extension` you can install to VSCode. + +#### Debug Playwright Tests +* Runs all tests in the project with debugging enabled. +* Use when debugging issues that affect multiple tests or investigating test setup problems + +#### Debug Current Test File +* Runs only the currently open test file with debugging enabled. +* Use when focusing on debugging a specific test file for faster, targeted debugging diff --git a/tests/pdp/integration.spec.js b/tests/pdp/integration.spec.js index c19a529b..2a772386 100644 --- a/tests/pdp/integration.spec.js +++ b/tests/pdp/integration.spec.js @@ -23,10 +23,10 @@ test.describe('PDP Integration Tests', () => { console.log(`Running tests against branch: ${currentBranch}`); }); - test.describe('Ascent X3 Product Page', () => { + test.describe('Configurable Product Page', () => { const productPath = '/us/en_us/products/ascent-x3'; - test('should load Ascent X3 (configurable) product page with all required elements', async ({ page }) => { + test('should load Ascent X3 product page with all required elements', async ({ page }) => { const productUrl = buildProductUrl(productPath, currentBranch); console.log(`Testing URL: ${productUrl}`); @@ -104,11 +104,9 @@ test.describe('PDP Integration Tests', () => { expect(currentUrl.pathname).toBe('/us/en_us/checkout/cart/'); console.log('✓ Add to Cart button is functional'); }); - }); - test.describe('Variant Selection', () => { test('should handle product variant selection', async ({ page }) => { - const productUrl = buildProductUrl('/us/en_us/products/ascent-x3', currentBranch); + const productUrl = buildProductUrl(productPath, currentBranch); await page.goto(productUrl); await page.waitForLoadState('networkidle'); @@ -128,4 +126,225 @@ test.describe('PDP Integration Tests', () => { } }); }); + + test.describe('Bundle Product Page', () => { + const productPath = '/us/en_us/products/5200-legacy-bundle'; + + test('should load bundle product page with all required elements', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + console.log(`Testing URL: ${productUrl}`); + + await page.goto(productUrl); + + // Wait for page to load + await page.waitForLoadState('networkidle'); + + await expect(page).toHaveTitle(/5200 Legacy Bundle/i); + await assertPDPElements(page); + await assertSaleableElements(page); + await assertOptionElements(page); + }); + + test('should deeplink to bundle variant', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch, { + color: 'red', + }); + console.log(`Testing URL: ${productUrl}`); + + // Navigate to the product page + await page.goto(productUrl); + + // Wait for page to load + await page.waitForLoadState('networkidle'); + + await expect(page).toHaveTitle(/5200 Legacy Bundle/i); + await assertPDPElements(page); + await assertPDPElements(page); + await assertSaleableElements(page); + await assertOptionElements(page); + + assertElementText(page, '.selected-option-label', 'Color: Red', 'Selected Variant Label'); + }); + + test('add to cart button should work', async ({ page }) => { + await page.route('**/graphql', async (route) => { + const requestBody = route.request().postDataJSON(); + expect(requestBody.variables).toEqual({ + cartItems: [ + { + sku: 'VBND5200LB', + quantity: '1', + selected_options: [ + 'YnVuZGxlLzQzLzIyMy8x', + 'Y3VzdG9tLW9wdGlvbi8zMDIzLzM5NjI=', + 'YnVuZGxlLzQxLzIxMi8x', + 'YnVuZGxlLzQxLzIxNS8x', + 'YnVuZGxlLzQxLzIyMS8x', + ], + }, + ], + }); + + // Log the arguments that were passed to addToCart + console.log('✓ Add to Cart function called with correct variables'); + await route.fulfill({ + status: 200, + }); + }); + + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + + // Wait for add to cart button + await waitForElement(page, '.quantity-container button'); + + const addToCartButton = page.locator('.quantity-container button'); + await expect(addToCartButton).toContainText(/add to cart/i); + + // Click the add to cart button + await addToCartButton.click(); + + await page.waitForTimeout(3000); + + // should redirect to the cart page + const currentUrl = new URL(page.url()); + expect(currentUrl.pathname).toBe('/us/en_us/checkout/cart/'); + console.log('✓ Add to Cart button is functional'); + }); + + test('add to cart button should work with extended warranty', async ({ page }) => { + await page.route('**/graphql', async (route) => { + const requestBody = route.request().postDataJSON(); + expect(requestBody.variables).toEqual({ + cartItems: [ + { + sku: 'VBND5200LB', + quantity: '1', + selected_options: [ + 'YnVuZGxlLzQzLzIyMy8x', + 'Y3VzdG9tLW9wdGlvbi8zMDIzLzM5NjU=', + 'YnVuZGxlLzQxLzIxMi8x', + 'YnVuZGxlLzQxLzIxNS8x', + 'YnVuZGxlLzQxLzIyMS8x', + ], + }, + ], + }); + + // Log the arguments that were passed to addToCart + console.log('✓ Add to Cart function called with correct variables'); + await route.fulfill({ + status: 200, + }); + }); + + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + + // Wait for add to cart button + await waitForElement(page, '.quantity-container button'); + + const extendedWarranty = page.locator('.warranty > div:first-of-type'); + await expect(extendedWarranty).toContainText(/warranty/i); + + const warrantyOptions = page.locator('.pdp-warrenty-option'); + const add3YearWarrantyContainer = warrantyOptions.nth(1); + const add3YearWarrantyInput = add3YearWarrantyContainer.locator('input'); + await add3YearWarrantyInput.click(); + + await page.waitForTimeout(1000); + + // Click the add to cart button + const addToCartButton = page.locator('.quantity-container button'); + await expect(addToCartButton).toContainText(/add to cart/i); + await addToCartButton.click(); + + await page.waitForTimeout(3000); + + // should redirect to the cart page + const currentUrl = new URL(page.url()); + expect(currentUrl.pathname).toBe('/us/en_us/checkout/cart/'); + console.log('✓ Add to Cart button is functional'); + }); + + test('should handle product variant selection', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + await page.waitForLoadState('networkidle'); + + // Look for variant options + const variantOptions = page.locator('.pdp-color-options .pdp-color-swatch'); + + if (await variantOptions.count() > 0) { + await variantOptions.nth(1).click(); + + // Wait for any updates to complete + await page.waitForTimeout(1000); + assertElementText(page, '.selected-option-label', 'Color: White', 'Selected Variant Label'); + + console.log('✓ Product variant selection works'); + } else { + console.log('No variant options found for this product'); + } + }); + }); + + test.describe('Simple Product Page', () => { + const productPath = '/us/en_us/products/20-ounce-travel-cup'; + + test('should load simple product page with all required elements', async ({ page }) => { + const productUrl = buildProductUrl(productPath, currentBranch); + console.log(`Testing URL: ${productUrl}`); + + await page.goto(productUrl); + + // Wait for page to load + await page.waitForLoadState('networkidle'); + + await expect(page).toHaveTitle(/20-ounce Container Cup - Smoothie Cups/i); + await assertPDPElements(page); + await assertSaleableElements(page); + }); + + test('add to cart button should work', async ({ page }) => { + await page.route('**/graphql', async (route) => { + const requestBody = route.request().postDataJSON(); + expect(requestBody.variables).toEqual({ + cartItems: [ + { + sku: '056264', + quantity: '1', + selected_options: [ + ], + }, + ], + }); + + // Log the arguments that were passed to addToCart + console.log('✓ Add to Cart function called with correct variables'); + await route.fulfill({ + status: 200, + }); + }); + + const productUrl = buildProductUrl(productPath, currentBranch); + await page.goto(productUrl); + + // Wait for add to cart button + await waitForElement(page, '.quantity-container button'); + + const addToCartButton = page.locator('.quantity-container button'); + await expect(addToCartButton).toContainText(/add to cart/i); + + // Click the add to cart button + await addToCartButton.click(); + + await page.waitForTimeout(3000); + + // should redirect to the cart page + const currentUrl = new URL(page.url()); + expect(currentUrl.pathname).toBe('/us/en_us/checkout/cart/'); + console.log('✓ Add to Cart button is functional'); + }); + }); }); diff --git a/tests/utils/test-helpers.js b/tests/utils/test-helpers.js index cf015dc5..8b36feda 100644 --- a/tests/utils/test-helpers.js +++ b/tests/utils/test-helpers.js @@ -12,10 +12,14 @@ import { expect } from '@playwright/test'; * @returns {string} The base URL for the branch */ export function getBaseUrl(branch = 'main') { + // Check if we're running locally + if (process.env.NODE_ENV === 'development' || process.env.LOCAL_TESTING) { + return 'http://localhost:3000'; + } + const baseUrl = process.env.BASE_URL || `https://${branch}--vitamix--aemsites.aem.network`; return baseUrl; } - /** * Get the current branch name from environment or git * @returns {Promise} The current branch name @@ -118,10 +122,11 @@ export async function assertOptionElements(page) { // Assert that product options are available (if this product has variants) const optionsContainer = page.locator('.pdp-color-options'); - if (await optionsContainer.count() > 0) { - await expect(optionsContainer).toBeVisible(); - console.log('✓ Product options are available'); - } + const options = page.locator('.pdp-color-options .pdp-color-swatch'); + + await expect(optionsContainer).toBeVisible(); + await expect(await options.count()).toBeGreaterThan(0); + console.log('✓ Product options are available'); } /** From babeb3a0503591ac8e5e03b5051c86986080165e Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Fri, 1 Aug 2025 14:41:19 -0400 Subject: [PATCH 10/20] fix: include launch.json --- .gitignore | 2 +- .vscode/launch.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index 7f87c0e0..f3087019 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ coverage/* logs/* node_modules/* -.vscode +.vscode/settings.json playwright-report/* test-results/* diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..dc4664be --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,44 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Current Test File", + "type": "node", + "request": "launch", + "program": "${workspaceFolder}/node_modules/@playwright/test/cli.js", + "args": [ + "test", + "${file}", + "--project=chromium" + ], + "console": "integratedTerminal", + "cwd": "${workspaceFolder}", + "env": { + "PWDEBUG": "0", + "NODE_ENV": "development" + }, + "skipFiles": [ + "/**" + ] + }, + { + "name": "Debug All Tests", + "type": "node", + "request": "launch", + "program": "${workspaceFolder}/node_modules/@playwright/test/cli.js", + "args": [ + "test", + "--project=chromium" + ], + "console": "integratedTerminal", + "cwd": "${workspaceFolder}", + "env": { + "PWDEBUG": "0", + "NODE_ENV": "development" + }, + "skipFiles": [ + "/**" + ] + } + ] +} \ No newline at end of file From d229f82a0043c6a3546312f9e2dc16d2650c235b Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 14:59:20 -0400 Subject: [PATCH 11/20] fix: change to tests to `workflow_dispatch` --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4c76daff..de13ea90 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Integration Tests on: - push: + workflow_dispatch: jobs: test: From 075d96c0f30010ecd616fa9cf3f05320543abd51 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 15:04:34 -0400 Subject: [PATCH 12/20] fix: dispatch on /run-tests comment --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de13ea90..33b27b9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,11 +2,16 @@ name: Integration Tests on: workflow_dispatch: + issue_comment: + types: [created] jobs: test: runs-on: ubuntu-latest + # Only run if manually dispatched or if comment contains trigger phrase + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/run-tests')) + strategy: matrix: browser: [chromium] From 39b9498cbeaabc3a2a599eaf6d3f2116bf9011b4 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 15:11:03 -0400 Subject: [PATCH 13/20] fix: issue comment --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33b27b9b..d92d810c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,6 @@ name: Integration Tests on: - workflow_dispatch: issue_comment: types: [created] @@ -9,15 +8,19 @@ jobs: test: runs-on: ubuntu-latest - # Only run if manually dispatched or if comment contains trigger phrase - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/run-tests')) + # Only run if comment contains trigger phrase and is on a PR + if: contains(github.event.comment.body, '/run-tests') && github.event.issue.pull_request strategy: matrix: browser: [chromium] steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + # Checkout the PR branch + ref: ${{ format('refs/pull/{0}/head', github.event.issue.number) }} - name: Use Node.js 20 uses: actions/setup-node@v4 From 71555c1b0147846d6d2f324c857b71365aa2ca2c Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 15:15:19 -0400 Subject: [PATCH 14/20] fix: try /run-tests again --- .github/workflows/test.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d92d810c..2b11c05f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,9 +34,14 @@ jobs: - name: Install Playwright Browsers run: npx playwright install chromium --with-deps - - name: Get branch name + - name: Get PR branch name id: branch - run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + run: | + # Get the actual branch name from the PR using REST API + PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}") + BRANCH_NAME=$(echo "$PR_DATA" | jq -r '.head.ref') + echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - name: Run Playwright tests on desktop env: From db83c64d202764f2511d209a4cc28f6dace13cfe Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 15:17:21 -0400 Subject: [PATCH 15/20] chore: debug comments --- .github/workflows/test.yml | 63 ++++++++++---------------------------- 1 file changed, 17 insertions(+), 46 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b11c05f..c54956e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,56 +1,27 @@ -name: Integration Tests + +name: Debug Integration Tests on: issue_comment: types: [created] jobs: - test: + debug: runs-on: ubuntu-latest - - # Only run if comment contains trigger phrase and is on a PR - if: contains(github.event.comment.body, '/run-tests') && github.event.issue.pull_request - - strategy: - matrix: - browser: [chromium] - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - # Checkout the PR branch - ref: ${{ format('refs/pull/{0}/head', github.event.issue.number) }} - - - name: Use Node.js 20 - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Install Playwright Browsers - run: npx playwright install chromium --with-deps - - - name: Get PR branch name - id: branch + - name: Debug info run: | - # Get the actual branch name from the PR using REST API - PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}") - BRANCH_NAME=$(echo "$PR_DATA" | jq -r '.head.ref') - echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "Comment body: ${{ github.event.comment.body }}" + echo "Is PR: ${{ github.event.issue.pull_request != null }}" + echo "Contains trigger: ${{ contains(github.event.comment.body, '/run-tests') }}" + echo "Event type: ${{ github.event_name }}" + echo "Issue number: ${{ github.event.issue.number }}" + + test: + runs-on: ubuntu-latest + needs: debug + if: contains(github.event.comment.body, '/run-tests') && github.event.issue.pull_request != null - - name: Run Playwright tests on desktop - env: - BRANCH: ${{ steps.branch.outputs.branch }} - BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network - run: npx playwright test --reporter=html - - - name: Run Playwright tests on mobile - env: - BRANCH: ${{ steps.branch.outputs.branch }} - BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network - run: npx playwright test --project="Mobile Chrome" \ No newline at end of file + steps: + - name: Just a test + run: echo "Tests would run here!" \ No newline at end of file From aa4427cfb17ccd5056d58fb6bcc5d51bb35f06c4 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 15:19:44 -0400 Subject: [PATCH 16/20] fix: try pull_request_review_comment --- .github/workflows/test.yml | 65 +++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c54956e3..7c68ad68 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,27 +1,56 @@ - -name: Debug Integration Tests +name: Integration Tests on: - issue_comment: + pull_request_review_comment: types: [created] jobs: - debug: - runs-on: ubuntu-latest - steps: - - name: Debug info - run: | - echo "Comment body: ${{ github.event.comment.body }}" - echo "Is PR: ${{ github.event.issue.pull_request != null }}" - echo "Contains trigger: ${{ contains(github.event.comment.body, '/run-tests') }}" - echo "Event type: ${{ github.event_name }}" - echo "Issue number: ${{ github.event.issue.number }}" - test: runs-on: ubuntu-latest - needs: debug - if: contains(github.event.comment.body, '/run-tests') && github.event.issue.pull_request != null + + # Only run if comment contains trigger phrase and is on a PR + if: contains(github.event.comment.body, '/run-tests') && github.event.issue.pull_request + + strategy: + matrix: + browser: [chromium] steps: - - name: Just a test - run: echo "Tests would run here!" \ No newline at end of file + - name: Checkout code + uses: actions/checkout@v4 + with: + # Checkout the PR branch + ref: ${{ format('refs/pull/{0}/head', github.event.issue.number) }} + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Install Playwright Browsers + run: npx playwright install chromium --with-deps + + - name: Get PR branch name + id: branch + run: | + # Get the actual branch name from the PR using REST API + PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}") + BRANCH_NAME=$(echo "$PR_DATA" | jq -r '.head.ref') + echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT + + - name: Run Playwright tests on desktop + env: + BRANCH: ${{ steps.branch.outputs.branch }} + BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network + run: npx playwright test --reporter=html + + - name: Run Playwright tests on mobile + env: + BRANCH: ${{ steps.branch.outputs.branch }} + BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network + run: npx playwright test --project="Mobile Chrome" \ No newline at end of file From d9ee2198360a4f7ae0cd9185cef9ea8c38e67f31 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 15:35:00 -0400 Subject: [PATCH 17/20] fix: test issue comment --- .github/workflows/test.yml | 52 +++----------------------------------- 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c68ad68..054b2041 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,56 +1,12 @@ -name: Integration Tests +name: Simple Test on: - pull_request_review_comment: + issue_comment: types: [created] jobs: test: runs-on: ubuntu-latest - - # Only run if comment contains trigger phrase and is on a PR - if: contains(github.event.comment.body, '/run-tests') && github.event.issue.pull_request - - strategy: - matrix: - browser: [chromium] - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - # Checkout the PR branch - ref: ${{ format('refs/pull/{0}/head', github.event.issue.number) }} - - - name: Use Node.js 20 - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Install Playwright Browsers - run: npx playwright install chromium --with-deps - - - name: Get PR branch name - id: branch - run: | - # Get the actual branch name from the PR using REST API - PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}") - BRANCH_NAME=$(echo "$PR_DATA" | jq -r '.head.ref') - echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - - - name: Run Playwright tests on desktop - env: - BRANCH: ${{ steps.branch.outputs.branch }} - BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network - run: npx playwright test --reporter=html - - - name: Run Playwright tests on mobile - env: - BRANCH: ${{ steps.branch.outputs.branch }} - BASE_URL: https://${{ steps.branch.outputs.branch }}--vitamix--aemsites.aem.network - run: npx playwright test --project="Mobile Chrome" \ No newline at end of file + - name: Always run + run: echo "This should always run on any comment" \ No newline at end of file From 710e673d57b2172abc2ab5f102dcc1832232b53a Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 16:21:32 -0400 Subject: [PATCH 18/20] fix: delete test.yml --- .github/workflows/test.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 054b2041..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Simple Test - -on: - issue_comment: - types: [created] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Always run - run: echo "This should always run on any comment" \ No newline at end of file From 3edbf9c4b563447d6399655192fe4776d0f50dca Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 16:33:58 -0400 Subject: [PATCH 19/20] fix: fail tests --- tests/pdp/integration.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pdp/integration.spec.js b/tests/pdp/integration.spec.js index 2a772386..f54ae364 100644 --- a/tests/pdp/integration.spec.js +++ b/tests/pdp/integration.spec.js @@ -53,7 +53,7 @@ test.describe('PDP Integration Tests', () => { // Wait for page to load await page.waitForLoadState('networkidle'); - await expect(page).toHaveTitle(/Ascent X3/i); + await expect(page).toHaveTitle(/Ascent X32t/i); await assertPDPElements(page); await assertPDPElements(page); await assertSaleableElements(page); From ed8a6103f7e36a1adbdc7cd70a988ac1282b4477 Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Tue, 5 Aug 2025 16:37:44 -0400 Subject: [PATCH 20/20] fix: readme update, fix tests --- README.md | 11 +---------- tests/pdp/integration.spec.js | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b235617a..d9e33776 100644 --- a/README.md +++ b/README.md @@ -95,16 +95,7 @@ BRANCH=staging npm test #### Running Tests in CI -```bash -# Install dependencies -npm ci - -# Install Playwright browsers -npm run test:install - -# Run tests -npm test -``` +Tests can be manually run within a PR on github by commenting `/run-tests` ### Debugging Tests in VSCode diff --git a/tests/pdp/integration.spec.js b/tests/pdp/integration.spec.js index f54ae364..2a772386 100644 --- a/tests/pdp/integration.spec.js +++ b/tests/pdp/integration.spec.js @@ -53,7 +53,7 @@ test.describe('PDP Integration Tests', () => { // Wait for page to load await page.waitForLoadState('networkidle'); - await expect(page).toHaveTitle(/Ascent X32t/i); + await expect(page).toHaveTitle(/Ascent X3/i); await assertPDPElements(page); await assertPDPElements(page); await assertSaleableElements(page);