diff --git a/playwright.config.js b/playwright.config.js index e1b29f1..3b58a9d 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -10,7 +10,7 @@ module.exports = defineConfig({ reporter: [['line'], ['allure-playwright']], use: { baseURL: 'https://expert.correlation-one.com/', - headless: true, + headless: false, //slowMo: 1000, // Slows down Playwright operations by 1000ms // trace: 'on-first-retry', //Enables trace collection on the first retry of a failed test. }, diff --git a/tests/1on1-interactions.test.js b/tests/1on1-interactions.test.js index c110f48..568f492 100644 --- a/tests/1on1-interactions.test.js +++ b/tests/1on1-interactions.test.js @@ -1,8 +1,8 @@ const { test, expect } = require('@playwright/test'); const { login } = require('../utils/login'); -test('Add fellow update and interaction', async ({ page }) => { - console.log('Starting test: Add fellow update and interaction'); +test('Creating a 1:1 interactions for a fellow', async ({ page }) => { + console.log('Starting test'); // Navigate to the website await page.goto('/'); diff --git a/tests/Eng-status.test.js b/tests/Eng-status.test.js index f417bc8..8e40d6c 100644 --- a/tests/Eng-status.test.js +++ b/tests/Eng-status.test.js @@ -1,8 +1,8 @@ const { test, expect } = require('@playwright/test'); const { login } = require('../utils/login'); -test('Engagement status', async ({ page }) => { - console.log('Starting test: Add fellow update and interaction'); +test('Creating Engagement status update', async ({ page }) => { + console.log('Starting test'); // Navigate to the website await page.goto('/'); diff --git a/tests/Job-update.test.js b/tests/Job-update.test.js index a3cc51c..d65b46a 100644 --- a/tests/Job-update.test.js +++ b/tests/Job-update.test.js @@ -1,8 +1,8 @@ const { test, expect } = require('@playwright/test'); const { login } = require('../utils/login'); -test('Engagement status', async ({ page }) => { - console.log('Starting test: Add fellow update and interaction'); +test('Creating Job Search status update', async ({ page }) => { + console.log('Starting test'); // Navigate to the website await page.goto('/'); diff --git a/tests/Linkedin.test.js b/tests/Linkedin.test.js new file mode 100644 index 0000000..369bab6 --- /dev/null +++ b/tests/Linkedin.test.js @@ -0,0 +1,61 @@ +const { test, expect } = require('@playwright/test'); +const { login } = require('../utils/login'); + +test('Fellow LinkedIn creation/update', async ({ page }) => { + console.log('Starting test'); + + // Function to generate a random string of characters + function generateRandomString(length) { + const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; + let result = ''; + for (let i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * characters.length)); + } + return result; + } + + // Navigate to the website + await page.goto('/'); + console.log('Navigated to homepage'); + + // Check if the page title contains 'Sign In with Auth0' + await expect(page).toHaveTitle(/Sign In with Auth0/); + console.log('Title verified'); + + // Perform login + await login(page); + await expect(page).toHaveTitle(/Expert Client/); + const postLoginTitle = await page.title(); + console.log('Page title after login:', postLoginTitle); + console.log('Login Successful'); + + // Click on 'Add fellow update' button + await page.getByRole('button', { name: 'Add fellow update' }).click(); + console.log('Clicked on Add fellow update button'); + + // Search and select fellow + await page.getByPlaceholder('Search fellow by name').click(); + await page.getByPlaceholder('Search fellow by name').fill(''); + await page.getByRole('option', { name: 'Engineer Test' }).click(); + console.log('Selected fellow: Engineer Test'); + + // Click Next + await page.getByRole('button', { name: 'Next' }).click(); + console.log('Proceeded to next step'); + + // Generate a random LinkedIn link + const randomLinkedInLink = `https://www.linkedin.com/in/${generateRandomString(8)}-test-${generateRandomString(8)}/`; + + // Fill the textbox with the generated LinkedIn link + const textbox = page.getByRole('textbox'); + await textbox.fill(randomLinkedInLink); + console.log('Filled textbox with generated LinkedIn link:', randomLinkedInLink); + + // Assertion to check that the correct link was filled + await expect(textbox).toHaveValue(randomLinkedInLink); + console.log('Assertion passed: The correct link was filled in the textbox.'); + + // Click Save + await page.getByRole('button', { name: 'Save' }).click(); + console.log('Clicked Save button'); +}); diff --git a/tests/interaction-history.test.js b/tests/interaction-history.test.js new file mode 100644 index 0000000..ce72102 --- /dev/null +++ b/tests/interaction-history.test.js @@ -0,0 +1,38 @@ +const { test, expect } = require('@playwright/test'); +const { login } = require('../utils/login'); + +test('Review Fellow interaction History', async ({ page }) => { + console.log('Starting test'); + // Navigate to the website + await page.goto('/'); + console.log('Navigated to homepage'); + + // Check if the page title contains 'Sign In with Auth0' + await expect(page).toHaveTitle(/Sign In with Auth0/); + console.log('Title verified'); + + // Perform login + await login(page); + await expect(page).toHaveTitle(/Expert Client/); + const postLoginTitle = await page.title(); + console.log('Page title after login:', postLoginTitle); + console.log('Login Successful'); + + // Click on gridcell 'Engineer Test' + const gridCell = page.getByRole('gridcell', { name: 'Engineer Test' }); + await expect(gridCell).toBeVisible(); + await gridCell.click(); + console.log('Assertion passed: Engineer Test gridcell is visible and clicked.'); + + // Click on 'Interactions' + const interactionsLabel = page.getByLabel('Interactions'); + await expect(interactionsLabel).toBeVisible(); + await interactionsLabel.click(); + console.log('Assertion passed: Interactions label is visible and clicked.'); + + // Click on 'Status' inside the fellow drawer + const statusLabel = page.getByTestId('fellow-drawer').getByLabel('Status'); + await expect(statusLabel).toBeVisible(); + await statusLabel.click(); + console.log('Assertion passed: Status label inside fellow drawer is visible and clicked.'); +});