diff --git a/packages/playwright/sc-dashboard.js b/packages/playwright/sc-dashboard.js new file mode 100644 index 000000000..75166af15 --- /dev/null +++ b/packages/playwright/sc-dashboard.js @@ -0,0 +1,62 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); +const { url } = require('inspector'); + + +(async () => { + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + // Capture page errors + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + const resolutions = [ + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + + + ]; + + + const pages = [ + { url: 'https://packrat.world/',name: 'dashboard'}, + + ]; + + + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + console.log(`Taking full-page screenshot of ${url} at ${resolution.name} resolution...`); + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false }); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); diff --git a/packages/playwright/sc-destination-query.js b/packages/playwright/sc-destination-query.js new file mode 100644 index 000000000..7992f0221 --- /dev/null +++ b/packages/playwright/sc-destination-query.js @@ -0,0 +1,89 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + + ]; + + + const pages = [ + { url: 'https://packrat.world/destination/query?osmType=R&osmId=207359&name=Los%20Angeles', name: 'destination-query'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByPlaceholder('Search by park, city, or trail').click(); + await page.getByPlaceholder('Search by park, city, or trail').fill('Los Angeles'); + await page.getByText('Los Angelescity').click(); + await page.goto('https://packrat.world/destination/query?osmType=R&osmId=207359&name=Los%20Angeles'); + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: true}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-feed.js b/packages/playwright/sc-feed.js new file mode 100644 index 000000000..fd4cd1eca --- /dev/null +++ b/packages/playwright/sc-feed.js @@ -0,0 +1,93 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + + ]; + + + const pages = [ + { url: 'https://packrat.world/feed', name: 'feed'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: 'Profile' }).click(); + await page.getByRole('button', { name: '󱀁 Feed' }).click(); + await page.goto('https://packrat.world/feed'); + + + + + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-items-fullscreen.js b/packages/playwright/sc-items-fullscreen.js new file mode 100644 index 000000000..86c6113ed --- /dev/null +++ b/packages/playwright/sc-items-fullscreen.js @@ -0,0 +1,90 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + + ]; + + + const pages = [ + { url: 'https://packrat.world/items', name: 'items-page (full-screen)'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: 'Profile' }).click(); + await page.locator('div').filter({ hasText: /^Items$/ }).first().click() + await page.goto('https://packrat.world/items'); + + + + + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: true}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-items.js b/packages/playwright/sc-items.js new file mode 100644 index 000000000..9f2901644 --- /dev/null +++ b/packages/playwright/sc-items.js @@ -0,0 +1,93 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + + ]; + + + const pages = [ + { url: 'https://packrat.world/items', name: 'items-page'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: 'Profile' }).click(); + await page.locator('div').filter({ hasText: /^Items$/ }).first().click() + await page.goto('https://packrat.world/items'); + + + + + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-login-register.js b/packages/playwright/sc-login-register.js new file mode 100644 index 000000000..0ff6ba252 --- /dev/null +++ b/packages/playwright/sc-login-register.js @@ -0,0 +1,62 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); +const { url } = require('inspector'); + + +(async () => { + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + // Capture page errors + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + const resolutions = [ + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + + + ]; + + + const pages = [ + { url: 'https://packrat.world/sign-in',name: 'log in'}, + { url: 'https://packrat.world/register', name: 'register'}, + ]; + + + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + console.log(`Taking full-page screenshot of ${url} at ${resolution.name} resolution...`); + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false }); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); diff --git a/packages/playwright/sc-other-profile-fullscreen.js b/packages/playwright/sc-other-profile-fullscreen.js new file mode 100644 index 000000000..22adeb690 --- /dev/null +++ b/packages/playwright/sc-other-profile-fullscreen.js @@ -0,0 +1,89 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + ]; + + + const pages = [ + { url: 'https://packrat.world/profile/zjo2f4g2f51lo2wr3l6va63a', name: 'other-users-profile (full-screen)'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('link', { name: ' 0724 testing 19.91lb  1 ' }).click(); + await page.goto('https://packrat.world/pack/vx7g8a8j6ull12ijzcoz7igy'); + await page.getByRole('link', { name: 'View Profile' }).click(); + await page.goto('https://packrat.world/profile/zjo2f4g2f51lo2wr3l6va63a'); + + + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: true}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-other-profile.js b/packages/playwright/sc-other-profile.js new file mode 100644 index 000000000..bc19efbe9 --- /dev/null +++ b/packages/playwright/sc-other-profile.js @@ -0,0 +1,89 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + ]; + + + const pages = [ + { url: 'https://packrat.world/profile/zjo2f4g2f51lo2wr3l6va63a', name: 'other-users-profile'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('link', { name: ' 0724 testing 19.91lb  1 ' }).click(); + await page.goto('https://packrat.world/pack/vx7g8a8j6ull12ijzcoz7igy'); + await page.getByRole('link', { name: 'View Profile' }).click(); + await page.goto('https://packrat.world/profile/zjo2f4g2f51lo2wr3l6va63a'); + + + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-pack-create.js b/packages/playwright/sc-pack-create.js new file mode 100644 index 000000000..054aaf795 --- /dev/null +++ b/packages/playwright/sc-pack-create.js @@ -0,0 +1,85 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + ]; + + + const pages = [ + { url: 'https://packrat.world/pack/create', name: 'pack_create'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByText('Create a Pack').click(); + await page.goto('https://packrat.world/pack/create'); + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: true}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-pack-details-fullscreen.js b/packages/playwright/sc-pack-details-fullscreen.js new file mode 100644 index 000000000..d8642393c --- /dev/null +++ b/packages/playwright/sc-pack-details-fullscreen.js @@ -0,0 +1,89 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + + ]; + + + const pages = [ + { url: 'https://packrat.world/pack/kzc8u60rlmmxpzxnxyjv', name: 'pack-details (full-screen)'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Packs' }).click(); + await page.getByRole('link', { name: 'Quantity field' }).hover(); + await page.goto('https://packrat.pages.dev/pack/jfxuhkd3zflt4ddavnyhh3so'); + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: true}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-pack-details.js b/packages/playwright/sc-pack-details.js new file mode 100644 index 000000000..7b2270a81 --- /dev/null +++ b/packages/playwright/sc-pack-details.js @@ -0,0 +1,86 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + + ]; + + + const pages = [ + { url: 'https://packrat.world/pack/kzc8u60rlmmxpzxnxyjv', name: 'pack-details'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Packs' }).click(); + await page.getByRole('link', { name: 'Quantity field' }).hover(); + await page.goto('https://packrat.pages.dev/pack/jfxuhkd3zflt4ddavnyhh3so'); + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-packs-page.js b/packages/playwright/sc-packs-page.js new file mode 100644 index 000000000..17e01cc28 --- /dev/null +++ b/packages/playwright/sc-packs-page.js @@ -0,0 +1,88 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + + ]; + + + const pages = [ + { url: 'https://packrat.world/packs', name: 'pack-details'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Packs' }).click(); + await page.goto('https://packrat.world/packs'); + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-profile-settings-fullscreen.js b/packages/playwright/sc-profile-settings-fullscreen.js new file mode 100644 index 000000000..f641c1030 --- /dev/null +++ b/packages/playwright/sc-profile-settings-fullscreen.js @@ -0,0 +1,89 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + ]; + + + const pages = [ + { url: 'https://packrat.world/profile/settings', name: 'profile-settings(Full-screen)'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: 'Profile' }).click(); + await page.goto('https://packrat.world/profile'); + await page.getByRole('button', { name: '󰢻' }).hover(); + await page.goto('https://packrat.world/profile/settings'); + + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: true}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/sc-profile-settings.js b/packages/playwright/sc-profile-settings.js new file mode 100644 index 000000000..c6b259e41 --- /dev/null +++ b/packages/playwright/sc-profile-settings.js @@ -0,0 +1,89 @@ +const { chromium } = require('playwright'); +const fs = require('fs'); +const path = require('path'); + + +(async () => { + // Directory to save screenshots + const screenshotsDir = path.join(__dirname, 'screenshots'); + if (!fs.existsSync(screenshotsDir)) { + fs.mkdirSync(screenshotsDir); + } + + + // Launch browser + const browser = await chromium.launch({ headless: false }); + const page = await browser.newPage(); + + + // Capture console logs and page errors + page.on('console', msg => console.log('PAGE LOG:', msg.text())); + page.on('pageerror', error => console.error('PAGE ERROR:', error)); + + + // Define resolutions and pages + const resolutions = [ + { width: 1920, height: 1080, name: 'desktop' }, + { width: 3440, height: 1440, name: 'big desktop screen' }, + { width: 1280, height: 800, name: 'tablet' }, + { width: 1366, height: 1024, name: 'iPad Pro'}, + { width: 375, height: 667, name: 'small mobile' }, + { width: 390, height: 844, name: 'Android mobile'}, + { width: 393, height: 852, name: 'iPhone'}, + { width: 430, height: 932, name: 'iPhone Pro Max'}, + { width: 1366, height: 768, name: 'laptop'}, + ]; + + + const pages = [ + { url: 'https://packrat.world/profile/settings', name: 'profile-settings'}, + + // Add more pages as needed + ]; + + + // Function to perform login + const login = async () => { + console.log('Navigating to login page...'); + await page.goto('https://packrat.world/sign-in', { waitUntil: 'networkidle' }); + + + console.log('Filling login form...'); + await page.locator('input[type="email"]').fill('zoot3@email.com'); // Replace with actual username field selector and value + await page.locator('input[type="password"]').fill('12345678'); // Replace with actual password field selector and value + await page.getByRole('button', { name: 'Sign In' }).click();// Replace with actual login button selector + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: 'Profile' }).click(); + await page.goto('https://packrat.world/profile'); + await page.getByRole('button', { name: '󰢻' }).hover(); + await page.goto('https://packrat.world/profile/settings'); + + + }; + + + // Perform login + await login(); + + + // Take screenshots for each resolution and page + for (const resolution of resolutions) { + await page.setViewportSize({ width: resolution.width, height: resolution.height }); + for (const { url, name } of pages) { + try { + console.log(`Navigating to ${url} at ${resolution.name} resolution...`); + await page.goto(url, { waitUntil: 'networkidle' }); + + await page.screenshot({ path: path.join(screenshotsDir, `${name}-${resolution.name}.png`), fullPage: false}); + } catch (error) { + console.error(`Failed to navigate to ${url}:`, error); + } + } + } + + + console.log('Closing browser...'); + await browser.close(); +})(); + + diff --git a/packages/playwright/tests/empty_confirmnewpwd_field.spec.js b/packages/playwright/tests/empty_confirmnewpwd_field.spec.js new file mode 100644 index 000000000..7fa29e702 --- /dev/null +++ b/packages/playwright/tests/empty_confirmnewpwd_field.spec.js @@ -0,0 +1,25 @@ +import { test, expect } from '@playwright/test'; +test.setTimeout(60000); + +test('change password with empty confrim new password field shows error message', async ({ page }) => { + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Profile' }).click(); + await page.goto('https://packrat.world/profile'); + await page.getByRole('button', { name: '󰢻' }).click(); + await page.getByLabel('Old password').click(); + await page.getByLabel('Old password').fill('12345678'); + await page.getByLabel('New password', { exact: true }).click(); + await page.getByLabel('New password', { exact: true }).fill('87654321'); + await page.getByRole('button', { name: 'Change password' }).click(); + + // Verify the error message for invalid email format + const passwordErrorMessage = page.locator('text=Password is required'); + await expect(passwordErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed + }); \ No newline at end of file diff --git a/packages/playwright/tests/empty_newpwd_field.spec.js b/packages/playwright/tests/empty_newpwd_field.spec.js new file mode 100644 index 000000000..2d5fb22b2 --- /dev/null +++ b/packages/playwright/tests/empty_newpwd_field.spec.js @@ -0,0 +1,25 @@ +import { test, expect } from '@playwright/test'; +test.setTimeout(60000); + +test('change password with empty new password field shows error message', async ({ page }) => { + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Profile' }).click(); + await page.goto('https://packrat.world/profile'); + await page.getByRole('button', { name: '󰢻' }).click(); + await page.getByLabel('Old password').click(); + await page.getByLabel('Old password').fill('12345678'); + await page.getByLabel('Confirm new password').click(); + await page.getByLabel('Confirm new password').fill('87654321'); + await page.getByRole('button', { name: 'Change password' }).click(); + + // Verify the error message for invalid email format + const passwordErrorMessage = page.locator('text=Password is required'); + await expect(passwordErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed + }); \ No newline at end of file diff --git a/packages/playwright/tests/empty_oldpwd_field.spec.js b/packages/playwright/tests/empty_oldpwd_field.spec.js new file mode 100644 index 000000000..1cb28d903 --- /dev/null +++ b/packages/playwright/tests/empty_oldpwd_field.spec.js @@ -0,0 +1,27 @@ +import { test, expect } from '@playwright/test'; +test.setTimeout(60000); + +test('change password with empty oldpassword field shows error message', async ({ page }) => { + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Profile' }).click(); + await page.goto('https://packrat.world/profile'); + await page.getByRole('button', { name: '󰢻' }).click(); + await page.getByLabel('Old password').click(); + await page.getByLabel('Old password').fill(''); + await page.getByLabel('New password', { exact: true }).click(); + await page.getByLabel('New password', { exact: true }).fill('87654321'); + await page.getByLabel('Confirm new password').click(); + await page.getByLabel('Confirm new password').fill('87654321'); + await page.getByRole('button', { name: 'Change password' }).click(); + + // Verify the error message for invalid email format + const passwordErrorMessage = page.locator('text=Password is required'); + await expect(passwordErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed + }); \ No newline at end of file diff --git a/packages/playwright/tests/invld_add_item_qty.spec.js b/packages/playwright/tests/invld_add_item_qty.spec.js new file mode 100644 index 000000000..f116c99d6 --- /dev/null +++ b/packages/playwright/tests/invld_add_item_qty.spec.js @@ -0,0 +1,28 @@ +import { test, expect } from '@playwright/test'; + +test('Add Item without quantity shows required error', async ({ page }) => { + test.setTimeout(60000); + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: 'Packs' }).click(); + await page.goto('https://packrat.world/packs'); + await page.getByRole('link', { name: 'Quantity field' }).click(); + await page.getByRole('button', { name: 'Add Item' }).click(); + await page.getByPlaceholder('Item Name').fill('A'); + await page.getByPlaceholder('Weight').click(); + await page.getByPlaceholder('Weight').fill('0.5'); + await page.getByLabel('Essentials').click(); + await page.getByRole('button', { name: 'Add Item' }).click(); + + // Verify the error message for the empty item name + const itemNameErrorMessage = page.locator('text=Required'); + await expect(itemNameErrorMessage).toBeVisible({ timeout: 10000 }); // Adjust the timeout as needed +}); + + diff --git a/packages/playwright/tests/invld_add_item_weight.spec.js b/packages/playwright/tests/invld_add_item_weight.spec.js new file mode 100644 index 000000000..479165e0c --- /dev/null +++ b/packages/playwright/tests/invld_add_item_weight.spec.js @@ -0,0 +1,28 @@ +import { test, expect } from '@playwright/test'; + +test('Add Item without weight shows required error', async ({ page }) => { + test.setTimeout(60000); + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: 'Packs' }).click(); + await page.goto('https://packrat.world/packs'); + await page.getByRole('link', { name: 'Quantity field' }).click(); + await page.getByRole('button', { name: 'Add Item' }).click(); + await page.getByPlaceholder('Item Name').fill('A'); + await page.getByPlaceholder('Quantity').click(); + await page.getByPlaceholder('Quantity').fill('1'); + await page.getByLabel('Essentials').click(); + await page.getByRole('button', { name: 'Add Item' }).click(); + + // Verify the error message for the empty item name + const itemNameErrorMessage = page.locator('text=Required'); + await expect(itemNameErrorMessage).toBeVisible({ timeout: 10000 }); // Adjust the timeout as needed +}); + + diff --git a/packages/playwright/tests/pack-name-already-exist.spec.js b/packages/playwright/tests/pack-name-already-exist.spec.js new file mode 100644 index 000000000..8895a2832 --- /dev/null +++ b/packages/playwright/tests/pack-name-already-exist.spec.js @@ -0,0 +1,23 @@ +import { test, expect } from '@playwright/test'; + +test('Pack name already exists', async ({ page }) => { + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByText('Create a Pack').click(); + await page.getByPlaceholder('Name').click(); + await page.getByPlaceholder('Name').fill('hit'); + await page.getByRole('button', { name: 'Add Pack' }).click(); + + // Verify the error message for invalid email format + const nameErrorMessage = page.locator('text=A pack with the same name already exists'); + await expect(nameErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed + + const packnameErrorMessage = page.locator('text=Pack already exists'); + await expect(packnameErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed + +}); \ No newline at end of file diff --git a/packages/playwright/tests/upd_prof_empty_email.spec.js b/packages/playwright/tests/upd_prof_empty_email.spec.js new file mode 100644 index 000000000..4211aaa05 --- /dev/null +++ b/packages/playwright/tests/upd_prof_empty_email.spec.js @@ -0,0 +1,22 @@ +import { test, expect } from '@playwright/test'; + +test('Update profile without email shows error message', async ({ page }) => { + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Profile' }).click(); + await page.goto('https://packrat.world/profile'); + await page.getByRole('button', { name: '󰢻' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill(''); + await page.getByRole('button', { name: 'Update profile' }).click(); + + // Verify the error message for the empty name field + const nameErrorMessage = page.locator('text=Invalid email'); + await expect(nameErrorMessage).toBeVisible({ timeout: 10000 }); // Adjust the timeout as needed +}); \ No newline at end of file diff --git a/packages/playwright/tests/upd_prof_empty_usrnme.spec.js b/packages/playwright/tests/upd_prof_empty_usrnme.spec.js new file mode 100644 index 000000000..95e379c6b --- /dev/null +++ b/packages/playwright/tests/upd_prof_empty_usrnme.spec.js @@ -0,0 +1,22 @@ +import { test, expect } from '@playwright/test'; + +test('Update profile without username shows error message', async ({ page }) => { + await page.goto('https://packrat.world/'); + await page.getByRole('link', { name: 'Get Started' }).click(); + await page.getByLabel('Email').click(); + await page.getByLabel('Email').fill('zoot3@email.com'); + await page.getByLabel('Password').click(); + await page.getByLabel('Password').fill('12345678'); + await page.getByRole('button', { name: 'Sign In' }).click(); + await page.getByRole('button', { name: 'Menu' }).hover(); + await page.getByRole('button', { name: ' Profile' }).click(); + await page.goto('https://packrat.world/profile'); + await page.getByRole('button', { name: '󰢻' }).click(); + await page.getByLabel('Username').click(); + await page.getByLabel('Username').fill(''); + await page.getByRole('button', { name: 'Update profile' }).click(); + + // Verify the error message for the empty name field + const nameErrorMessage = page.locator('text=String must contain at least 1 character(s)'); + await expect(nameErrorMessage).toBeVisible({ timeout: 10000 }); // Adjust the timeout as needed +}); \ No newline at end of file