Skip to content

Commit

Permalink
test: add e2e for row grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
chintankavathia committed Nov 19, 2024
1 parent 9280897 commit d6c55fa
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 4 deletions.
53 changes: 53 additions & 0 deletions playwright/e2e/row-group.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { expect, test } from '../support/test-helpers';

test.describe('row grouping', () => {
const example = 'row-grouping';

test(example, async ({ ngx, page }) => {
await ngx.visitExample(example);

await expect(page.getByText('Ethel Price')).toBeVisible();
await ngx.runVisualAndA11yTests('default', [
// interactive elements< (<a/>, <input/> etc) within table cells are failing
{
id: 'aria-required-children',
enabled: false
}
]);

const groupCheckbox = page.locator('.datatable-group-cell .datatable-checkbox input').first();
groupCheckbox.check();

await expect(page.getByText('4 selected')).toBeVisible();

await ngx.runVisualAndA11yTests('group-selected', [
{
id: 'aria-required-children',
enabled: false
}
]);
});

test(example + ' expand/collapse', async ({ ngx, page }) => {
await ngx.visitExample(example);

await expect(page.getByText('Ethel Price')).toBeVisible();
const groupHeader = page.getByTitle('Expand/Collapse Group').first();
groupHeader.click();
await expect(page.getByText('Ethel Price')).not.toBeVisible();
await ngx.runVisualAndA11yTests('group-collapsed', [
{
id: 'aria-required-children',
enabled: false
}
]);
groupHeader.click();
await expect(page.getByText('Ethel Price')).toBeVisible();
await ngx.runVisualAndA11yTests('group-expanded', [
{
id: 'aria-required-children',
enabled: false
}
]);
});
});
3 changes: 0 additions & 3 deletions playwright/e2e/static.spec.ts

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/app/basic/row-grouping.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
>
<div style="padding-left:5px;height: 100%; display:flex;align-items: center;">
<a
href="#"
href="javascript:void(0)"
[class.datatable-icon-right]="!expanded"
[class.datatable-icon-down]="expanded"
title="Expand/Collapse Group"
Expand Down Expand Up @@ -87,6 +87,7 @@ import {
name="{{ rowIndex }}"
value="0"
class="expectedpayment"
[attr.aria-label]="'ex pay1' + rowIndex"
(change)="checkGroup($event, row, rowIndex, group)"
[checked]="row.exppayyes === 1"
/>
Expand All @@ -98,6 +99,7 @@ import {
name="{{ rowIndex }}"
value="1"
class="expectedpayment2"
[attr.aria-label]="'ex pay2' + rowIndex"
(change)="checkGroup($event, row, rowIndex, group)"
[checked]="row.exppayno === 1"
/>
Expand All @@ -109,6 +111,7 @@ import {
name="{{ rowIndex }}"
value="2"
class="expectedpayment3"
[attr.aria-label]="'ex pay3' + rowIndex"
(change)="checkGroup($event, row, rowIndex, group)"
[checked]="row.exppaypending === 1"
/>
Expand Down Expand Up @@ -139,6 +142,7 @@ import {
(blur)="updateValue($event, 'comment', rowIndex)"
type="text"
name="comment"
aria-label="comment"
[value]="value"
/>
</ng-template>
Expand Down

0 comments on commit d6c55fa

Please sign in to comment.