Migrate Playwright suite to .NET UI tests and deprecate TS project
This commit is contained in:
@@ -0,0 +1,411 @@
|
||||
/**
|
||||
* E2E Tests for Search Type 120: Time Span + Work Center + Item/Operation/MIS
|
||||
*
|
||||
* This search type allows users to search by a date range combined with work center(s)
|
||||
* and part operation(s). Part operations are defined by a combination of Item Number,
|
||||
* Operation Number, MIS Number, and MIS Revision.
|
||||
*
|
||||
* Required filters:
|
||||
* - Timespan (Min Date to Max Date)
|
||||
* - Work Center (one or more)
|
||||
* - Item/Operation/MIS (one or more part operations via file upload)
|
||||
*/
|
||||
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { navigateToSearchPage } from '../helpers/navigation.helper';
|
||||
import { selectSearchType, SearchTypes, enterSearchName, clickSubmitSearch, confirmSubmitSearch } from '../helpers/search-type.helper';
|
||||
import { setDateRange, setMinDate, setMaxDate, TestDateRanges } from '../helpers/date-picker.helper';
|
||||
import { addWorkCenter, addWorkCenters, workCenterConfig, getAutocompleteItemCount } from '../helpers/autocomplete.helper';
|
||||
import { uploadFile, partOperationConfig, getTestFile, TestFiles, getUploadedItemCount } from '../helpers/file-upload.helper';
|
||||
import { assertNoErrorNotification, hasErrorNotification } from '../helpers/radzen.helper';
|
||||
import { hasValidationErrors } from '../helpers/validation.helper';
|
||||
|
||||
// Valid test data from manual test scripts
|
||||
const TEST_WORK_CENTERS = {
|
||||
SINGLE_AS: '0083AS',
|
||||
SINGLE_CA: '10595CA',
|
||||
MULTIPLE_CA: ['11275CA', '11350CA', '11355CA'],
|
||||
MULTIPLE_AS: ['0083AS', '0278AS'],
|
||||
MIXED_SUFFIXES: ['0424AS', '14305CA', '1700CB'],
|
||||
HISTORICAL: '1010AS',
|
||||
WITH_SAME_MIS: '13316CA',
|
||||
};
|
||||
|
||||
// Note: Part operations are uploaded via file containing columns:
|
||||
// Item Number, Operation Number, MIS Number, MIS Revision
|
||||
|
||||
test.describe('Search Type 120: Time Span + Work Center + Item/Operation/MIS', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await navigateToSearchPage(page);
|
||||
await selectSearchType(page, SearchTypes.TIMESPAN_WC_PARTOP);
|
||||
});
|
||||
|
||||
test.describe('Positive Test Cases', () => {
|
||||
test('TC-120-P01: Single Work Center with Single Part Operation', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-P01 Single WC Single PartOp');
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Add single work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_AS);
|
||||
|
||||
// Upload single part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Verify work center was added
|
||||
const wcCount = await getAutocompleteItemCount(page, workCenterConfig);
|
||||
expect(wcCount).toBeGreaterThanOrEqual(1);
|
||||
|
||||
// Verify no error notification
|
||||
await assertNoErrorNotification(page);
|
||||
|
||||
// Submit search
|
||||
await clickSubmitSearch(page);
|
||||
await confirmSubmitSearch(page);
|
||||
|
||||
// Should navigate to search page
|
||||
await expect(page).toHaveURL(/\/search\/\d+/);
|
||||
});
|
||||
|
||||
test('TC-120-P02: Single Work Center with Multiple Part Operations', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-P02 Single WC Multi PartOps');
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Add single work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_CA);
|
||||
|
||||
// Upload multiple part operations file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.MULTIPLE_OPERATIONS));
|
||||
|
||||
// Verify part operations were uploaded
|
||||
const partOpCount = await getUploadedItemCount(page, partOperationConfig);
|
||||
expect(partOpCount).toBeGreaterThan(1);
|
||||
|
||||
// Verify no error notification
|
||||
await assertNoErrorNotification(page);
|
||||
|
||||
// Submit search
|
||||
await clickSubmitSearch(page);
|
||||
await confirmSubmitSearch(page);
|
||||
|
||||
// Should navigate to search page
|
||||
await expect(page).toHaveURL(/\/search\/\d+/);
|
||||
});
|
||||
|
||||
test('TC-120-P03: Multiple Work Centers with Single Part Operation', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-P03 Multi WC Single PartOp');
|
||||
|
||||
// Set date range (recent)
|
||||
await setDateRange(page, '2019-01-01', '2020-09-01');
|
||||
|
||||
// Add multiple work centers
|
||||
await addWorkCenters(page, TEST_WORK_CENTERS.MULTIPLE_CA);
|
||||
|
||||
// Verify work centers were added
|
||||
const wcCount = await getAutocompleteItemCount(page, workCenterConfig);
|
||||
expect(wcCount).toBe(3);
|
||||
|
||||
// Upload single part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Verify no error notification
|
||||
await assertNoErrorNotification(page);
|
||||
|
||||
// Submit search
|
||||
await clickSubmitSearch(page);
|
||||
await confirmSubmitSearch(page);
|
||||
|
||||
// Should navigate to search page
|
||||
await expect(page).toHaveURL(/\/search\/\d+/);
|
||||
});
|
||||
|
||||
test('TC-120-P04: Multiple Work Centers with Multiple Part Operations', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-P04 Multi WC Multi PartOps');
|
||||
|
||||
// Set date range (wide)
|
||||
await setDateRange(page, '2017-01-01', '2020-09-01');
|
||||
|
||||
// Add multiple work centers
|
||||
await addWorkCenters(page, TEST_WORK_CENTERS.MULTIPLE_AS);
|
||||
|
||||
// Verify work centers were added
|
||||
const wcCount = await getAutocompleteItemCount(page, workCenterConfig);
|
||||
expect(wcCount).toBe(2);
|
||||
|
||||
// Upload multiple part operations file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.MULTIPLE_OPERATIONS));
|
||||
|
||||
// Verify no error notification
|
||||
await assertNoErrorNotification(page);
|
||||
|
||||
// Submit search
|
||||
await clickSubmitSearch(page);
|
||||
await confirmSubmitSearch(page);
|
||||
|
||||
// Should navigate to search page
|
||||
await expect(page).toHaveURL(/\/search\/\d+/);
|
||||
});
|
||||
|
||||
test('TC-120-P05: Historical Date Range with Part Operations', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-P05 Historical PartOp Search');
|
||||
|
||||
// Set historical date range
|
||||
await setDateRange(page, TestDateRanges.HISTORICAL.min, TestDateRanges.HISTORICAL.max);
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.HISTORICAL);
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Verify no error notification
|
||||
await assertNoErrorNotification(page);
|
||||
|
||||
// Submit search
|
||||
await clickSubmitSearch(page);
|
||||
await confirmSubmitSearch(page);
|
||||
|
||||
// Should navigate to search page
|
||||
await expect(page).toHaveURL(/\/search\/\d+/);
|
||||
});
|
||||
|
||||
test('TC-120-P06: Multiple Part Operations with Same MIS Number', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-P06 Same MIS Diff Items');
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.WITH_SAME_MIS);
|
||||
|
||||
// Upload multiple part operations file (items share same MIS number)
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.MULTIPLE_OPERATIONS));
|
||||
|
||||
// Verify no error notification
|
||||
await assertNoErrorNotification(page);
|
||||
|
||||
// Submit search
|
||||
await clickSubmitSearch(page);
|
||||
await confirmSubmitSearch(page);
|
||||
|
||||
// Should navigate to search page
|
||||
await expect(page).toHaveURL(/\/search\/\d+/);
|
||||
});
|
||||
|
||||
test('TC-120-P07: Work Center Code Variants with Part Operations', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-P07 WC Variants PartOps');
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Add work centers with different suffixes (AS, CA, CB)
|
||||
await addWorkCenters(page, TEST_WORK_CENTERS.MIXED_SUFFIXES);
|
||||
|
||||
// Verify all work centers were added
|
||||
const wcCount = await getAutocompleteItemCount(page, workCenterConfig);
|
||||
expect(wcCount).toBe(3);
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Verify no error notification
|
||||
await assertNoErrorNotification(page);
|
||||
|
||||
// Submit search
|
||||
await clickSubmitSearch(page);
|
||||
await confirmSubmitSearch(page);
|
||||
|
||||
// Should navigate to search page
|
||||
await expect(page).toHaveURL(/\/search\/\d+/);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Negative Test Cases', () => {
|
||||
test('TC-120-N01: Missing Required Date Range', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N01 Missing Dates');
|
||||
|
||||
// Do NOT set date range (leave empty)
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_AS);
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N02: Missing Work Center', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N02 Missing Work Center');
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Do NOT add any work center
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N03: Missing Part Operation', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N03 Missing Part Operation');
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_AS);
|
||||
|
||||
// Do NOT upload any part operation file
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N04: Invalid Date Range (End Before Start)', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N04 Invalid Date Range');
|
||||
|
||||
// Set invalid date range (max before min)
|
||||
await setDateRange(page, TestDateRanges.INVALID_REVERSED.min, TestDateRanges.INVALID_REVERSED.max);
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_AS);
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N05: Missing Minimum Date Only', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N05 Missing Min Date');
|
||||
|
||||
// Set only max date
|
||||
await setMaxDate(page, '2020-09-01');
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_CA);
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N06: Missing Maximum Date Only', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N06 Missing Max Date');
|
||||
|
||||
// Set only min date
|
||||
await setMinDate(page, '2018-01-01');
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, '11275CA');
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N07: Missing Search Name', async ({ page }) => {
|
||||
// Do NOT enter search name
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_AS);
|
||||
|
||||
// Upload part operation file
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.SINGLE_OPERATION));
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N08: All Required Filters Missing', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N08 All Filters Missing');
|
||||
|
||||
// Do NOT set date range
|
||||
// Do NOT add work center
|
||||
// Do NOT upload part operation file
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
|
||||
test('TC-120-N09: Empty Part Operation File', async ({ page }) => {
|
||||
// Enter search name
|
||||
await enterSearchName(page, 'Test 120-N09 Empty PartOp File');
|
||||
|
||||
// Set date range
|
||||
await setDateRange(page, '2018-01-01', '2020-09-01');
|
||||
|
||||
// Add work center
|
||||
await addWorkCenter(page, TEST_WORK_CENTERS.SINGLE_AS);
|
||||
|
||||
// Upload empty file (if available)
|
||||
try {
|
||||
await uploadFile(page, partOperationConfig, getTestFile(TestFiles.EMPTY_FILE));
|
||||
} catch {
|
||||
// If empty file test data doesn't exist, skip this check
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
// Attempt to submit
|
||||
await clickSubmitSearch(page);
|
||||
|
||||
// Should show validation error or empty grid
|
||||
expect(await hasValidationErrors(page) || await hasErrorNotification(page)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user