Skip to content

Commit

Permalink
update sections helper with elements count
Browse files Browse the repository at this point in the history
  • Loading branch information
vitPinchuk committed Nov 9, 2024
1 parent b57a418 commit bfbd37a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ test.describe('Data Manipulation Panel', () => {

const sections = panel.getSections();
await sections.checkSectionPresence('Current Values');
await sections.checkElementsCountInSection('Current Values', 3);

const elements = panel.getElements();
const disabledMaxElement = await elements.getDisabledElement('max', 'disabled');
Expand Down Expand Up @@ -170,6 +171,7 @@ test.describe('Data Manipulation Panel', () => {

const sections = panel.getSections();
await sections.checkSectionPresence('Current Values');
await sections.checkElementsCountInSection('Current Values', 3);

const elements = panel.getElements();
const disabledMaxElement = await elements.getDisabledElement('max', 'disabled');
Expand Down Expand Up @@ -229,6 +231,8 @@ test.describe('Data Manipulation Panel', () => {
const sections = panel.getSections();
await sections.checkSectionPresence('Current Values');
await sections.checkSectionPresence('New Values');
await sections.checkElementsCountInSection('Current Values', 3);
await sections.checkElementsCountInSection('New Values', 3);

const elements = panel.getElements();
const disabledMaxElement = await elements.getDisabledElement('max', 'disabled');
Expand Down Expand Up @@ -429,6 +433,7 @@ test.describe('Data Manipulation Panel', () => {
* Open section
*/
await sections.openSection('Section 1');
await sections.checkElementsCountInSection('Section 1', 1);
await elements.checkElementPresence('element1', 'string');

await dashboardPage.refreshDashboard();
Expand Down
8 changes: 8 additions & 0 deletions test/utils/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ class SectionsHelper {
return expect(this.selectors.splitLayoutContent(name), this.getMsg(`Check ${name} Section`)).toBeVisible();
}

public async checkElementsCountInSection(name: string, count: number) {
const section = this.selectors.splitLayoutContent(name);
const elementsContainer = getElementsSelector(section);
const elements = await elementsContainer.root().locator('label').all();

return expect(elements, this.getMsg('Check Body Rows Count')).toHaveLength(count);
}

public async openSection(name: string) {
return this.selectors.splitLayoutContent(name).click();
}
Expand Down

0 comments on commit bfbd37a

Please sign in to comment.