Skip to content

Commit b206434

Browse files
authored
servingPlusTests (#342)
1 parent 0027416 commit b206434

File tree

4 files changed

+1238
-0
lines changed

4 files changed

+1238
-0
lines changed

tests/dashboard.spec.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { test, expect } from '@playwright/test';
2+
import { login } from './helpers/auth';
3+
4+
// OCTAVIAN/OCTAVIUS are the names used for testing. If you see Octavian or Octavius entered anywhere, it is a result of these tests.
5+
test.describe('Dashboard Management', () => {
6+
test.beforeEach(async ({ page }) => {
7+
await login(page);
8+
const menuBtn = page.locator('[id="primaryNavButton"]').getByText('expand_more');
9+
await menuBtn.click();
10+
const dashboardHomeBtn = page.locator('[data-testid="nav-item-dashboard"]');
11+
await dashboardHomeBtn.click();
12+
await page.waitForTimeout(5000);
13+
});
14+
15+
/* test('should load dashboard', async ({ page }) => {
16+
const dashboardHeader = page.locator('h4').getByText('B1.church Dashboard');
17+
await dashboardHeader.click();
18+
}); */
19+
20+
test('should load group from dashboard', async ({ page }) => {
21+
const firstGroup = page.locator('h6').first();
22+
await firstGroup.click();
23+
await page.waitForTimeout(2000);
24+
await expect(page).toHaveURL(/\/groups\/GRP\d+/);
25+
});
26+
27+
test('should search people from dashboard', async ({ page }) => {
28+
const searchBox = page.locator('[id="searchText"]');
29+
await searchBox.fill('Dorothy Jackson');
30+
const searchBtn = page.locator('[data-testid="dashboard-search-button"]');
31+
await searchBtn.click();
32+
await page.waitForTimeout(500);
33+
const results = page.locator('h6').getByText('Dorothy Jackson');
34+
await results.click();
35+
await page.waitForTimeout(2000);
36+
await expect(page).toHaveURL(/\/people\/PER\d+/);
37+
const validatedName = page.locator('p').getByText('Dorothy Jackson');
38+
await expect(validatedName).toHaveCount(1);
39+
});
40+
41+
test('should add task from dashboard', async ({ page }) => {
42+
const addBtn = page.locator('[data-testid="add-task-button"]');
43+
await addBtn.click();
44+
const assignInput = page.locator('input').nth(2);
45+
await assignInput.click();
46+
const personSearch = page.locator('[name="personAddText"]');
47+
await personSearch.fill('Demo User');
48+
const searchBtn = page.locator('[data-testid="search-button"]');
49+
await searchBtn.click();
50+
const selectBtn = page.locator('button').getByText('Select');
51+
await selectBtn.click();
52+
const taskName = page.locator('[name="title"]');
53+
await taskName.fill('Test Task');
54+
const taskNotes = page.locator('[name="note"]');
55+
await taskNotes.fill('Octavian Testing (Playwright)');
56+
const saveBtn = page.locator('button').getByText('Save');
57+
await saveBtn.click();
58+
await page.waitForTimeout(500);
59+
const validatedTask = page.locator('a').getByText('Test Task');
60+
await expect(validatedTask).toHaveCount(2);
61+
});
62+
63+
test('should load task from dashboard', async ({ page }) => {
64+
const task = page.locator('a').getByText('Test Task').first();
65+
await task.click();
66+
await page.waitForTimeout(2000);
67+
await expect(page).toHaveURL(/\/tasks\/[^/]+/);
68+
});
69+
70+
test('should cancel adding task from dashboard', async ({ page }) => {
71+
const addBtn = page.locator('[data-testid="add-task-button"]');
72+
await addBtn.click();
73+
const assignInput = page.locator('input').nth(2);
74+
await expect(assignInput).toHaveCount(1);
75+
const cancelBtn = page.locator('button').getByText('Cancel');
76+
await cancelBtn.click();
77+
await page.waitForTimeout(500);
78+
await expect(assignInput).toHaveCount(0);
79+
});
80+
81+
});

0 commit comments

Comments
 (0)