Skip to content

Commit

Permalink
adding new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JewelTee committed Aug 7, 2024
1 parent 9cebdd7 commit 0bee0d2
Show file tree
Hide file tree
Showing 12 changed files with 238 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/playwright/tests/chg_pwd_attempt.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { test, expect } from '@playwright/test';
test.setTimeout(60000);

test('change password with mismatched new password and confirmation 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('[email protected]');
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.getByLabel('Confirm new password').click();
await page.getByLabel('Confirm new password').fill('98765432');
await page.getByRole('button', { name: 'Change password' }).click();

// Verify the error message for invalid email format
const passwordErrorMessage = page.locator('text=New password and confirmation must match');
await expect(passwordErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed
});
22 changes: 22 additions & 0 deletions packages/playwright/tests/delete_account_error.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { test, expect } from '@playwright/test';
test.setTimeout(60000);

test('delete account error', 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('[email protected]');
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.getByRole('button', { name: 'Delete account' }).click();


// Verify the error message for invalid email format
const emailErrorMessage = page.locator('text= Invalid literal value, expected "delete"');
await expect(emailErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed
});
16 changes: 16 additions & 0 deletions packages/playwright/tests/empty_email.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';

test('invalid login with empty email shows error message', async ({ page }) => {
await page.goto('https://packrat.pages.dev/');
await page.getByRole('link', { name: 'Get Started' }).click();

await page.locator('input[type="email"]').click();
await page.locator('input[type="email"]').fill("");
await page.locator('input[type="password"]').click();
await page.locator('input[type="password"]').fill('12345678');
await page.getByRole('button', { name: 'Sign In' }).click();

// Verify the error message for invalid email format
const emailErrorMessage = page.locator('text=Email is required');
await expect(emailErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed
});
17 changes: 17 additions & 0 deletions packages/playwright/tests/empty_email_pwd.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test, expect } from '@playwright/test';

test('invalid login with empty fields shows error message', async ({ page }) => {
await page.goto('https://packrat.world/');
await page.getByRole('link', { name: 'Get Started' }).click();

await page.getByRole('button', { name: 'Sign In' }).click();


// Verify the error message for invalid email format
const emailErrorMessage = page.locator('text=Email is required');
await expect(emailErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed

// 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
});
16 changes: 16 additions & 0 deletions packages/playwright/tests/incorr_pwd.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';

test('invalid login with incorrect password shows error message', async ({ page }) => {
await page.goto('https://packrat.world//');
await page.getByRole('link', { name: 'Get Started' }).click();

await page.locator('input[type="email"]').click();
await page.locator('input[type="email"]').fill('[email protected]');
await page.locator('input[type="password"]').click();
await page.locator('input[type="password"]').fill('1234567');
await page.getByRole('button', { name: 'Sign In' }).click();

// Verify the error message for invalid email format
const passwordErrorMessage = page.locator('text=User not found');
await expect(passwordErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed
});
30 changes: 30 additions & 0 deletions packages/playwright/tests/invld_add_item.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { test, expect } from '@playwright/test';

test('Add Item without item name 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('[email protected]');
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('');
await page.getByPlaceholder('Weight').click();
await page.getByPlaceholder('Weight').fill('0.5');
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
});


23 changes: 23 additions & 0 deletions packages/playwright/tests/invld_pack_create.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { test, expect } from '@playwright/test';

test('Add Pack without name 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('[email protected]');
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('');
await page.getByRole('switch').click();
await page.getByRole('button', { name: 'Add Pack' }).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
});


14 changes: 14 additions & 0 deletions packages/playwright/tests/login_empty_pwd.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test';

test('invalid login with empty password format shows error message', async ({ page }) => {
await page.goto('https://packrat.world/');
await page.getByRole('link', { name: 'Get Started' }).click();

await page.locator('input[type="email"]').click();
await page.locator('input[type="email"]').fill("[email protected]");
await page.getByRole('button', { name: 'Sign In' }).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
});
16 changes: 16 additions & 0 deletions packages/playwright/tests/login_incorr_email.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';

test('invalid login with incorrect email shows error message', async ({ page }) => {
await page.goto('https://packrat.pages.dev/');
await page.getByRole('link', { name: 'Get Started' }).click();

await page.locator('input[type="email"]').click();
await page.locator('input[type="email"]').fill('[email protected]');
await page.locator('input[type="password"]').click();
await page.locator('input[type="password"]').fill('12345678');
await page.getByRole('button', { name: 'Sign In' }).click();

// Verify the error message for invalid email format
const emailErrorMessage = page.locator('text=User not found');
await expect(emailErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed
});
19 changes: 19 additions & 0 deletions packages/playwright/tests/reg_empty_name.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { test, expect } from '@playwright/test';

test('Register new account name field empty', async ({ page }) => {
await page.goto('https://packrat.world/');
await page.getByRole('link', { name: 'Get Started' }).click();
await page.getByRole('link', { name: 'Don\'t have an account? Sign up' }).click();
await page.locator('input[type="email"]').click();
await page.locator('input[type="email"]').fill('[email protected]');
await page.getByRole('textbox').nth(2).click();
await page.getByRole('textbox').nth(2).fill('admin123');
await page.locator('input[type="password"]').click();
await page.locator('input[type="password"]').fill('12345678');
await page.getByRole('button', { name: 'Sign Up' }).click();

// Verify the error message for the empty name field
const nameErrorMessage = page.locator('text=Required');
await expect(nameErrorMessage).toBeVisible({ timeout: 10000 }); // Adjust the timeout as needed
});

22 changes: 22 additions & 0 deletions packages/playwright/tests/upd_prof_empty_name.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { test, expect } from '@playwright/test';

test('Update profile without name 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('[email protected]');
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.locator('#name').click();
await page.locator('#name').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
});
16 changes: 16 additions & 0 deletions packages/playwright/tests/wrong_pwd_fmt.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';

test('invalid login with wrong password format shows error message', async ({ page }) => {
await page.goto('https://packrat.world/');
await page.getByRole('link', { name: 'Get Started' }).click();

await page.locator('input[type="email"]').click();
await page.locator('input[type="email"]').fill('[email protected]');
await page.locator('input[type="password"]').click();
await page.locator('input[type="password"]').fill('12345');
await page.getByRole('button', { name: 'Sign In' }).click();

// Verify the error message for invalid email format
const passwordErrorMessage = page.locator('text=String must contain at least 7 character(s)');
await expect(passwordErrorMessage).toBeVisible({ timeout: 50000 }); // Adjust the timeout as needed
});

0 comments on commit 0bee0d2

Please sign in to comment.