@lowdefy/blocks-antd 4.7.0 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,14 +13,85 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { createBlockHelper, escapeId } from '@lowdefy/e2e-utils';
|
|
16
|
+
import { expect } from '@playwright/test';
|
|
16
17
|
const locator = (page, blockId)=>page.locator(`.ant-picker-range:has(#${escapeId(blockId)}_input)`);
|
|
18
|
+
const startInput = (page, blockId)=>page.locator(`#${escapeId(blockId)}_input`);
|
|
19
|
+
const endInput = (page, blockId)=>locator(page, blockId).locator('.ant-picker-input').last().locator('input');
|
|
20
|
+
const monthNames = [
|
|
21
|
+
'Jan',
|
|
22
|
+
'Feb',
|
|
23
|
+
'Mar',
|
|
24
|
+
'Apr',
|
|
25
|
+
'May',
|
|
26
|
+
'Jun',
|
|
27
|
+
'Jul',
|
|
28
|
+
'Aug',
|
|
29
|
+
'Sep',
|
|
30
|
+
'Oct',
|
|
31
|
+
'Nov',
|
|
32
|
+
'Dec'
|
|
33
|
+
];
|
|
34
|
+
const navigateToMonth = async (dropdown, targetYear, targetMonth)=>{
|
|
35
|
+
const headerView = dropdown.locator('.ant-picker-header-view').first();
|
|
36
|
+
while(true){
|
|
37
|
+
const headerText = await headerView.textContent();
|
|
38
|
+
const yearMatch = headerText.match(/\d{4}/);
|
|
39
|
+
if (!yearMatch) {
|
|
40
|
+
throw new Error(`Could not parse year from picker header: "${headerText}"`);
|
|
41
|
+
}
|
|
42
|
+
const currentYear = parseInt(yearMatch[0], 10);
|
|
43
|
+
if (currentYear === targetYear) break;
|
|
44
|
+
if (currentYear > targetYear) {
|
|
45
|
+
await dropdown.locator('.ant-picker-header-super-prev-btn').first().click();
|
|
46
|
+
} else {
|
|
47
|
+
await dropdown.locator('.ant-picker-header-super-next-btn').first().click();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
while(true){
|
|
51
|
+
const headerText = await headerView.textContent();
|
|
52
|
+
const currentMonthName = monthNames.find((m)=>headerText.includes(m));
|
|
53
|
+
if (!currentMonthName) {
|
|
54
|
+
throw new Error(`Could not parse month from picker header: "${headerText}"`);
|
|
55
|
+
}
|
|
56
|
+
const currentMonth = monthNames.indexOf(currentMonthName) + 1;
|
|
57
|
+
if (currentMonth === targetMonth) break;
|
|
58
|
+
if (currentMonth > targetMonth) {
|
|
59
|
+
await dropdown.locator('.ant-picker-header-prev-btn').first().click();
|
|
60
|
+
} else {
|
|
61
|
+
await dropdown.locator('.ant-picker-header-next-btn').first().click();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
17
65
|
export default createBlockHelper({
|
|
18
66
|
locator,
|
|
19
67
|
do: {
|
|
20
68
|
open: (page, blockId)=>locator(page, blockId).click(),
|
|
69
|
+
fill: async (page, blockId, startVal, endVal)=>{
|
|
70
|
+
await startInput(page, blockId).click();
|
|
71
|
+
await page.keyboard.type(startVal);
|
|
72
|
+
await page.keyboard.press('Enter');
|
|
73
|
+
await endInput(page, blockId).click();
|
|
74
|
+
await page.keyboard.type(endVal);
|
|
75
|
+
await page.keyboard.press('Enter');
|
|
76
|
+
},
|
|
77
|
+
select: async (page, blockId, startDateStr, endDateStr)=>{
|
|
78
|
+
const [sYear, sMonth] = startDateStr.split('-').map(Number);
|
|
79
|
+
const [eYear, eMonth] = endDateStr.split('-').map(Number);
|
|
80
|
+
await startInput(page, blockId).click();
|
|
81
|
+
const dropdown = page.locator('.ant-picker-dropdown:visible');
|
|
82
|
+
await expect(dropdown).toBeVisible();
|
|
83
|
+
await navigateToMonth(dropdown, sYear, sMonth);
|
|
84
|
+
await dropdown.locator(`.ant-picker-cell-in-view[title="${startDateStr}"]`).click();
|
|
85
|
+
await navigateToMonth(dropdown, eYear, eMonth);
|
|
86
|
+
await dropdown.locator(`.ant-picker-cell-in-view[title="${endDateStr}"]`).click();
|
|
87
|
+
},
|
|
21
88
|
clear: async (page, blockId)=>{
|
|
22
89
|
await locator(page, blockId).hover();
|
|
23
90
|
await locator(page, blockId).locator('.ant-picker-clear').click();
|
|
24
91
|
}
|
|
92
|
+
},
|
|
93
|
+
expect: {
|
|
94
|
+
startValue: (page, blockId, val)=>expect(startInput(page, blockId)).toHaveValue(val),
|
|
95
|
+
endValue: (page, blockId, val)=>expect(endInput(page, blockId)).toHaveValue(val)
|
|
25
96
|
}
|
|
26
97
|
});
|
|
@@ -16,10 +16,68 @@
|
|
|
16
16
|
import { expect } from '@playwright/test';
|
|
17
17
|
const locator = (page, blockId)=>page.locator(`.ant-picker:has(#${escapeId(blockId)}_input)`);
|
|
18
18
|
const input = (page, blockId)=>page.locator(`#${escapeId(blockId)}_input`);
|
|
19
|
+
const monthNames = [
|
|
20
|
+
'Jan',
|
|
21
|
+
'Feb',
|
|
22
|
+
'Mar',
|
|
23
|
+
'Apr',
|
|
24
|
+
'May',
|
|
25
|
+
'Jun',
|
|
26
|
+
'Jul',
|
|
27
|
+
'Aug',
|
|
28
|
+
'Sep',
|
|
29
|
+
'Oct',
|
|
30
|
+
'Nov',
|
|
31
|
+
'Dec'
|
|
32
|
+
];
|
|
33
|
+
const navigateToMonth = async (dropdown, targetYear, targetMonth)=>{
|
|
34
|
+
const headerView = dropdown.locator('.ant-picker-header-view');
|
|
35
|
+
while(true){
|
|
36
|
+
const headerText = await headerView.textContent();
|
|
37
|
+
const yearMatch = headerText.match(/\d{4}/);
|
|
38
|
+
if (!yearMatch) {
|
|
39
|
+
throw new Error(`Could not parse year from picker header: "${headerText}"`);
|
|
40
|
+
}
|
|
41
|
+
const currentYear = parseInt(yearMatch[0], 10);
|
|
42
|
+
if (currentYear === targetYear) break;
|
|
43
|
+
if (currentYear > targetYear) {
|
|
44
|
+
await dropdown.locator('.ant-picker-header-super-prev-btn').click();
|
|
45
|
+
} else {
|
|
46
|
+
await dropdown.locator('.ant-picker-header-super-next-btn').click();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
while(true){
|
|
50
|
+
const headerText = await headerView.textContent();
|
|
51
|
+
const currentMonthName = monthNames.find((m)=>headerText.includes(m));
|
|
52
|
+
if (!currentMonthName) {
|
|
53
|
+
throw new Error(`Could not parse month from picker header: "${headerText}"`);
|
|
54
|
+
}
|
|
55
|
+
const currentMonth = monthNames.indexOf(currentMonthName) + 1;
|
|
56
|
+
if (currentMonth === targetMonth) break;
|
|
57
|
+
if (currentMonth > targetMonth) {
|
|
58
|
+
await dropdown.locator('.ant-picker-header-prev-btn').click();
|
|
59
|
+
} else {
|
|
60
|
+
await dropdown.locator('.ant-picker-header-next-btn').click();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
19
64
|
export default createBlockHelper({
|
|
20
65
|
locator,
|
|
21
66
|
do: {
|
|
22
67
|
open: (page, blockId)=>locator(page, blockId).click(),
|
|
68
|
+
fill: async (page, blockId, val)=>{
|
|
69
|
+
await input(page, blockId).click();
|
|
70
|
+
await page.keyboard.type(val);
|
|
71
|
+
await page.keyboard.press('Enter');
|
|
72
|
+
},
|
|
73
|
+
select: async (page, blockId, dateString)=>{
|
|
74
|
+
const [year, month] = dateString.split('-').map(Number);
|
|
75
|
+
await locator(page, blockId).click();
|
|
76
|
+
const dropdown = page.locator('.ant-picker-dropdown:visible');
|
|
77
|
+
await expect(dropdown).toBeVisible();
|
|
78
|
+
await navigateToMonth(dropdown, year, month);
|
|
79
|
+
await dropdown.locator(`.ant-picker-cell-in-view[title="${dateString}"]`).click();
|
|
80
|
+
},
|
|
23
81
|
clear: async (page, blockId)=>{
|
|
24
82
|
await locator(page, blockId).hover();
|
|
25
83
|
await locator(page, blockId).locator('.ant-picker-clear').click();
|
|
@@ -16,10 +16,84 @@
|
|
|
16
16
|
import { expect } from '@playwright/test';
|
|
17
17
|
const locator = (page, blockId)=>page.locator(`.ant-picker:has(#${escapeId(blockId)}_input)`);
|
|
18
18
|
const input = (page, blockId)=>page.locator(`#${escapeId(blockId)}_input`);
|
|
19
|
+
const monthNames = [
|
|
20
|
+
'Jan',
|
|
21
|
+
'Feb',
|
|
22
|
+
'Mar',
|
|
23
|
+
'Apr',
|
|
24
|
+
'May',
|
|
25
|
+
'Jun',
|
|
26
|
+
'Jul',
|
|
27
|
+
'Aug',
|
|
28
|
+
'Sep',
|
|
29
|
+
'Oct',
|
|
30
|
+
'Nov',
|
|
31
|
+
'Dec'
|
|
32
|
+
];
|
|
33
|
+
const navigateToMonth = async (dropdown, targetYear, targetMonth)=>{
|
|
34
|
+
const datePanel = dropdown.locator('.ant-picker-date-panel');
|
|
35
|
+
const headerView = datePanel.locator('.ant-picker-header-view');
|
|
36
|
+
while(true){
|
|
37
|
+
const headerText = await headerView.textContent();
|
|
38
|
+
const yearMatch = headerText.match(/\d{4}/);
|
|
39
|
+
if (!yearMatch) {
|
|
40
|
+
throw new Error(`Could not parse year from picker header: "${headerText}"`);
|
|
41
|
+
}
|
|
42
|
+
const currentYear = parseInt(yearMatch[0], 10);
|
|
43
|
+
if (currentYear === targetYear) break;
|
|
44
|
+
if (currentYear > targetYear) {
|
|
45
|
+
await datePanel.locator('.ant-picker-header-super-prev-btn').click();
|
|
46
|
+
} else {
|
|
47
|
+
await datePanel.locator('.ant-picker-header-super-next-btn').click();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
while(true){
|
|
51
|
+
const headerText = await headerView.textContent();
|
|
52
|
+
const currentMonthName = monthNames.find((m)=>headerText.includes(m));
|
|
53
|
+
if (!currentMonthName) {
|
|
54
|
+
throw new Error(`Could not parse month from picker header: "${headerText}"`);
|
|
55
|
+
}
|
|
56
|
+
const currentMonth = monthNames.indexOf(currentMonthName) + 1;
|
|
57
|
+
if (currentMonth === targetMonth) break;
|
|
58
|
+
if (currentMonth > targetMonth) {
|
|
59
|
+
await datePanel.locator('.ant-picker-header-prev-btn').click();
|
|
60
|
+
} else {
|
|
61
|
+
await datePanel.locator('.ant-picker-header-next-btn').click();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
19
65
|
export default createBlockHelper({
|
|
20
66
|
locator,
|
|
21
67
|
do: {
|
|
22
68
|
open: (page, blockId)=>locator(page, blockId).click(),
|
|
69
|
+
fill: async (page, blockId, val)=>{
|
|
70
|
+
await input(page, blockId).click();
|
|
71
|
+
await page.keyboard.type(val);
|
|
72
|
+
await page.keyboard.press('Enter');
|
|
73
|
+
},
|
|
74
|
+
select: async (page, blockId, dateTimeString)=>{
|
|
75
|
+
const [datePart, timePart] = dateTimeString.split(' ');
|
|
76
|
+
const [year, month] = datePart.split('-').map(Number);
|
|
77
|
+
await locator(page, blockId).click();
|
|
78
|
+
const dropdown = page.locator('.ant-picker-dropdown:visible');
|
|
79
|
+
await expect(dropdown).toBeVisible();
|
|
80
|
+
await navigateToMonth(dropdown, year, month);
|
|
81
|
+
await dropdown.locator(`.ant-picker-cell-in-view[title="${datePart}"]`).click();
|
|
82
|
+
if (timePart) {
|
|
83
|
+
const [hour, minute] = timePart.split(':');
|
|
84
|
+
const columns = dropdown.locator('.ant-picker-time-panel-column');
|
|
85
|
+
// Select hour
|
|
86
|
+
await columns.nth(0).locator(`li`).filter({
|
|
87
|
+
hasText: new RegExp(`^${hour}$`)
|
|
88
|
+
}).click();
|
|
89
|
+
// Select minute
|
|
90
|
+
await columns.nth(1).locator(`li`).filter({
|
|
91
|
+
hasText: new RegExp(`^${minute}$`)
|
|
92
|
+
}).click();
|
|
93
|
+
// Click OK to confirm
|
|
94
|
+
await dropdown.locator('.ant-picker-ok button').click();
|
|
95
|
+
}
|
|
96
|
+
},
|
|
23
97
|
clear: async (page, blockId)=>{
|
|
24
98
|
await locator(page, blockId).hover();
|
|
25
99
|
await locator(page, blockId).locator('.ant-picker-clear').click();
|
|
@@ -16,10 +16,40 @@
|
|
|
16
16
|
import { expect } from '@playwright/test';
|
|
17
17
|
const locator = (page, blockId)=>page.locator(`.ant-picker:has(#${escapeId(blockId)}_input)`);
|
|
18
18
|
const input = (page, blockId)=>page.locator(`#${escapeId(blockId)}_input`);
|
|
19
|
+
const navigateToYear = async (dropdown, targetYear)=>{
|
|
20
|
+
const headerView = dropdown.locator('.ant-picker-header-view');
|
|
21
|
+
while(true){
|
|
22
|
+
const headerText = await headerView.textContent();
|
|
23
|
+
const yearMatch = headerText.match(/\d{4}/);
|
|
24
|
+
if (!yearMatch) {
|
|
25
|
+
throw new Error(`Could not parse year from picker header: "${headerText}"`);
|
|
26
|
+
}
|
|
27
|
+
const currentYear = parseInt(yearMatch[0], 10);
|
|
28
|
+
if (currentYear === targetYear) break;
|
|
29
|
+
if (currentYear > targetYear) {
|
|
30
|
+
await dropdown.locator('.ant-picker-header-super-prev-btn').click();
|
|
31
|
+
} else {
|
|
32
|
+
await dropdown.locator('.ant-picker-header-super-next-btn').click();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
19
36
|
export default createBlockHelper({
|
|
20
37
|
locator,
|
|
21
38
|
do: {
|
|
22
39
|
open: (page, blockId)=>locator(page, blockId).click(),
|
|
40
|
+
fill: async (page, blockId, val)=>{
|
|
41
|
+
await input(page, blockId).click();
|
|
42
|
+
await page.keyboard.type(val);
|
|
43
|
+
await page.keyboard.press('Enter');
|
|
44
|
+
},
|
|
45
|
+
select: async (page, blockId, monthString)=>{
|
|
46
|
+
const [year] = monthString.split('-').map(Number);
|
|
47
|
+
await locator(page, blockId).click();
|
|
48
|
+
const dropdown = page.locator('.ant-picker-dropdown:visible');
|
|
49
|
+
await expect(dropdown).toBeVisible();
|
|
50
|
+
await navigateToYear(dropdown, year);
|
|
51
|
+
await dropdown.locator(`.ant-picker-cell-in-view[title="${monthString}"]`).click();
|
|
52
|
+
},
|
|
23
53
|
clear: async (page, blockId)=>{
|
|
24
54
|
await locator(page, blockId).hover();
|
|
25
55
|
await locator(page, blockId).locator('.ant-picker-clear').click();
|
|
@@ -16,10 +16,68 @@
|
|
|
16
16
|
import { expect } from '@playwright/test';
|
|
17
17
|
const locator = (page, blockId)=>page.locator(`.ant-picker:has(#${escapeId(blockId)}_input)`);
|
|
18
18
|
const input = (page, blockId)=>page.locator(`#${escapeId(blockId)}_input`);
|
|
19
|
+
const monthNames = [
|
|
20
|
+
'Jan',
|
|
21
|
+
'Feb',
|
|
22
|
+
'Mar',
|
|
23
|
+
'Apr',
|
|
24
|
+
'May',
|
|
25
|
+
'Jun',
|
|
26
|
+
'Jul',
|
|
27
|
+
'Aug',
|
|
28
|
+
'Sep',
|
|
29
|
+
'Oct',
|
|
30
|
+
'Nov',
|
|
31
|
+
'Dec'
|
|
32
|
+
];
|
|
33
|
+
const navigateToMonth = async (dropdown, targetYear, targetMonth)=>{
|
|
34
|
+
const headerView = dropdown.locator('.ant-picker-header-view');
|
|
35
|
+
while(true){
|
|
36
|
+
const headerText = await headerView.textContent();
|
|
37
|
+
const yearMatch = headerText.match(/\d{4}/);
|
|
38
|
+
if (!yearMatch) {
|
|
39
|
+
throw new Error(`Could not parse year from picker header: "${headerText}"`);
|
|
40
|
+
}
|
|
41
|
+
const currentYear = parseInt(yearMatch[0], 10);
|
|
42
|
+
if (currentYear === targetYear) break;
|
|
43
|
+
if (currentYear > targetYear) {
|
|
44
|
+
await dropdown.locator('.ant-picker-header-super-prev-btn').click();
|
|
45
|
+
} else {
|
|
46
|
+
await dropdown.locator('.ant-picker-header-super-next-btn').click();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
while(true){
|
|
50
|
+
const headerText = await headerView.textContent();
|
|
51
|
+
const currentMonthName = monthNames.find((m)=>headerText.includes(m));
|
|
52
|
+
if (!currentMonthName) {
|
|
53
|
+
throw new Error(`Could not parse month from picker header: "${headerText}"`);
|
|
54
|
+
}
|
|
55
|
+
const currentMonth = monthNames.indexOf(currentMonthName) + 1;
|
|
56
|
+
if (currentMonth === targetMonth) break;
|
|
57
|
+
if (currentMonth > targetMonth) {
|
|
58
|
+
await dropdown.locator('.ant-picker-header-prev-btn').click();
|
|
59
|
+
} else {
|
|
60
|
+
await dropdown.locator('.ant-picker-header-next-btn').click();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
19
64
|
export default createBlockHelper({
|
|
20
65
|
locator,
|
|
21
66
|
do: {
|
|
22
67
|
open: (page, blockId)=>locator(page, blockId).click(),
|
|
68
|
+
fill: async (page, blockId, val)=>{
|
|
69
|
+
await input(page, blockId).click();
|
|
70
|
+
await page.keyboard.type(val);
|
|
71
|
+
await page.keyboard.press('Enter');
|
|
72
|
+
},
|
|
73
|
+
select: async (page, blockId, dateString)=>{
|
|
74
|
+
const [year, month] = dateString.split('-').map(Number);
|
|
75
|
+
await locator(page, blockId).click();
|
|
76
|
+
const dropdown = page.locator('.ant-picker-dropdown:visible');
|
|
77
|
+
await expect(dropdown).toBeVisible();
|
|
78
|
+
await navigateToMonth(dropdown, year, month);
|
|
79
|
+
await dropdown.locator(`.ant-picker-cell-in-view[title="${dateString}"]`).click();
|
|
80
|
+
},
|
|
23
81
|
clear: async (page, blockId)=>{
|
|
24
82
|
await locator(page, blockId).hover();
|
|
25
83
|
await locator(page, blockId).locator('.ant-picker-clear').click();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/blocks-antd",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy Ant Design Blocks",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@ant-design/icons": "4.8.0",
|
|
48
|
-
"@lowdefy/block-utils": "4.7.
|
|
49
|
-
"@lowdefy/helpers": "4.7.
|
|
48
|
+
"@lowdefy/block-utils": "4.7.1",
|
|
49
|
+
"@lowdefy/helpers": "4.7.1",
|
|
50
50
|
"antd": "4.24.14",
|
|
51
51
|
"classnames": "2.3.2",
|
|
52
52
|
"moment": "2.29.4",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"tinycolor2": "1.6.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@lowdefy/block-dev-e2e": "4.7.
|
|
60
|
-
"@lowdefy/e2e-utils": "4.7.
|
|
59
|
+
"@lowdefy/block-dev-e2e": "4.7.1",
|
|
60
|
+
"@lowdefy/e2e-utils": "4.7.1",
|
|
61
61
|
"@playwright/test": "1.50.1",
|
|
62
|
-
"@lowdefy/node-utils": "4.7.
|
|
62
|
+
"@lowdefy/node-utils": "4.7.1",
|
|
63
63
|
"@swc/cli": "0.1.63",
|
|
64
64
|
"@swc/core": "1.3.99",
|
|
65
65
|
"copyfiles": "2.4.1"
|