Browse Source

tests: split tests into numerical, string, datetime

nc-agg/tests
DarkPhoenix2704 5 months ago
parent
commit
6f57f3d96f
  1. 443
      tests/playwright/tests/db/features/column-aggregation.spec.ts

443
tests/playwright/tests/db/features/column-aggregation.spec.ts

@ -177,23 +177,7 @@ const data = [
}, },
]; ];
const verificationData = { const verificationNumericalData = {
Title: {
count_unique: '2',
count_empty: '0',
count_filled: '2',
percent_unique: '100',
percent_filled: '100',
percent_empty: '0',
},
LongText: {
count_unique: '2',
count_empty: '0',
count_filled: '2',
percent_unique: '100',
percent_filled: '100',
percent_empty: '0',
},
Number: { Number: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
@ -224,13 +208,14 @@ const verificationData = {
std_dev: '0.2', std_dev: '0.2',
range: '0.4', range: '0.4',
}, },
Checkbox: { Currency: {
checked: '1', sum: '300.5',
unchecked: '1', min: '100',
percent_checked: '50', max: '200.5',
percent_unchecked: '50', avg: '150.25',
}, median: '150.25',
MultiSelect: { std_dev: '0.2',
range: '100.5',
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
@ -238,7 +223,14 @@ const verificationData = {
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, },
SingleSelect: { Percent: {
sum: '125',
min: '50',
max: '75',
avg: '62.5%',
median: '62.5%',
std_dev: '12.5%',
range: '25%',
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
@ -246,31 +238,41 @@ const verificationData = {
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, },
Date: { Duration: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
percent_unique: '100', percent_unique: '100',
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
earliest_date: '2024-01-01', sum: '00:55',
latest_date: '2024-02-02', min: '00:22',
date_range: '32 days', max: '00:33',
month_range: '1 month', avg: '00:28',
median: '00:28',
std_dev: '00:06',
range: '00:12',
}, },
DateTime: {
Rating: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
percent_unique: '100', percent_unique: '100',
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
earliest_date: '2024-01-01 10:00', sum: '9',
latest_date: '2024-02-02 12:00', min: '4',
date_range: '32 days', max: '5',
month_range: '1 month', avg: '4.5',
median: '4.5',
std_dev: '0.5',
range: '1',
}, },
Year: { };
const verificationStringData = {
Title: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
@ -278,7 +280,7 @@ const verificationData = {
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, },
Time: { LongText: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
@ -286,7 +288,7 @@ const verificationData = {
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, },
PhoneNumber: { MultiSelect: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
@ -294,7 +296,7 @@ const verificationData = {
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, },
Email: { SingleSelect: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
@ -310,14 +312,7 @@ const verificationData = {
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, },
Currency: { JSON: {
sum: '300.5',
min: '100',
max: '200.5',
avg: '150.25',
median: '150.25',
std_dev: '0.2',
range: '100.5',
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
@ -325,97 +320,52 @@ const verificationData = {
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, },
Percent: { User: {
sum: '125', count_unique: '1',
min: '50', count_empty: '1',
max: '75', count_filled: '1',
avg: '62.5%', percent_unique: '50%',
median: '62.5%', percent_filled: '50%',
std_dev: '12.5%', percent_empty: '50%',
range: '25%',
count_unique: '2',
count_empty: '0',
count_filled: '2',
percent_unique: '100',
percent_filled: '100',
percent_empty: '0',
}, },
Duration: { };
const verificationDateTime = {
DateTime: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
percent_unique: '100', percent_unique: '100',
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
sum: '00:55', earliest_date: '2024-01-01 10:00',
min: '00:22', latest_date: '2024-02-02 12:00',
max: '00:33', date_range: '32 days',
avg: '00:28', month_range: '1 month',
median: '00:28',
std_dev: '00:06',
range: '00:12',
}, },
Time: {
Rating: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
percent_unique: '100', percent_unique: '100',
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
sum: '9',
min: '4',
max: '5',
avg: '4.5',
median: '4.5',
std_dev: '0.5',
range: '1',
}, },
Date: {
JSON: {
count_unique: '2', count_unique: '2',
count_empty: '0', count_empty: '0',
count_filled: '2', count_filled: '2',
percent_unique: '100', percent_unique: '100',
percent_filled: '100', percent_filled: '100',
percent_empty: '0', percent_empty: '0',
}, earliest_date: '2024-01-01',
Attachment: { latest_date: '2024-02-02',
attachment_size: '1.81 MiB', date_range: '32 days',
count_unique: '1', month_range: '1 month',
count_empty: '1',
count_filled: '1',
percent_unique: '50%',
percent_filled: '50%',
percent_empty: '50%',
},
User: {
count_unique: '1',
count_empty: '1',
count_filled: '1',
percent_unique: '50%',
percent_filled: '50%',
percent_empty: '50%',
}, },
}; };
const verificationDataAfterFilter = { const verificationNUmericalDataAfterFilter = {
Title: {
count_unique: '2',
count_empty: '0',
count_filled: '2',
percent_unique: '100',
percent_filled: '100',
percent_empty: '0',
},
LongText: {
count_unique: '1',
count_empty: '1',
count_filled: '1',
percent_unique: '50',
percent_filled: '50',
percent_empty: '50',
},
Number: { Number: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
@ -446,13 +396,14 @@ const verificationDataAfterFilter = {
std_dev: '0', std_dev: '0',
range: '0', range: '0',
}, },
Checkbox: { Currency: {
checked: '1', sum: '100',
unchecked: '1', min: '100',
percent_checked: '50', max: '100',
percent_unchecked: '50', avg: '100',
}, median: '100',
MultiSelect: { std_dev: '0',
range: '0',
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
@ -460,7 +411,14 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
SingleSelect: { Percent: {
sum: '50',
min: '50',
max: '50',
avg: '50%',
median: '50%',
std_dev: '0%',
range: '0%',
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
@ -468,39 +426,49 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
Date: { Duration: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
percent_unique: '50', percent_unique: '50',
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
earliest_date: '2024-01-01', sum: '00:22',
latest_date: '2024-01-01', min: '00:22',
date_range: '0 days', max: '00:22',
month_range: '0 month', avg: '00:22',
median: '00:22',
std_dev: '00:00',
range: '00:00',
}, },
DateTime: {
Rating: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
percent_unique: '50', percent_unique: '50',
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
earliest_date: '2024-01-01 10:00', sum: '4',
latest_date: '2024-01-01 10:00', min: '4',
date_range: '0 days', max: '4',
month_range: '0 month', avg: '4',
median: '2',
std_dev: '0',
range: '4',
}, },
Year: { };
count_unique: '1',
count_empty: '1', const verificationStringDataAfterFilter = {
count_filled: '1', Title: {
percent_unique: '50', count_unique: '2',
percent_filled: '50', count_empty: '0',
percent_empty: '50', count_filled: '2',
percent_unique: '100',
percent_filled: '100',
percent_empty: '0',
}, },
Time: { LongText: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
@ -508,7 +476,7 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
PhoneNumber: { MultiSelect: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
@ -516,7 +484,7 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
Email: { SingleSelect: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
@ -524,6 +492,7 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
Url: { Url: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
@ -532,14 +501,7 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
Currency: { JSON: {
sum: '100',
min: '100',
max: '100',
avg: '100',
median: '100',
std_dev: '0',
range: '0',
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
@ -547,53 +509,42 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
Percent: { User: {
sum: '50',
min: '50',
max: '50',
avg: '50%',
median: '50%',
std_dev: '0%',
range: '0%',
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
percent_unique: '50', percent_unique: '50%',
percent_filled: '50', percent_filled: '50%',
percent_empty: '50', percent_empty: '50%',
}, },
Duration: { };
const verificationDateTimeDataAfterFilter = {
Date: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
percent_unique: '50', percent_unique: '50',
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
sum: '00:22', earliest_date: '2024-01-01',
min: '00:22', latest_date: '2024-01-01',
max: '00:22', date_range: '0 days',
avg: '00:22', month_range: '0 month',
median: '00:22',
std_dev: '00:00',
range: '00:00',
}, },
DateTime: {
Rating: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
percent_unique: '50', percent_unique: '50',
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
sum: '4', earliest_date: '2024-01-01 10:00',
min: '4', latest_date: '2024-01-01 10:00',
max: '4', date_range: '0 days',
avg: '4', month_range: '0 month',
median: '2',
std_dev: '0',
range: '4',
}, },
JSON: { Time: {
count_unique: '1', count_unique: '1',
count_empty: '1', count_empty: '1',
count_filled: '1', count_filled: '1',
@ -601,14 +552,6 @@ const verificationDataAfterFilter = {
percent_filled: '50', percent_filled: '50',
percent_empty: '50', percent_empty: '50',
}, },
User: {
count_unique: '1',
count_empty: '1',
count_filled: '1',
percent_unique: '50%',
percent_filled: '50%',
percent_empty: '50%',
},
}; };
const users: string[] = isEE() const users: string[] = isEE()
@ -694,8 +637,126 @@ test.describe('Field Aggregation', () => {
await unsetup(context); await unsetup(context);
}); });
test('Aggregation Grid Test', async ({ page }) => { test('Aggregation Grid Test - String Columns', async ({ page }) => {
for (const x of Object.entries(verificationData)) { for (const x of Object.entries(verificationStringData)) {
const colName = x[0];
for (const y of Object.entries(x[1])) {
await aggregationBar.updateAggregation({
column_name: colName,
aggregation: y[0],
skipNetworkValidation: true,
});
await aggregationBar.verifyAggregation({
column_name: colName,
aggregation: y[1],
});
}
}
const { api, table, base } = testContext;
await api.dbTableRow.bulkCreate('noco', base.id, table.id, [
{
Id: 3,
Title: 'Sample2',
},
]);
await page.reload();
await dashboard.grid.toolbar.clickFilter();
await dashboard.grid.toolbar.filter.add({
title: 'Title',
operation: 'is like',
value: 'Sample',
});
await page.waitForTimeout(4000);
await dashboard.grid.toolbar.clickFilter();
for (const x of Object.entries(verificationStringDataAfterFilter)) {
const colName = x[0];
for (const y of Object.entries(x[1])) {
await aggregationBar.updateAggregation({
column_name: colName,
aggregation: y[0],
skipNetworkValidation: true,
});
await aggregationBar.verifyAggregation({
column_name: colName,
aggregation: y[1],
});
}
}
});
test('Aggregation Grid Test - Numerical Columns', async ({ page }) => {
for (const x of Object.entries(verificationNumericalData)) {
const colName = x[0];
for (const y of Object.entries(x[1])) {
await aggregationBar.updateAggregation({
column_name: colName,
aggregation: y[0],
skipNetworkValidation: true,
});
await aggregationBar.verifyAggregation({
column_name: colName,
aggregation: y[1],
});
}
}
const { api, table, base } = testContext;
await api.dbTableRow.bulkCreate('noco', base.id, table.id, [
{
Id: 3,
Title: 'Sample2',
},
]);
await page.reload();
await dashboard.grid.toolbar.clickFilter();
await dashboard.grid.toolbar.filter.add({
title: 'Title',
operation: 'is like',
value: 'Sample',
});
await page.waitForTimeout(4000);
await dashboard.grid.toolbar.clickFilter();
for (const x of Object.entries(verificationNUmericalDataAfterFilter)) {
const colName = x[0];
for (const y of Object.entries(x[1])) {
await aggregationBar.updateAggregation({
column_name: colName,
aggregation: y[0],
skipNetworkValidation: true,
});
await aggregationBar.verifyAggregation({
column_name: colName,
aggregation: y[1],
});
}
}
});
test('Aggregation Grid Test - DateTime Columns', async ({ page }) => {
for (const x of Object.entries(verificationDateTime)) {
const colName = x[0]; const colName = x[0];
for (const y of Object.entries(x[1])) { for (const y of Object.entries(x[1])) {
@ -735,7 +796,7 @@ test.describe('Field Aggregation', () => {
await dashboard.grid.toolbar.clickFilter(); await dashboard.grid.toolbar.clickFilter();
for (const x of Object.entries(verificationDataAfterFilter)) { for (const x of Object.entries(verificationDateTimeDataAfterFilter)) {
const colName = x[0]; const colName = x[0];
for (const y of Object.entries(x[1])) { for (const y of Object.entries(x[1])) {
@ -762,7 +823,7 @@ test.describe('Field Aggregation', () => {
await page.reload(); await page.reload();
const sharedPage = new DashboardPage(page, context.base); const sharedPage = new DashboardPage(page, context.base);
for (const x of Object.entries(verificationData)) { for (const x of Object.entries(verificationStringData)) {
const colName = x[0]; const colName = x[0];
for (const y of Object.entries(x[1])) { for (const y of Object.entries(x[1])) {

Loading…
Cancel
Save