Skip to content

Commit

Permalink
rename variable to be more informative
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchudy committed Sep 26, 2024
1 parent 8143cb2 commit 3186b3d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
38 changes: 19 additions & 19 deletions test/e2e/specs/all-features/record/related-table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -864,31 +864,31 @@ test.describe('Related tables', () => {
* This test ensures the tracking of bulkForeignKeySelectedRows is done right when the first form has no value filled in by the initial modal
*/
test('closing the initial modal and using "Add more" to add more forms with values', async ({ page }) => {
let newPage: Page, modal: Locator;
let newPage: Page, bulkFKModal: Locator;

await test.step('should open recordedit with a modal picker showing', async () => {
const addBtn = RecordLocators.getRelatedTableAddButton(page, params.table_name);

newPage = await clickNewTabLink(addBtn);
await RecordeditLocators.waitForRecordeditPageReady(newPage);

modal = ModalLocators.getRecordeditBulkFKPopup(newPage);
await expect.soft(modal).toBeAttached();
bulkFKModal = ModalLocators.getRecordeditBulkFKPopup(newPage);
await expect.soft(bulkFKModal).toBeAttached();
});

await test.step('modal should have 3 disabled rows', async () => {
const rows = RecordsetLocators.getRows(modal);
const rows = RecordsetLocators.getRows(bulkFKModal);
await expect.soft(rows).toHaveCount(10);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(bulkFKModal)).toHaveCount(3);

await expect.soft(RecordsetLocators.getDisabledRows(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getDisabledRows(bulkFKModal)).toHaveCount(3);
await expect.soft(rows.nth(1)).toHaveClass(/disabled-row/); // Leaf 2
await expect.soft(rows.nth(6)).toHaveClass(/disabled-row/); // Leaf 7
await expect.soft(rows.nth(9)).toHaveClass(/disabled-row/); // Leaf 10
});

await test.step('closing the initial modal should not add any new forms AND not fill the first form', async () => {
await testModalClose(modal);
await testModalClose(bulkFKModal);

await expect.soft(RecordeditLocators.getRecordeditForms(newPage)).toHaveCount(1);
await testInputValue(newPage, 1, params.prefill_col, params.prefill_col, RecordeditInputType.FK_POPUP, false, params.prefill_value);
Expand All @@ -898,24 +898,24 @@ test.describe('Related tables', () => {
await test.step('clicking "add more" should have 3 rows disabled', async () => {
await RecordeditLocators.getAddMoreButton(newPage).click();
// The same modal when the page loaded should show again
await expect.soft(modal).toBeAttached();
await expect.soft(bulkFKModal).toBeAttached();

const rows = RecordsetLocators.getRows(modal);
const rows = RecordsetLocators.getRows(bulkFKModal);
await expect.soft(rows).toHaveCount(10);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(bulkFKModal)).toHaveCount(3);

await expect.soft(RecordsetLocators.getDisabledRows(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getDisabledRows(bulkFKModal)).toHaveCount(3);
await expect.soft(rows.nth(1)).toHaveClass(/disabled-row/); // Leaf 2
await expect.soft(rows.nth(6)).toHaveClass(/disabled-row/); // Leaf 7
await expect.soft(rows.nth(9)).toHaveClass(/disabled-row/); // Leaf 10
});

await test.step('select 2 more rows and submit the selection', async () => {
await RecordsetLocators.getRowCheckboxInput(modal, 0).click();
await RecordsetLocators.getRowCheckboxInput(modal, 4).click();
await RecordsetLocators.getRowCheckboxInput(bulkFKModal, 0).click();
await RecordsetLocators.getRowCheckboxInput(bulkFKModal, 4).click();

await ModalLocators.getSubmitButton(modal).click();
await expect.soft(modal).not.toBeAttached();
await ModalLocators.getSubmitButton(bulkFKModal).click();
await expect.soft(bulkFKModal).not.toBeAttached();

await expect.soft(RecordeditLocators.getRecordeditForms(newPage)).toHaveCount(3);
});
Expand All @@ -937,13 +937,13 @@ test.describe('Related tables', () => {

await RecordeditLocators.getAddMoreButton(newPage).click();
// The same modal when the page loaded should show again
await expect.soft(modal).toBeAttached();
await expect.soft(bulkFKModal).toBeAttached();

const rows = RecordsetLocators.getRows(modal);
const rows = RecordsetLocators.getRows(bulkFKModal);
await expect.soft(rows).toHaveCount(10);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(modal)).toHaveCount(4);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(bulkFKModal)).toHaveCount(4);

await expect.soft(RecordsetLocators.getDisabledRows(modal)).toHaveCount(4);
await expect.soft(RecordsetLocators.getDisabledRows(bulkFKModal)).toHaveCount(4);
await expect.soft(rows.nth(0)).not.toHaveClass(/disabled-row/); // Leaf 1 - the row that was just removed
await expect.soft(rows.nth(1)).toHaveClass(/disabled-row/); // Leaf 2
await expect.soft(rows.nth(4)).toHaveClass(/disabled-row/); // Leaf 5
Expand Down
56 changes: 28 additions & 28 deletions test/e2e/utils/record-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ export const testAddRelatedWithForeignKeyMultiPicker = async (
params: AddRecordsForeignKeyMultiParams,
inputType: RecordeditInputType.FK_DROPDOWN | RecordeditInputType.FK_POPUP
) => {
let newPage: Page, modal: Locator, fkInputModal: Locator, fkInputDropdown: Locator, dropdownMenu: Locator;
let newPage: Page, bulkFKModal: Locator, fkInputModal: Locator, fkInputDropdown: Locator, dropdownMenu: Locator;

const isModal = inputType === RecordeditInputType.FK_POPUP;

Expand All @@ -796,25 +796,25 @@ export const testAddRelatedWithForeignKeyMultiPicker = async (
newPage = await clickNewTabLink(addBtn);
await RecordeditLocators.waitForRecordeditPageReady(newPage);

modal = ModalLocators.getRecordeditBulkFKPopup(newPage);
await expect.soft(modal).toBeAttached();
bulkFKModal = ModalLocators.getRecordeditBulkFKPopup(newPage);
await expect.soft(bulkFKModal).toBeAttached();
});

await test.step('modal should have 1 row selected and disabled', async () => {
const rows = RecordsetLocators.getRows(modal);
const rows = RecordsetLocators.getRows(bulkFKModal);
await expect.soft(rows).toHaveCount(10);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(modal)).toHaveCount(1);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(bulkFKModal)).toHaveCount(1);

await expect.soft(RecordsetLocators.getDisabledRows(modal)).toHaveCount(1);
await expect.soft(RecordsetLocators.getDisabledRows(bulkFKModal)).toHaveCount(1);
await expect.soft(rows.nth(1)).toHaveClass(/disabled-row/);
});

await test.step('select 2 rows and submit the selection', async () => {
await RecordsetLocators.getRowCheckboxInput(modal, 3).click();
await RecordsetLocators.getRowCheckboxInput(modal, 4).click();
await RecordsetLocators.getRowCheckboxInput(bulkFKModal, 3).click();
await RecordsetLocators.getRowCheckboxInput(bulkFKModal, 4).click();

await ModalLocators.getSubmitButton(modal).click();
await expect.soft(modal).not.toBeAttached();
await ModalLocators.getSubmitButton(bulkFKModal).click();
await expect.soft(bulkFKModal).not.toBeAttached();

await expect.soft(RecordeditLocators.getRecordeditForms(newPage)).toHaveCount(2);
});
Expand Down Expand Up @@ -896,24 +896,24 @@ export const testAddRelatedWithForeignKeyMultiPicker = async (
await test.step('clicking "add more" should have 3 rows disabled', async () => {
await RecordeditLocators.getAddMoreButton(newPage).click();
// The same modal when the page loaded should show again
await expect.soft(modal).toBeAttached();
await expect.soft(bulkFKModal).toBeAttached();

const rows = RecordsetLocators.getRows(modal);
const rows = RecordsetLocators.getRows(bulkFKModal);
await expect.soft(rows).toHaveCount(10);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getDisabledRows(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(bulkFKModal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getDisabledRows(bulkFKModal)).toHaveCount(3);

await expect.soft(rows.nth(1)).toHaveClass(/disabled-row/);
await expect.soft(rows.nth(4)).toHaveClass(/disabled-row/);
await expect.soft(rows.nth(9)).toHaveClass(/disabled-row/);
});

await test.step('select 2 more rows and submit the selection', async () => {
await RecordsetLocators.getRowCheckboxInput(modal, 0).click();
await RecordsetLocators.getRowCheckboxInput(modal, 6).click();
await RecordsetLocators.getRowCheckboxInput(bulkFKModal, 0).click();
await RecordsetLocators.getRowCheckboxInput(bulkFKModal, 6).click();

await ModalLocators.getSubmitButton(modal).click();
await expect.soft(modal).not.toBeAttached();
await ModalLocators.getSubmitButton(bulkFKModal).click();
await expect.soft(bulkFKModal).not.toBeAttached();

await expect.soft(RecordeditLocators.getRecordeditForms(newPage)).toHaveCount(4);
});
Expand Down Expand Up @@ -966,14 +966,14 @@ export const testAddRelatedWithForeignKeyMultiPicker = async (
await testInputValue(newPage, 2, params.leaf_col, params.leaf_col, inputType, false, 'Select a value');

await RecordeditLocators.getAddMoreButton(newPage).click();
await expect.soft(modal).toBeAttached();
await expect.soft(bulkFKModal).toBeAttached();

const rows = RecordsetLocators.getRows(modal);
const rows = RecordsetLocators.getRows(bulkFKModal);
await expect.soft(rows).toHaveCount(10);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(modal)).toHaveCount(4);
await expect.soft(RecordsetLocators.getDisabledRows(modal)).toHaveCount(4);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(bulkFKModal)).toHaveCount(4);
await expect.soft(RecordsetLocators.getDisabledRows(bulkFKModal)).toHaveCount(4);

await testModalClose(modal);
await testModalClose(bulkFKModal);
});

await test.step('remove the cleared input form and another form, then verify rows disabled in "add more" once more', async () => {
Expand All @@ -982,14 +982,14 @@ export const testAddRelatedWithForeignKeyMultiPicker = async (
await RecordeditLocators.getDeleteRowButton(newPage, 1).click();

await RecordeditLocators.getAddMoreButton(newPage).click();
await expect.soft(modal).toBeAttached();
await expect.soft(bulkFKModal).toBeAttached();

const rows = RecordsetLocators.getRows(modal);
const rows = RecordsetLocators.getRows(bulkFKModal);
await expect.soft(rows).toHaveCount(10);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getDisabledRows(modal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getCheckedCheckboxInputs(bulkFKModal)).toHaveCount(3);
await expect.soft(RecordsetLocators.getDisabledRows(bulkFKModal)).toHaveCount(3);

await testModalClose(modal);
await testModalClose(bulkFKModal);
});

await test.step('submit the data and test submission table', async () => {
Expand Down

0 comments on commit 3186b3d

Please sign in to comment.