Skip to content

Commit

Permalink
First demo - Commit with all test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lescobar-c1 committed Aug 19, 2024
1 parent ba4eac6 commit 9969244
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 7 deletions.
2 changes: 1 addition & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
},
Expand Down
4 changes: 2 additions & 2 deletions tests/1on1-interactions.test.js
Original file line number Diff line number Diff line change
@@ -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('/');
Expand Down
4 changes: 2 additions & 2 deletions tests/Eng-status.test.js
Original file line number Diff line number Diff line change
@@ -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('/');
Expand Down
4 changes: 2 additions & 2 deletions tests/Job-update.test.js
Original file line number Diff line number Diff line change
@@ -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('/');
Expand Down
61 changes: 61 additions & 0 deletions tests/Linkedin.test.js
Original file line number Diff line number Diff line change
@@ -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');
});
38 changes: 38 additions & 0 deletions tests/interaction-history.test.js
Original file line number Diff line number Diff line change
@@ -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.');
});

0 comments on commit 9969244

Please sign in to comment.