added codebase, project rules and sec audit
This commit is contained in:
74
NearBeach/tests/e2e/403_tests/team-leader-403-tests.spec.ts
Normal file
74
NearBeach/tests/e2e/403_tests/team-leader-403-tests.spec.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
//Log the user in
|
||||
test.use({
|
||||
storageState: 'tests/.auth/team_leader.json',
|
||||
});
|
||||
|
||||
//Check that the user is logged in
|
||||
test("Checking Team Leader 403", async({ page }): Promise<void> => {
|
||||
await page.goto("localhost:8000");
|
||||
|
||||
//Make sure we are on the dashboard page
|
||||
await expect(page).toHaveTitle("NearBeach Dashboard");
|
||||
});
|
||||
|
||||
type PageArrayType = {
|
||||
test: string,
|
||||
url: string
|
||||
}
|
||||
|
||||
const page_array : PageArrayType[] = [
|
||||
{test:'Team Leader - 403 - Card Information 1',url :'http://localhost:8000/card_information/1/'},
|
||||
{test:'Team Leader - 403 - Change Task Information 1',url :'http://localhost:8000/change_task_information/1/'},
|
||||
{test:'Team Leader - 403 - Diagnostic Information',url :'http://localhost:8000/diagnostic_information/'},
|
||||
{test:'Team Leader - 403 - Group Information 1',url :'http://localhost:8000/group_information/1/'},
|
||||
{test:'Team Leader - 403 - Kanban Information 1',url :'http://localhost:8000/kanban_information/1/'},
|
||||
{test:'Team Leader - 403 - Kanban Card Information 1',url :'http://localhost:8000/kanban_information/1/card/1/'},
|
||||
{test:'Team Leader - 403 - Kanban Information Edit Board 1',url :'http://localhost:8000/kanban_information/1/edit_board/'},
|
||||
{test:'Team Leader - 403 - New Group',url :'http://localhost:8000/new_group/'},
|
||||
{test:'Team Leader - 403 - New Notification',url :'http://localhost:8000/new_notification/'},
|
||||
{test:'Team Leader - 403 - New Permission Set',url :'http://localhost:8000/new_permission_set/'},
|
||||
{test:'Team Leader - 403 - New User',url :'http://localhost:8000/new_user/'},
|
||||
{test:'Team Leader - 403 - Notification Information',url :'http://localhost:8000/notification_information/1/'},
|
||||
{test:'Team Leader - 403 - Object Status Editor Requirements',url :'http://localhost:8000/object_status_information/requirement/'},
|
||||
{test:'Team Leader - 403 - Object Status Requirement Item',url :'http://localhost:8000/object_status_information/requirement_item/'},
|
||||
{test:'Team Leader - 403 - Object Status Project',url :'http://localhost:8000/object_status_information/project/'},
|
||||
{test:'Team Leader - 403 - Object Status Task',url :'http://localhost:8000/object_status_information/task/'},
|
||||
{test:'Team Leader - 403 - Object Status List',url :'http://localhost:8000/object_status_list/'},
|
||||
{test:'Team Leader - 403 - Permission Set Information 1',url :'http://localhost:8000/permission_set_information/1/'},
|
||||
{test:'Team Leader - 403 - Project Information 1',url :'http://localhost:8000/project_information/1/'},
|
||||
{test:'Team Leader - 403 - Requirement Information 1',url :'http://localhost:8000/requirement_information/1/'},
|
||||
{test:'Team Leader - 403 - Requirement Item Information 1',url :'http://localhost:8000/requirement_item_information/1/'},
|
||||
{test:'Team Leader - 403 - RFC Information 1',url :'http://localhost:8000/rfc_information/1/'},
|
||||
{test:'Team Leader - 403 - Sprint Information',url :'http://localhost:8000/sprint_information/1/'},
|
||||
{test:'Team Leader - 403 - Task Information 1',url :'http://localhost:8000/task_information/1/'},
|
||||
{test:'Team Leader - 403 - User Information 1',url :'http://localhost:8000/user_information/1/'},
|
||||
]
|
||||
|
||||
//Loop through page_array
|
||||
page_array.forEach((row : PageArrayType): void => {
|
||||
test(row.test, async({page}) : Promise<void> => {
|
||||
//Make sure there are 403 errors
|
||||
page.on("response", data => {
|
||||
if (data.url() === row.url) {
|
||||
if (data.ok()) {
|
||||
test.info().annotations.push({
|
||||
type: "Response Status is OK",
|
||||
description: "User should not have any access to page",
|
||||
});
|
||||
}
|
||||
if (data.status() !== 403) {
|
||||
test.info().annotations.push({
|
||||
type: "Status not 403",
|
||||
description: `Url: ${data.url()} || Status: ${data.status()}`,
|
||||
});
|
||||
}
|
||||
expect.soft(data.ok()).toBeFalsy();
|
||||
}
|
||||
});
|
||||
|
||||
//Go to url
|
||||
await page.goto(row.url);
|
||||
});
|
||||
});
|
||||
42
NearBeach/tests/e2e/auth.setup.ts
Normal file
42
NearBeach/tests/e2e/auth.setup.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { test as setup } from '@playwright/test';
|
||||
|
||||
// Auth File location
|
||||
// const authFile : string = "tests/.auth/user.json";
|
||||
|
||||
// User credentials
|
||||
// const username : string = 'dark_admin';
|
||||
// const password: string = 'Test1234$';
|
||||
|
||||
type credentialsType = {
|
||||
username: string,
|
||||
password: string,
|
||||
authFile: string,
|
||||
};
|
||||
|
||||
const credentials : credentialsType[] = [
|
||||
{ username: 'admin', password: 'Test1234$', authFile: 'tests/.auth/admin.json' },
|
||||
{ username: 'dark_admin', password: 'Test1234$', authFile: 'tests/.auth/dark_admin.json' },
|
||||
{ username: 'team_leader', password: 'Test1234$', authFile: 'tests/.auth/team_leader.json' },
|
||||
{ username: 'team_member', password: 'Test1234$', authFile: 'tests/.auth/team_member.json' },
|
||||
{ username: 'read_only', password: 'Test1234$', authFile: 'tests/.auth/read_only.json' },
|
||||
]
|
||||
|
||||
|
||||
Promise.all(credentials.map(async (single : credentialsType) : Promise<void> => {
|
||||
setup(`Authenticate the user ${single.username}`, async ({ page }) : Promise<void> => {
|
||||
//Loop through the credentials list - and login
|
||||
// Go to login page
|
||||
await page.goto('http://localhost:8000/login');
|
||||
|
||||
// Type in username and password
|
||||
await page.locator("#id_auth-username").fill(single.username);
|
||||
await page.locator("#id_auth-password").fill(single.password);
|
||||
|
||||
// Sign in time
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
|
||||
// Wait for page to login and then save the cookies
|
||||
await page.waitForURL('http://localhost:8000/');
|
||||
await page.context().storageState({ path: single.authFile });
|
||||
});
|
||||
}));
|
||||
109
NearBeach/tests/e2e/shakeout/check-every-page-load-admin.spec.ts
Normal file
109
NearBeach/tests/e2e/shakeout/check-every-page-load-admin.spec.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
//Log the user in
|
||||
test.use({
|
||||
storageState: 'tests/.auth/admin.json',
|
||||
});
|
||||
|
||||
//Check that the user is logged in
|
||||
test("Make sure user is logged in", async({ page }) : Promise<void> => {
|
||||
await page.goto("localhost:8000");
|
||||
|
||||
//Make sure we are on the login page
|
||||
await expect(page).toHaveTitle("NearBeach Dashboard");
|
||||
});
|
||||
|
||||
const page_array = [
|
||||
{test:'Admin - Card Information 1',url :'http://localhost:8000/card_information/1/', page_title:'Kanban Information 1',page_heading:'Kanban Admin Only',screenshot_path:'./test-results/shakeout/admin/Kanban Admin Only.jpg'},
|
||||
{test:'Admin - Change Task Information 1',url :'http://localhost:8000/change_task_information/1/', page_title:'Change Task 1',page_heading:'Change Task - 1',screenshot_path:'./test-results/shakeout/admin/Change Task - 1.jpg'},
|
||||
{test:'Admin - Customer Information 1',url :'http://localhost:8000/customer_information/1/', page_title:'Customer Information 1',page_heading:'Customer Information',screenshot_path:'./test-results/shakeout/admin/Customer Information.jpg'},
|
||||
{test:'Admin - Diagnostic Information',url :'http://localhost:8000/diagnostic_information/', page_title:'Diagnostic Information',page_heading:'Diagnostic Information',screenshot_path:'./test-results/shakeout/admin/Diagnostic Information.jpg'},
|
||||
{test:'Admin - Group Information 1',url :'http://localhost:8000/group_information/1/', page_title:'Group Information 1',page_heading:'Group Information',screenshot_path:'./test-results/shakeout/admin/Group Information.jpg'},
|
||||
{test:'Admin - Kanban Information 1',url :'http://localhost:8000/kanban_information/1/', page_title:'Kanban Information 1',page_heading:'Kanban Admin Only',screenshot_path:'./test-results/shakeout/admin/Kanban Information.jpg'},
|
||||
{test:'Admin - Kanban Card Information 1',url :'http://localhost:8000/kanban_information/1/card/1/', page_title:'Kanban Information 1',page_heading:'Kanban Admin Only',screenshot_path:'./test-results/shakeout/admin/Kanban Admin Only.jpg'},
|
||||
{test:'Admin - Kanban Information Edit Board 1',url :'http://localhost:8000/kanban_information/1/edit_board/', page_title:'Kanban Information 1',page_heading:'Kanban Admin Only',screenshot_path:'./test-results/shakeout/admin/Kanban Edit Board.jpg'},
|
||||
{test:'Admin - New Group',url :'http://localhost:8000/new_group/', page_title:'New Group',page_heading:'New Group',screenshot_path:'./test-results/shakeout/admin/New Group.jpg'},
|
||||
{test:'Admin - New Kanban',url :'http://localhost:8000/new_kanban/', page_title:'New Kanban',page_heading:'New Kanban',screenshot_path:'./test-results/shakeout/admin/New Kanban.jpg'},
|
||||
{test:'Admin - New Notification',url :'http://localhost:8000/new_notification/', page_title:'New Notification',page_heading:'New Notification',screenshot_path:'./test-results/shakeout/admin/New Notification.jpg'},
|
||||
{test:'Admin - New Organisation',url :'http://localhost:8000/new_organisation/', page_title:'New Organisation',page_heading:'New Organisation',screenshot_path:'./test-results/shakeout/admin/New Organisation.jpg'},
|
||||
{test:'Admin - New Permission Set',url :'http://localhost:8000/new_permission_set/', page_title:'New Permission Set',page_heading:'New Permission Set',screenshot_path:'./test-results/shakeout/admin/New Permission Set.jpg'},
|
||||
{test:'Admin - New Project',url :'http://localhost:8000/new_project/', page_title:'New Project',page_heading:'New Project',screenshot_path:'./test-results/shakeout/admin/New Project.jpg'},
|
||||
{test:'Admin - New Request for Change',url :'http://localhost:8000/new_request_for_change/', page_title:'New RFC',page_heading:'New Request for Change',screenshot_path:'./test-results/shakeout/admin/New Request for Change.jpg'},
|
||||
{test:'Admin - New Requirement',url :'http://localhost:8000/new_requirement/', page_title:'New Requirements',page_heading:'New Requirement',screenshot_path:'./test-results/shakeout/admin/New Requirement.jpg'},
|
||||
{test:'Admin - New Task',url :'http://localhost:8000/new_task/', page_title:'New Task',page_heading:'New Task',screenshot_path:'./test-results/shakeout/admin/New Task.jpg'},
|
||||
{test:'Admin - New User',url :'http://localhost:8000/new_user/', page_title:'New User',page_heading:'New User',screenshot_path:'./test-results/shakeout/admin/New User.jpg'},
|
||||
{test:'Admin - Notification Information',url :'http://localhost:8000/notification_information/1/', page_title:'Notification 1',page_heading:'Notification Information',screenshot_path:'./test-results/shakeout/admin/Notification Information.jpg'},
|
||||
{test:'Admin - Object Status Editor Requirements',url :'http://localhost:8000/object_status_information/requirement/', page_title:'Requirement Status Editor',page_heading:'Requirement Status Editor',screenshot_path:'./test-results/shakeout/admin/Requirement Status Editor.jpg'},
|
||||
{test:'Admin - Object Status Requirement Item',url :'http://localhost:8000/object_status_information/requirement_item/', page_title:'Requirement Item Status Editor',page_heading:'Requirement Item Status Editor',screenshot_path:'./test-results/shakeout/admin/Requirement Item Status Editor.jpg'},
|
||||
{test:'Admin - Object Status Project',url :'http://localhost:8000/object_status_information/project/', page_title:'Project Status Editor',page_heading:'Project Status Editor',screenshot_path:'./test-results/shakeout/admin/Project Status Editor.jpg'},
|
||||
{test:'Admin - Object Status Task',url :'http://localhost:8000/object_status_information/task/', page_title:'Task Status Editor',page_heading:'Task Status Editor',screenshot_path:'./test-results/shakeout/admin/Task Status Editor.jpg'},
|
||||
{test:'Admin - Object Status List',url :'http://localhost:8000/object_status_list/', page_title:'Object Status List',page_heading:'Object Status List',screenshot_path:'./test-results/shakeout/admin/Object Status List Information.jpg'},
|
||||
{test:'Admin - Organisation Information 1',url :'http://localhost:8000/organisation_information/1/', page_title:'Organisation Information 1',page_heading:'Organisation Information',screenshot_path:'./test-results/shakeout/admin/Organisation Information.jpg'},
|
||||
{test:'Admin - Permission Set Information 1',url :'http://localhost:8000/permission_set_information/1/', page_title:'Permission Set 1',page_heading:'Permission Information',screenshot_path:'./test-results/shakeout/admin/Permission Set Information.jpg'},
|
||||
{test:'Admin - Profile Information',url :'http://localhost:8000/profile_information/', page_title:'Profile Information',page_heading:'My Profile',screenshot_path:'./test-results/shakeout/admin/Profile Information.jpg'},
|
||||
{test:'Admin - Project Information 1',url :'http://localhost:8000/project_information/1/', page_title:'Project Information 1',page_heading:'Project Information',screenshot_path:'./test-results/shakeout/admin/Project Information.jpg'},
|
||||
{test:'Admin - Requirement Information 1',url :'http://localhost:8000/requirement_information/1/', page_title:'Requirement Information 1',page_heading:'Requirement Information',screenshot_path:'./test-results/shakeout/admin/Requirement Information.jpg'},
|
||||
{test:'Admin - Requirement Item Information 1',url :'http://localhost:8000/requirement_item_information/1/', page_title:'Requirement Item 1',page_heading:'Requirement Item Information',screenshot_path:'./test-results/shakeout/admin/Requirement Item Information.jpg'},
|
||||
{test:'Admin - RFC Information 1',url :'http://localhost:8000/rfc_information/1/', page_title:'RFC 1',page_heading:'Request for Change',screenshot_path:'./test-results/shakeout/admin/RFC Information.jpg'},
|
||||
{test:'Admin - Search',url :'http://localhost:8000/search/', page_title:'Search',page_heading:'Search',screenshot_path:'./test-results/shakeout/admin/Search.jpg'},
|
||||
{test:'Admin - Search Notifications',url :'http://localhost:8000/search/notification/', page_title:'Search Notifications',page_heading:'Search Notifications',screenshot_path:'./test-results/shakeout/admin/Search Notifications.jpg'},
|
||||
{test:'Admin - Search Sprint',url :'http://localhost:8000/search/sprint/', page_title: "Search Sprints", page_heading: "Search Sprints", screenshot_path:'./test-results/shakeout/team-leader/Search Sprint.jpg'},
|
||||
{test:'Admin - Sprint Information',url :'http://localhost:8000/sprint_information/1/', page_title: "Sprint Information 1", page_heading: "project-1 - Sprint 1 - 18 Mar 2024", screenshot_path:'./test-results/shakeout/team-leader/Sprint Information 2.jpg'},
|
||||
{test:'Admin - Task Information 1',url :'http://localhost:8000/task_information/1/', page_title:'Task Information 1',page_heading:'Task Information',screenshot_path:'./test-results/shakeout/admin/Task Information.jpg'},
|
||||
{test:'Admin - User Information 1',url :'http://localhost:8000/user_information/1/', page_title:'User Information 1',page_heading:'User Information',screenshot_path:'./test-results/shakeout/admin/User Information.jpg'},
|
||||
{test:'Admin - Scheduled Objects',url :'http://localhost:8000/scheduled_objects/', page_title:'Scheduled Objects',page_heading:'Scheduled Objects',screenshot_path:'./test-results/shakeout/admin/Scheduled Objects.jpg'},
|
||||
{test:'Admin - Scheduled Objects 1',url:'http://localhost:8000/scheduled_object_information/1/', page_title:'Scheduled Object 1',page_heading: 'Scheduled Object Information', screenshot_path: './test-results/shakeout/admin/Scheduled Objects 1.jpg'},
|
||||
]
|
||||
|
||||
//Loop through page_array
|
||||
page_array.forEach((row) => {
|
||||
test(row.test, async({ page }) : Promise<void> => {
|
||||
//Make sure there are no errors in the console
|
||||
page.on(
|
||||
"console",
|
||||
message => {
|
||||
if (message.type() === "error") {
|
||||
test.info().annotations.push({
|
||||
type: 'Console Errors',
|
||||
description: message.text()
|
||||
});
|
||||
}
|
||||
expect(message.type()).not.toBe("error");
|
||||
}
|
||||
);
|
||||
|
||||
//Make sure there are no warnings in the console
|
||||
page.on(
|
||||
"console",
|
||||
message => {
|
||||
if (message.type() === "warning") {
|
||||
test.info().annotations.push({
|
||||
type: 'Console Warnings',
|
||||
description: message.text()
|
||||
});
|
||||
}
|
||||
expect(message.type()).not.toBe("warning");
|
||||
}
|
||||
);
|
||||
|
||||
await page.goto(row.url);
|
||||
|
||||
//Make sure we are on the correct page using the title
|
||||
await expect(page).toHaveTitle(row.page_title);
|
||||
|
||||
//Make sure the VueJS loaded
|
||||
await expect(page.getByRole(
|
||||
"heading",
|
||||
{ name: row.page_heading, exact: true }
|
||||
)).toBeVisible();
|
||||
|
||||
//await expect(locator).not.toContainText('error');
|
||||
await expect(page.locator("#loader")).toHaveCount(0);
|
||||
|
||||
//Take screenshot
|
||||
await page.screenshot({
|
||||
path: row.screenshot_path,
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
//Log the user in
|
||||
test.use({
|
||||
storageState: 'tests/.auth/dark_admin.json',
|
||||
});
|
||||
|
||||
//Check that the user is logged in
|
||||
test("Checking out Dark Mode", async({ page }) : Promise<void> => {
|
||||
await page.goto("localhost:8000");
|
||||
|
||||
//Make sure we are on the login page
|
||||
await expect(page).toHaveTitle("NearBeach Dashboard");
|
||||
});
|
||||
|
||||
type PageArrayType = {
|
||||
test: string
|
||||
url: string,
|
||||
screenshot_path: string,
|
||||
};
|
||||
const page_array : PageArrayType[] = [
|
||||
{test:'Dark Admin - Card Information 1',url :'http://localhost:8000/card_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Kanban Admin Only.jpg'},
|
||||
{test:'Dark Admin - Change Task Information 1',url :'http://localhost:8000/change_task_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Change Task - 1.jpg'},
|
||||
{test:'Dark Admin - Customer Information 1',url :'http://localhost:8000/customer_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Customer Information.jpg'},
|
||||
{test:'Dark Admin - Diagnostic Information',url :'http://localhost:8000/diagnostic_information/',screenshot_path:'./test-results/shakeout/dark-admin/Diagnostic Information.jpg'},
|
||||
{test:'Dark Admin - Group Information 1',url :'http://localhost:8000/group_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Group Information.jpg'},
|
||||
{test:'Dark Admin - Kanban Information 1',url :'http://localhost:8000/kanban_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Kanban Information.jpg'},
|
||||
{test:'Dark Admin - Kanban Card Information 1',url :'http://localhost:8000/kanban_information/1/card/1/',screenshot_path:'./test-results/shakeout/dark-admin/Kanban Admin Only.jpg'},
|
||||
{test:'Dark Admin - Kanban Information Edit Board 1',url :'http://localhost:8000/kanban_information/1/edit_board/',screenshot_path:'./test-results/shakeout/dark-admin/Kanban Edit Board.jpg'},
|
||||
{test:'Dark Admin - New Group',url :'http://localhost:8000/new_group/',screenshot_path:'./test-results/shakeout/dark-admin/New Group.jpg'},
|
||||
{test:'Dark Admin - New Kanban',url :'http://localhost:8000/new_kanban/',screenshot_path:'./test-results/shakeout/dark-admin/New Kanban.jpg'},
|
||||
{test:'Dark Admin - New Notification',url :'http://localhost:8000/new_notification/',screenshot_path:'./test-results/shakeout/dark-admin/New Notification.jpg'},
|
||||
{test:'Dark Admin - New Organisation',url :'http://localhost:8000/new_organisation/',screenshot_path:'./test-results/shakeout/dark-admin/New Organisation.jpg'},
|
||||
{test:'Dark Admin - New Permission Set',url :'http://localhost:8000/new_permission_set/',screenshot_path:'./test-results/shakeout/dark-admin/New Permission Set.jpg'},
|
||||
{test:'Dark Admin - New Project',url :'http://localhost:8000/new_project/',screenshot_path:'./test-results/shakeout/dark-admin/New Project.jpg'},
|
||||
{test:'Dark Admin - New Request for Change',url :'http://localhost:8000/new_request_for_change/',screenshot_path:'./test-results/shakeout/dark-admin/New Request for Change.jpg'},
|
||||
{test:'Dark Admin - New Requirement',url :'http://localhost:8000/new_requirement/',screenshot_path:'./test-results/shakeout/dark-admin/New Requirement.jpg'},
|
||||
{test:'Dark Admin - New Task',url :'http://localhost:8000/new_task/',screenshot_path:'./test-results/shakeout/dark-admin/New Task.jpg'},
|
||||
{test:'Dark Admin - New User',url :'http://localhost:8000/new_user/',screenshot_path:'./test-results/shakeout/dark-admin/New User.jpg'},
|
||||
{test:'Dark Admin - Notification Information',url :'http://localhost:8000/notification_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Notification Information.jpg'},
|
||||
{test:'Dark Admin - Object Status Editor Requirements',url :'http://localhost:8000/object_status_information/requirement/',screenshot_path:'./test-results/shakeout/dark-admin/Requirement Status Editor.jpg'},
|
||||
{test:'Dark Admin - Object Status Requirement Item',url :'http://localhost:8000/object_status_information/requirement_item/',screenshot_path:'./test-results/shakeout/dark-admin/Requirement Item Status Editor.jpg'},
|
||||
{test:'Dark Admin - Object Status Project',url :'http://localhost:8000/object_status_information/project/',screenshot_path:'./test-results/shakeout/dark-admin/Project Status Editor.jpg'},
|
||||
{test:'Dark Admin - Object Status Task',url :'http://localhost:8000/object_status_information/task/',screenshot_path:'./test-results/shakeout/dark-admin/Task Status Editor.jpg'},
|
||||
{test:'Dark Admin - Object Status List',url :'http://localhost:8000/object_status_list/',screenshot_path:'./test-results/shakeout/dark-admin/Object Status List Information.jpg'},
|
||||
{test:'Dark Admin - Organisation Information 1',url :'http://localhost:8000/organisation_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Organisation Information.jpg'},
|
||||
{test:'Dark Admin - Permission Set Information 1',url :'http://localhost:8000/permission_set_information/1/', screenshot_path:'./test-results/shakeout/dark-admin/Permission Set Information.jpg'},
|
||||
{test:'Dark Admin - Profile Information',url :'http://localhost:8000/profile_information/',screenshot_path:'./test-results/shakeout/dark-admin/Profile Information.jpg'},
|
||||
{test:'Dark Admin - Project Information 1',url :'http://localhost:8000/project_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Project Information.jpg'},
|
||||
{test:'Dark Admin - Requirement Information 1',url :'http://localhost:8000/requirement_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Requirement Information.jpg'},
|
||||
{test:'Dark Admin - Requirement Item Information 1',url :'http://localhost:8000/requirement_item_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Requirement Item Information.jpg'},
|
||||
{test:'Dark Admin - RFC Information 1',url :'http://localhost:8000/rfc_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/RFC Information.jpg'},
|
||||
{test:'Dark Admin - Search',url :'http://localhost:8000/search/',screenshot_path:'./test-results/shakeout/dark-admin/Search.jpg'},
|
||||
{test:'Dark Admin - Search Notifications',url :'http://localhost:8000/search/notification/',screenshot_path:'./test-results/shakeout/dark-admin/Search Notifications.jpg'},
|
||||
{test:'Dark Admin - Search Sprint',url :'http://localhost:8000/search/sprint/',screenshot_path:'./test-results/shakeout/team-leader/Search Sprint.jpg'},
|
||||
{test:'Dark Admin - Sprint Information',url :'http://localhost:8000/sprint_information/1/',screenshot_path:'./test-results/shakeout/team-leader/Sprint Information 2.jpg'},
|
||||
{test:'Dark Admin - Task Information 1',url :'http://localhost:8000/task_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/Task Information.jpg'},
|
||||
{test:'Dark Admin - User Information 1',url :'http://localhost:8000/user_information/1/',screenshot_path:'./test-results/shakeout/dark-admin/User Information.jpg'},
|
||||
];
|
||||
|
||||
page_array.forEach((row : PageArrayType) => {
|
||||
test(row.test, async({ page }) : Promise<void> => {
|
||||
await page.goto(row.url);
|
||||
|
||||
//await expect(locator).not.toContainText('error');
|
||||
await expect(page.locator("#loader")).toHaveCount(0);
|
||||
|
||||
//Take screenshot
|
||||
await page.screenshot({
|
||||
path: row.screenshot_path,
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
98
NearBeach/tests/e2e/shakeout/team-leader-shakeout.spec.ts
Normal file
98
NearBeach/tests/e2e/shakeout/team-leader-shakeout.spec.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
//Log the user in
|
||||
test.use({
|
||||
storageState: 'tests/.auth/team_leader.json',
|
||||
});
|
||||
|
||||
//Check that the user is logged in
|
||||
test("Checking Team Leader Shakeout", async({ page }) : Promise<void> => {
|
||||
await page.goto("localhost:8000");
|
||||
|
||||
//Make sure we are on the dashboard page
|
||||
await expect(page).toHaveTitle("NearBeach Dashboard");
|
||||
});
|
||||
|
||||
type PageArrayType = {
|
||||
test: string
|
||||
url: string,
|
||||
screenshot_path: string,
|
||||
};
|
||||
const page_array : PageArrayType[] = [
|
||||
{test:'Team Leader - Card Information 2',url :'http://localhost:8000/card_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Kanban Admin Only.jpg'},
|
||||
{test:'Team Leader - Change Task Information 2',url :'http://localhost:8000/change_task_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Change Task - 1.jpg'},
|
||||
{test:'Team Leader - Customer Information 1',url :'http://localhost:8000/customer_information/1/',screenshot_path:'./test-results/shakeout/team-leader/Customer Information.jpg'},
|
||||
{test:'Team Leader - Kanban Information 2',url :'http://localhost:8000/kanban_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Kanban Information.jpg'},
|
||||
{test:'Team Leader - Kanban Card Information 2',url :'http://localhost:8000/kanban_information/2/card/2/',screenshot_path:'./test-results/shakeout/team-leader/Kanban Admin Only.jpg'},
|
||||
{test:'Team Leader - Kanban Information Edit Board 2',url :'http://localhost:8000/kanban_information/2/edit_board/',screenshot_path:'./test-results/shakeout/team-leader/Kanban Edit Board.jpg'},
|
||||
{test:'Team Leader - New Kanban',url :'http://localhost:8000/new_kanban/',screenshot_path:'./test-results/shakeout/team-leader/New Kanban.jpg'},
|
||||
{test:'Team Leader - New Organisation',url :'http://localhost:8000/new_organisation/',screenshot_path:'./test-results/shakeout/team-leader/New Organisation.jpg'},
|
||||
{test:'Team Leader - New Project',url :'http://localhost:8000/new_project/',screenshot_path:'./test-results/shakeout/team-leader/New Project.jpg'},
|
||||
{test:'Team Leader - New Request for Change',url :'http://localhost:8000/new_request_for_change/',screenshot_path:'./test-results/shakeout/team-leader/New Request for Change.jpg'},
|
||||
{test:'Team Leader - New Requirement',url :'http://localhost:8000/new_requirement/',screenshot_path:'./test-results/shakeout/team-leader/New Requirement.jpg'},
|
||||
{test:'Team Leader - New Task',url :'http://localhost:8000/new_task/',screenshot_path:'./test-results/shakeout/team-leader/New Task.jpg'},
|
||||
{test:'Team Leader - Organisation Information 1',url :'http://localhost:8000/organisation_information/1/',screenshot_path:'./test-results/shakeout/team-leader/Organisation Information.jpg'},
|
||||
{test:'Team Leader - Profile Information',url :'http://localhost:8000/profile_information/',screenshot_path:'./test-results/shakeout/team-leader/Profile Information.jpg'},
|
||||
{test:'Team Leader - Project Information 2',url :'http://localhost:8000/project_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Project Information.jpg'},
|
||||
{test:'Team Leader - Requirement Information 2',url :'http://localhost:8000/requirement_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Requirement Information.jpg'},
|
||||
{test:'Team Leader - Requirement Item Information 2',url :'http://localhost:8000/requirement_item_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Requirement Item Information.jpg'},
|
||||
{test:'Team Leader - RFC Information 2',url :'http://localhost:8000/rfc_information/2/',screenshot_path:'./test-results/shakeout/team-leader/RFC Information.jpg'},
|
||||
{test:'Team Leader - Search',url :'http://localhost:8000/search/',screenshot_path:'./test-results/shakeout/team-leader/Search.jpg'},
|
||||
{test:'Team Leader - Search Sprint',url :'http://localhost:8000/search/sprint/',screenshot_path:'./test-results/shakeout/team-leader/Search Sprint.jpg'},
|
||||
{test:'Team Leader - Sprint Information',url :'http://localhost:8000/sprint_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Sprint Information 2.jpg'},
|
||||
{test:'Team Leader - Task Information 2',url :'http://localhost:8000/task_information/2/',screenshot_path:'./test-results/shakeout/team-leader/Task Information.jpg'},
|
||||
];
|
||||
|
||||
page_array.forEach((row : PageArrayType) => {
|
||||
test(row.test, async({ page }) : Promise<void> => {
|
||||
//Make sure there are no errors in the console
|
||||
page.on("console", message => {
|
||||
if (message.type() === "error") {
|
||||
test.info().annotations.push({
|
||||
type: 'Console Errors',
|
||||
description: message.text()
|
||||
});
|
||||
}
|
||||
expect.soft(message.type()).not.toBe("error");
|
||||
});
|
||||
|
||||
//Make sure there are no warnings in the console
|
||||
page.on("console", message => {
|
||||
if (message.type() === "warning") {
|
||||
test.info().annotations.push({
|
||||
type: 'Console Warnings',
|
||||
description: message.text()
|
||||
});
|
||||
}
|
||||
expect.soft(message.type()).not.toBe("warning");
|
||||
});
|
||||
|
||||
//RESPONSE
|
||||
page.on("response", data => {
|
||||
if (!data.ok()) {
|
||||
test.info().annotations.push({
|
||||
type: "Response Status",
|
||||
description:
|
||||
`Url: ${data.url()} || Status Code: ${data.status()} || Status Text: ${data.statusText()}`,
|
||||
});
|
||||
}
|
||||
|
||||
//If the status range is between 200-299, OR any of the following status 301, 302, 307
|
||||
const condition1: boolean = data.ok();
|
||||
const condition2: boolean = [301, 302, 307].includes(data.status())
|
||||
expect.soft(condition1 || condition2).toBeTruthy();
|
||||
});
|
||||
|
||||
//Go to the page
|
||||
await page.goto(row.url);
|
||||
|
||||
//await expect(locator).not.toContainText('error');
|
||||
await expect(page.locator("#loader")).toHaveCount(0);
|
||||
|
||||
//Take screenshot
|
||||
await page.screenshot({
|
||||
path: row.screenshot_path,
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user