@uxf/e2e 11.53.2 → 11.55.0
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.
- package/cms/menu.js +1 -1
- package/components.d.ts +3 -1
- package/components.js +3 -1
- package/package.json +1 -1
- package/tests/datagrid-v2.e2e.js +170 -12
- package/tests/dropzone.e2e.js +82 -2
- package/tests/toolbar-tab.e2e.d.ts +1 -0
- package/tests/toolbar-tab.e2e.js +20 -0
- package/ui/dropzone.d.ts +9 -1
- package/ui/dropzone.js +48 -4
- package/ui/select.d.ts +1 -1
- package/ui/select.js +2 -1
- package/ui/toolbar-tab.d.ts +13 -0
- package/ui/toolbar-tab.js +37 -0
package/cms/menu.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.menu = menu;
|
|
4
4
|
const testcafe_1 = require("testcafe");
|
|
5
|
-
const menuLinkFinder = (0, testcafe_1.Selector)(".uxf-cms-menu__item");
|
|
5
|
+
const menuLinkFinder = (0, testcafe_1.Selector)(".uxf-cms-menu__item-label");
|
|
6
6
|
function menu() {
|
|
7
7
|
return {
|
|
8
8
|
openLink(mainLabel, subLabel) {
|
package/components.d.ts
CHANGED
|
@@ -14,13 +14,14 @@ import { input } from "./ui/input";
|
|
|
14
14
|
import { message } from "./ui/message";
|
|
15
15
|
import { modal } from "./ui/modal";
|
|
16
16
|
import { multiCombobox } from "./ui/multi-combobox";
|
|
17
|
+
import { multiSelect } from "./ui/multi-select";
|
|
17
18
|
import { radioGroup } from "./ui/radio-group";
|
|
18
19
|
import { select } from "./ui/select";
|
|
19
20
|
import { textInput } from "./ui/text-input";
|
|
20
21
|
import { textLink } from "./ui/text-link";
|
|
21
22
|
import { textarea } from "./ui/textarea";
|
|
22
23
|
import { toggle } from "./ui/toggle";
|
|
23
|
-
import {
|
|
24
|
+
import { toolbarTab } from "./ui/toolbar-tab";
|
|
24
25
|
export declare const components: {
|
|
25
26
|
button: typeof button;
|
|
26
27
|
buttonGroup: typeof buttonGroup;
|
|
@@ -44,6 +45,7 @@ export declare const components: {
|
|
|
44
45
|
textInput: typeof textInput;
|
|
45
46
|
textLink: typeof textLink;
|
|
46
47
|
toggle: typeof toggle;
|
|
48
|
+
toolbarTab: typeof toolbarTab;
|
|
47
49
|
cms: {
|
|
48
50
|
menu: typeof menu;
|
|
49
51
|
};
|
package/components.js
CHANGED
|
@@ -17,13 +17,14 @@ const input_1 = require("./ui/input");
|
|
|
17
17
|
const message_1 = require("./ui/message");
|
|
18
18
|
const modal_1 = require("./ui/modal");
|
|
19
19
|
const multi_combobox_1 = require("./ui/multi-combobox");
|
|
20
|
+
const multi_select_1 = require("./ui/multi-select");
|
|
20
21
|
const radio_group_1 = require("./ui/radio-group");
|
|
21
22
|
const select_1 = require("./ui/select");
|
|
22
23
|
const text_input_1 = require("./ui/text-input");
|
|
23
24
|
const text_link_1 = require("./ui/text-link");
|
|
24
25
|
const textarea_1 = require("./ui/textarea");
|
|
25
26
|
const toggle_1 = require("./ui/toggle");
|
|
26
|
-
const
|
|
27
|
+
const toolbar_tab_1 = require("./ui/toolbar-tab");
|
|
27
28
|
exports.components = {
|
|
28
29
|
button: button_1.button,
|
|
29
30
|
buttonGroup: button_group_1.buttonGroup,
|
|
@@ -47,6 +48,7 @@ exports.components = {
|
|
|
47
48
|
textInput: text_input_1.textInput,
|
|
48
49
|
textLink: text_link_1.textLink,
|
|
49
50
|
toggle: toggle_1.toggle,
|
|
51
|
+
toolbarTab: toolbar_tab_1.toolbarTab,
|
|
50
52
|
cms: {
|
|
51
53
|
menu: menu_1.menu,
|
|
52
54
|
},
|
package/package.json
CHANGED
package/tests/datagrid-v2.e2e.js
CHANGED
|
@@ -4,13 +4,34 @@ const testcafe_1 = require("testcafe");
|
|
|
4
4
|
const components_1 = require("../components");
|
|
5
5
|
const config_1 = require("../config");
|
|
6
6
|
const wait_for_react_1 = require("../utils/wait-for-react");
|
|
7
|
+
const gridRowsCount = () => {
|
|
8
|
+
return (0, testcafe_1.Selector)(".uxf-dg-table__body > .uxf-dg-table__row").count;
|
|
9
|
+
};
|
|
10
|
+
// Funkce pro kontrolu viditelnosti prvku ve viewportu
|
|
11
|
+
const isElementInViewport = (0, testcafe_1.ClientFunction)((selector) => {
|
|
12
|
+
const element = selector();
|
|
13
|
+
if (!element) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const rect = element.getBoundingClientRect();
|
|
17
|
+
const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
18
|
+
const windowWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
19
|
+
// Podmínka pro ověření, že celý prvek je viditelný
|
|
20
|
+
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= windowHeight && rect.right <= windowWidth;
|
|
21
|
+
});
|
|
7
22
|
(0, testcafe_1.fixture)("Datagrid V2")
|
|
8
23
|
.page(config_1.BASE_URL + "/examples/data-grid/data-grid-v2/Default")
|
|
9
24
|
.httpAuth({ username: "uxf", password: "uxf" })
|
|
10
|
-
.beforeEach(async (
|
|
11
|
-
await (0, wait_for_react_1.waitForReact)(10000,
|
|
25
|
+
.beforeEach(async (controller) => {
|
|
26
|
+
await (0, wait_for_react_1.waitForReact)(10000, controller);
|
|
27
|
+
});
|
|
28
|
+
(0, testcafe_1.test)("Check visibility of sticky action cell in viewport", async () => {
|
|
29
|
+
await testcafe_1.t.expect(gridRowsCount()).gte(1, { timeout: 5000 });
|
|
30
|
+
const actionCellColumn = (0, testcafe_1.Selector)(".uxf-dg-table__action-cell");
|
|
31
|
+
const isVisible = await isElementInViewport(actionCellColumn);
|
|
32
|
+
await testcafe_1.t.expect(isVisible).ok(`Action at index is not visible in the viewport`);
|
|
12
33
|
});
|
|
13
|
-
(0, testcafe_1.test)("
|
|
34
|
+
(0, testcafe_1.test)("Filter per tab - not shared filters", async () => {
|
|
14
35
|
//otevření filtrů
|
|
15
36
|
await components_1.components.iconButton({ iconName: "icon-sprite--filter" }).click();
|
|
16
37
|
//number inputy Number interval (od) a Number interval (do)
|
|
@@ -39,14 +60,27 @@ const wait_for_react_1 = require("../utils/wait-for-react");
|
|
|
39
60
|
//zavření filtru
|
|
40
61
|
await components_1.components.iconButton({ iconName: "icon-sprite--xmark" }).click();
|
|
41
62
|
//kontrola zobrazení chipů
|
|
42
|
-
await t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Number interval: od 3 do 5").exists).ok();
|
|
43
|
-
await t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("E-mail: test@uxf.cz").exists).ok();
|
|
44
|
-
await t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Date: od 10/10/2030 do 10/10/2032").exists).ok();
|
|
45
|
-
await t
|
|
63
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Number interval: od 3 do 5").exists).ok();
|
|
64
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("E-mail: test@uxf.cz").exists).ok();
|
|
65
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Date: od 10/10/2030 do 10/10/2032").exists).ok();
|
|
66
|
+
await testcafe_1.t
|
|
46
67
|
.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Datetime: od 10/10/2030 10:30 AM do 10/10/2032 12:00 PM").exists)
|
|
47
68
|
.ok();
|
|
48
|
-
await t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Select:\xa0A").exists).ok();
|
|
49
|
-
await t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Multi select:\xa0Option 1, Option 2").exists).ok();
|
|
69
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Select:\xa0A").exists).ok();
|
|
70
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Multi select:\xa0Option 1, Option 2").exists).ok();
|
|
71
|
+
//přepnutí tabu
|
|
72
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).click();
|
|
73
|
+
//kontrola že se filtry nepředávájí mezi taby
|
|
74
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Number interval: od 3 do 5").exists).notOk();
|
|
75
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("E-mail: test@uxf.cz").exists).notOk();
|
|
76
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Date: od 10/10/2030 do 10/10/2032").exists).notOk();
|
|
77
|
+
await testcafe_1.t
|
|
78
|
+
.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Datetime: od 10/10/2030 10:30 AM do 10/10/2032 12:00 PM").exists)
|
|
79
|
+
.notOk();
|
|
80
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Select:\xa0A").exists).notOk();
|
|
81
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Multi select:\xa0Option 1, Option 2").exists).notOk();
|
|
82
|
+
//přepnutí tabu
|
|
83
|
+
await components_1.components.toolbarTab({ text: "All" }).click();
|
|
50
84
|
//otevření filtrů
|
|
51
85
|
await components_1.components.iconButton({ iconName: "icon-sprite--filter" }).click();
|
|
52
86
|
//smazání hodnot u number inputů
|
|
@@ -54,8 +88,8 @@ const wait_for_react_1 = require("../utils/wait-for-react");
|
|
|
54
88
|
await components_1.components.input({ name: "interval.to" }).replace(" ");
|
|
55
89
|
//samazání hotnoty text inputu email
|
|
56
90
|
const emailInput = (0, testcafe_1.Selector)(`input[name="mail"]`);
|
|
57
|
-
await t.selectText(emailInput);
|
|
58
|
-
await t.pressKey("delete");
|
|
91
|
+
await testcafe_1.t.selectText(emailInput);
|
|
92
|
+
await testcafe_1.t.pressKey("delete");
|
|
59
93
|
//smazání datepicker Date (od) a Date (do)
|
|
60
94
|
await components_1.components.datePickerInput({ dataName: "date.from" }).clear();
|
|
61
95
|
await components_1.components.datePickerInput({ dataName: "date.to" }).clear();
|
|
@@ -69,5 +103,129 @@ const wait_for_react_1 = require("../utils/wait-for-react");
|
|
|
69
103
|
//zavření filtrů
|
|
70
104
|
await components_1.components.iconButton({ iconName: "icon-sprite--xmark" }).click();
|
|
71
105
|
//kontrola, že se nezobrazují chipy nad datagridem
|
|
72
|
-
await t.expect((0, testcafe_1.Selector)(".uxf-data-grid__filter-list .uxf-chip").exists).notOk();
|
|
106
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-data-grid__filter-list .uxf-chip").exists).notOk();
|
|
107
|
+
});
|
|
108
|
+
(0, testcafe_1.test)("Sharing filters and search between tabs", async () => {
|
|
109
|
+
await testcafe_1.t.click((0, testcafe_1.Selector)(".uxf-radio-group__option-label").withText("sharedFiltersAndSearch"));
|
|
110
|
+
//otevření filtrů
|
|
111
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--filter" }).click();
|
|
112
|
+
//number inputy Number interval (od) a Number interval (do)
|
|
113
|
+
await components_1.components.input({ name: "interval.from" }).type("3");
|
|
114
|
+
await components_1.components.input({ name: "interval.from" }).shouldHaveValue("3");
|
|
115
|
+
await components_1.components.input({ name: "interval.to" }).type("5");
|
|
116
|
+
await components_1.components.input({ name: "interval.to" }).shouldHaveValue("5");
|
|
117
|
+
//zavření filtru
|
|
118
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--xmark" }).click();
|
|
119
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Number interval: od 3 do 5").exists).ok();
|
|
120
|
+
await components_1.components.textInput({ name: "fulltext" }).type("re");
|
|
121
|
+
await components_1.components.textInput({ name: "fulltext" }).shouldHaveValue("re");
|
|
122
|
+
await testcafe_1.t.expect(gridRowsCount()).eql(2, { timeout: 5000 });
|
|
123
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText("Red").exists).ok();
|
|
124
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText("Green").exists).ok();
|
|
125
|
+
await components_1.components.textInput({ name: "fulltext" }).replace("gray");
|
|
126
|
+
await components_1.components.textInput({ name: "fulltext" }).shouldHaveValue("gray");
|
|
127
|
+
await testcafe_1.t.expect(gridRowsCount()).eql(1, { timeout: 5000 });
|
|
128
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText("Gray").exists).ok();
|
|
129
|
+
//Přepnutí tabů
|
|
130
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).click();
|
|
131
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).shouldBeActive();
|
|
132
|
+
//přepuntí tabu zachová hodnotu text inputu pro fulltext
|
|
133
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText("Gray").exists).ok();
|
|
134
|
+
await testcafe_1.t.expect(gridRowsCount()).eql(1, { timeout: 5000 });
|
|
135
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText("Gray").exists).ok();
|
|
136
|
+
await components_1.components.textInput({ name: "fulltext" }).shouldHaveValue("gray");
|
|
137
|
+
});
|
|
138
|
+
(0, testcafe_1.test)("Sharing filters, search and sorts between tabs", async () => {
|
|
139
|
+
await testcafe_1.t.click((0, testcafe_1.Selector)(".uxf-radio-group__option-label").withText("sharedFiltersAndSearchAndSort"));
|
|
140
|
+
//sort Text column
|
|
141
|
+
await testcafe_1.t.click((0, testcafe_1.Selector)(".uxf-dg-table__cell--header").withText("Text"));
|
|
142
|
+
//otevření filtrů
|
|
143
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--filter" }).click();
|
|
144
|
+
//number inputy Number interval (od) a Number interval (do)
|
|
145
|
+
await components_1.components.input({ name: "interval.from" }).type("3");
|
|
146
|
+
await components_1.components.input({ name: "interval.from" }).shouldHaveValue("3");
|
|
147
|
+
await components_1.components.input({ name: "interval.to" }).type("5");
|
|
148
|
+
await components_1.components.input({ name: "interval.to" }).shouldHaveValue("5");
|
|
149
|
+
//zavření filtru
|
|
150
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--xmark" }).click();
|
|
151
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-chip").withText("Number interval: od 3 do 5").exists).ok();
|
|
152
|
+
await components_1.components.textInput({ name: "fulltext" }).type("w");
|
|
153
|
+
await components_1.components.textInput({ name: "fulltext" }).shouldHaveValue("w");
|
|
154
|
+
await testcafe_1.t.expect(gridRowsCount()).eql(2, { timeout: 5000 });
|
|
155
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText("White").exists).ok();
|
|
156
|
+
//Přepnutí tabů
|
|
157
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).click();
|
|
158
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).shouldBeActive();
|
|
159
|
+
//přepuntí tabu zachová řazení a hodnotu text inputu pro fulltext
|
|
160
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell--type-string").nth(1).innerText).contains("White");
|
|
161
|
+
await testcafe_1.t.expect(gridRowsCount()).eql(2, { timeout: 5000 });
|
|
162
|
+
await components_1.components.textInput({ name: "fulltext" }).shouldHaveValue("w");
|
|
163
|
+
});
|
|
164
|
+
const columnsName = [
|
|
165
|
+
"Id",
|
|
166
|
+
"Text",
|
|
167
|
+
"Boolean",
|
|
168
|
+
"E-mail",
|
|
169
|
+
"Phone",
|
|
170
|
+
"Link",
|
|
171
|
+
"Date",
|
|
172
|
+
"Datetime",
|
|
173
|
+
"UUID",
|
|
174
|
+
"Chip",
|
|
175
|
+
"Chips",
|
|
176
|
+
"Money",
|
|
177
|
+
"ToOne",
|
|
178
|
+
"To many",
|
|
179
|
+
];
|
|
180
|
+
async function columnsExist() {
|
|
181
|
+
await columnsName.reduce((promise, column) => promise.then(() => testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText(column).exists).ok(`${column} was found`)), Promise.resolve());
|
|
182
|
+
}
|
|
183
|
+
async function columnsNotExist() {
|
|
184
|
+
await columnsName.reduce((promise, column) => promise.then(() => testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withText(column).exists).notOk(`${column} was found`)), Promise.resolve());
|
|
185
|
+
}
|
|
186
|
+
(0, testcafe_1.test)("Columns hiding", async () => {
|
|
187
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withExactText("Id").exists).notOk();
|
|
188
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--table-columns" }).click();
|
|
189
|
+
await testcafe_1.t
|
|
190
|
+
.expect((0, testcafe_1.Selector)(".uxf-data-grid__drawer-content")
|
|
191
|
+
.find("div")
|
|
192
|
+
.withText("SKRYTÉ SLOUPCE")
|
|
193
|
+
.nextSibling()
|
|
194
|
+
.withText("Id").exists)
|
|
195
|
+
.ok();
|
|
196
|
+
await components_1.components.toggle({ text: "Id" }).click();
|
|
197
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--xmark" }).click();
|
|
198
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__cell").withExactText("Id").exists).ok();
|
|
199
|
+
await columnsExist();
|
|
200
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--table-columns" }).click();
|
|
201
|
+
await components_1.components.textLink({ text: "zobrazit vše" }).shouldNotExists();
|
|
202
|
+
await components_1.components.textLink({ text: "skrýt vše" }).click();
|
|
203
|
+
await testcafe_1.t
|
|
204
|
+
.expect((0, testcafe_1.Selector)(".uxf-data-grid__hidden-columns-title").nextSibling().innerText)
|
|
205
|
+
.contains("Tabulka má všechny sloupce skryté. Pro zobrazení vyberte sloupec níže.");
|
|
206
|
+
await components_1.components.iconButton({ iconName: "icon-sprite--xmark" }).click();
|
|
207
|
+
await columnsNotExist();
|
|
208
|
+
});
|
|
209
|
+
(0, testcafe_1.test)("Pagination", async () => {
|
|
210
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)("div").withText("Načítám...").exists).notOk({ timeout: 10000 });
|
|
211
|
+
await testcafe_1.t.click((0, testcafe_1.Selector)(".uxf-pagination__button.is-next"));
|
|
212
|
+
await testcafe_1.t.expect(gridRowsCount()).eql(1, { timeout: 5000 });
|
|
213
|
+
await testcafe_1.t.click((0, testcafe_1.Selector)(".uxf-data-grid__rows-per-page .uxf-form-component__input"));
|
|
214
|
+
await testcafe_1.t.click((0, testcafe_1.Selector)(".uxf-select__dropdown-item").withText("25"));
|
|
215
|
+
await testcafe_1.t.expect(gridRowsCount()).eql(11, { timeout: 5000 });
|
|
216
|
+
});
|
|
217
|
+
(0, testcafe_1.test)("No rows fallback", async () => {
|
|
218
|
+
await components_1.components.textInput({ name: "fulltext" }).type(" ");
|
|
219
|
+
await components_1.components.textInput({ name: "fulltext" }).shouldHaveValue(" ");
|
|
220
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)(".uxf-dg-table__no-rows-fallback").withText("Žádné záznamy").exists).ok({ timeout: 5000 });
|
|
221
|
+
});
|
|
222
|
+
(0, testcafe_1.test)("Bulk action", async () => {
|
|
223
|
+
await testcafe_1.t.expect((0, testcafe_1.Selector)("div").withText("Načítám...").exists).notOk({ timeout: 10000 });
|
|
224
|
+
await components_1.components.checkboxInput({ dataName: "select-all-rows" }).click();
|
|
225
|
+
await components_1.components.checkboxInput({ dataName: "select-all-rows" }).shouldBeChecked();
|
|
226
|
+
const selectedRowsToolbar = (0, testcafe_1.Selector)(".uxf-data-grid__selected-rows-toolbar").withText("Vybráno 10 záznamů");
|
|
227
|
+
await testcafe_1.t.expect(selectedRowsToolbar.exists).ok({ timeout: 5000 });
|
|
228
|
+
await components_1.components.button({ text: "Zrušit výběr" }).click();
|
|
229
|
+
await testcafe_1.t.expect(selectedRowsToolbar.exists).notOk({ timeout: 5000 });
|
|
230
|
+
await components_1.components.checkboxInput({ dataName: "select-all-rows" }).shouldNotBeChecked();
|
|
73
231
|
});
|
package/tests/dropzone.e2e.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const testcafe_1 = require("testcafe");
|
|
4
4
|
const components_1 = require("../components");
|
|
5
5
|
const config_1 = require("../config");
|
|
6
|
+
const dropzone_1 = require("../ui/dropzone");
|
|
6
7
|
const wait_for_react_1 = require("../utils/wait-for-react");
|
|
7
8
|
(0, testcafe_1.fixture)("Dropzone")
|
|
8
9
|
.page(config_1.BASE_URL + "/examples/ui/dropzone/Default")
|
|
@@ -10,7 +11,86 @@ const wait_for_react_1 = require("../utils/wait-for-react");
|
|
|
10
11
|
.beforeEach(async (t) => {
|
|
11
12
|
await (0, wait_for_react_1.waitForReact)(10000, t);
|
|
12
13
|
});
|
|
13
|
-
(0, testcafe_1.test)("Dropzone", async () => {
|
|
14
|
+
(0, testcafe_1.test)("Dropzone", async (t) => {
|
|
14
15
|
const defaultDropzone = components_1.components.dropzone({ name: "dropzone-disabled-drag-and-drop" });
|
|
15
|
-
await defaultDropzone.
|
|
16
|
+
await defaultDropzone.shouldExists();
|
|
17
|
+
await (0, dropzone_1.dropzone)({ name: "fake-dropzone" }).shouldNotExists();
|
|
18
|
+
await defaultDropzone.shouldNotBeDisabled();
|
|
19
|
+
// 2x nahrání souborů a check
|
|
20
|
+
await defaultDropzone.uploadFiles(["./Docx-test.docx", "./Jpg-test.jpg"], 20000);
|
|
21
|
+
await t.expect((0, testcafe_1.Selector)(".uxf-loader").exists).notOk({ timeout: 20000 });
|
|
22
|
+
await defaultDropzone.uploadFiles(["./PDF-test.pdf"], 20000);
|
|
23
|
+
await defaultDropzone.uploadedFilesShouldExist(["Docx-test.docx", "Jpg-test.jpg", "PDF-test.pdf"]);
|
|
24
|
+
//odstranění souboru a nahrání stejného souboru
|
|
25
|
+
await t.setNativeDialogHandler(() => true);
|
|
26
|
+
await defaultDropzone.removeUploadedFile("Docx-test.docx");
|
|
27
|
+
await defaultDropzone.uploadedFilesShouldNotExist(["Docx-test.docx"]);
|
|
28
|
+
await defaultDropzone.uploadFiles(["./Docx-test.docx"], 20000);
|
|
29
|
+
await defaultDropzone.uploadedFilesShouldExist(["Docx-test.docx"]);
|
|
30
|
+
let dialogHandlersHistory = await t.getNativeDialogHistory();
|
|
31
|
+
await t
|
|
32
|
+
.expect(dialogHandlersHistory[0].type)
|
|
33
|
+
.eql("confirm")
|
|
34
|
+
.expect(dialogHandlersHistory[0].text)
|
|
35
|
+
.eql("Do you want to delete the file?");
|
|
36
|
+
//Disabled
|
|
37
|
+
await (0, testcafe_1.ClientFunction)(() => {
|
|
38
|
+
document.location.reload();
|
|
39
|
+
})();
|
|
40
|
+
await t.wait(3000);
|
|
41
|
+
await components_1.components.toggle({ text: "Disabled" }).click();
|
|
42
|
+
await defaultDropzone.shouldBeDisabled();
|
|
43
|
+
await defaultDropzone.uploadFiles(["./Docx-test.docx", "Jpg-test.jpg"], 20000);
|
|
44
|
+
await t.expect((0, testcafe_1.Selector)(".uxf-dropzone-list").find(".uxf-dropzone-list__item").exists).notOk();
|
|
45
|
+
//Only images upload
|
|
46
|
+
await (0, testcafe_1.ClientFunction)(() => {
|
|
47
|
+
document.location.reload();
|
|
48
|
+
})();
|
|
49
|
+
await t.wait(3000);
|
|
50
|
+
await components_1.components.toggle({ text: "Only images upload" }).click();
|
|
51
|
+
await defaultDropzone.uploadFiles(["./Docx-test.docx", "./Jpg-test.jpg"], 20000);
|
|
52
|
+
await defaultDropzone.uploadedFilesShouldExist(["Jpg-test.jpg"]);
|
|
53
|
+
await defaultDropzone.uploadedFilesShouldNotExist(["Docx-test.docx"]);
|
|
54
|
+
//Limit file count 1
|
|
55
|
+
await (0, testcafe_1.ClientFunction)(() => {
|
|
56
|
+
document.location.reload();
|
|
57
|
+
})();
|
|
58
|
+
await t.wait(3000);
|
|
59
|
+
await components_1.components.toggle({ text: "Limit file count" }).click();
|
|
60
|
+
await defaultDropzone.uploadFiles(["./Docx-test.docx", "Jpg-test.jpg"], 20000);
|
|
61
|
+
await t.expect((0, testcafe_1.Selector)(".uxf-dropzone-list").find(".uxf-dropzone-list__item").exists).notOk();
|
|
62
|
+
await defaultDropzone.uploadFiles(["Jpg-test.jpg"], 20000);
|
|
63
|
+
await defaultDropzone.uploadedFilesShouldExist(["Jpg-test.jpg"]);
|
|
64
|
+
await defaultDropzone.uploadedFilesShouldNotExist(["Docx-test.docx"]);
|
|
65
|
+
dialogHandlersHistory = await t.getNativeDialogHistory();
|
|
66
|
+
await t
|
|
67
|
+
.expect(dialogHandlersHistory[0].type)
|
|
68
|
+
.eql("alert")
|
|
69
|
+
.expect(dialogHandlersHistory[0].text)
|
|
70
|
+
.eql("Bylo nahráno příliš mnoho souborů. Maximální počet souborů je 1");
|
|
71
|
+
//Limit file size 1MB
|
|
72
|
+
await (0, testcafe_1.ClientFunction)(() => {
|
|
73
|
+
document.location.reload();
|
|
74
|
+
})();
|
|
75
|
+
await t.wait(3000);
|
|
76
|
+
await components_1.components.toggle({ text: "Limit file size" }).click();
|
|
77
|
+
await defaultDropzone.uploadFiles(["./PNG-test.png"], 20000);
|
|
78
|
+
await t.expect((0, testcafe_1.Selector)(".uxf-dropzone-list").find(".uxf-dropzone-list__item").exists).notOk();
|
|
79
|
+
await defaultDropzone.uploadFiles(["Jpg-test.jpg"], 20000);
|
|
80
|
+
await defaultDropzone.uploadedFilesShouldExist(["Jpg-test.jpg"]);
|
|
81
|
+
await defaultDropzone.uploadedFilesShouldNotExist(["PNG-test.png"]);
|
|
82
|
+
dialogHandlersHistory = await t.getNativeDialogHistory();
|
|
83
|
+
await t
|
|
84
|
+
.expect(dialogHandlersHistory[0].type)
|
|
85
|
+
.eql("alert")
|
|
86
|
+
.expect(dialogHandlersHistory[0].text)
|
|
87
|
+
.eql("Tyto soubory jsou příliš velké a nebyly nahrány: PNG-test.png");
|
|
88
|
+
//Limit increase
|
|
89
|
+
await (0, testcafe_1.ClientFunction)(() => {
|
|
90
|
+
document.location.reload();
|
|
91
|
+
})();
|
|
92
|
+
await components_1.components.toggle({ text: "Limit file size" }).click();
|
|
93
|
+
await components_1.components.input({ name: "limit-file-size" }).replace("2");
|
|
94
|
+
await defaultDropzone.uploadFiles(["./PNG-test.png", "./Jpg-test.jpg"], 20000);
|
|
95
|
+
await defaultDropzone.uploadedFilesShouldExist(["PNG-test.png", "Jpg-test.jpg"]);
|
|
16
96
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testcafe_1 = require("testcafe");
|
|
4
|
+
const components_1 = require("../components");
|
|
5
|
+
const config_1 = require("../config");
|
|
6
|
+
const wait_for_react_1 = require("../utils/wait-for-react");
|
|
7
|
+
(0, testcafe_1.fixture)("Toolbar tab")
|
|
8
|
+
.page(config_1.BASE_URL + "/examples/data-grid/toolbar-tabs/Default")
|
|
9
|
+
.httpAuth({ username: "uxf", password: "uxf" })
|
|
10
|
+
.beforeEach(async (t) => {
|
|
11
|
+
await (0, wait_for_react_1.waitForReact)(10000, t);
|
|
12
|
+
});
|
|
13
|
+
(0, testcafe_1.test)("UI Toolbar tab", async () => {
|
|
14
|
+
await components_1.components.toolbarTab({ text: "All" }).shouldExists();
|
|
15
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).shouldExists();
|
|
16
|
+
await components_1.components.toolbarTab({ text: "Not all" }).shouldNotExists();
|
|
17
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).click();
|
|
18
|
+
await components_1.components.toolbarTab({ text: "Only odd ids blablabla" }).shouldBeActive();
|
|
19
|
+
await components_1.components.toolbarTab({ text: "All" }).shouldNotBeActive();
|
|
20
|
+
});
|
package/ui/dropzone.d.ts
CHANGED
|
@@ -9,9 +9,17 @@ export declare function dropzone(finder: DropzoneFinder): {
|
|
|
9
9
|
*
|
|
10
10
|
* @param filesToUpload cesta k souboru musí začínat ./[název souboru]
|
|
11
11
|
*
|
|
12
|
+
* @param timeout
|
|
12
13
|
* @example
|
|
13
14
|
* await defaultDropzone.uploadFiles(["./Jpg-test.jpg"]);
|
|
14
15
|
*/
|
|
15
|
-
uploadFiles(filesToUpload: Array<string
|
|
16
|
+
uploadFiles(filesToUpload: Array<string>, timeout?: number): TestControllerPromise<any>;
|
|
17
|
+
uploadedFilesShouldExist(uploadedFiles: Array<string>): Promise<void>;
|
|
18
|
+
uploadedFilesShouldNotExist(uploadedFiles: Array<string>): Promise<void>;
|
|
19
|
+
removeUploadedFile(fileName: string): Promise<void>;
|
|
20
|
+
shouldExists(): TestControllerPromise<any>;
|
|
21
|
+
shouldNotExists(): TestControllerPromise<any>;
|
|
22
|
+
shouldBeDisabled(): TestControllerPromise<any>;
|
|
23
|
+
shouldNotBeDisabled(): TestControllerPromise<any>;
|
|
16
24
|
};
|
|
17
25
|
export {};
|
package/ui/dropzone.js
CHANGED
|
@@ -5,7 +5,7 @@ const testcafe_1 = require("testcafe");
|
|
|
5
5
|
const create_selector_1 = require("../utils/create-selector");
|
|
6
6
|
function dropzone(finder) {
|
|
7
7
|
const dropzoneSelector = (0, create_selector_1.createSelector)(finder)
|
|
8
|
-
.find("
|
|
8
|
+
.find(".uxf-dropzone__input")
|
|
9
9
|
.withAttribute("name", finder.name)
|
|
10
10
|
.with({ visibilityCheck: false });
|
|
11
11
|
return {
|
|
@@ -15,12 +15,56 @@ function dropzone(finder) {
|
|
|
15
15
|
*
|
|
16
16
|
* @param filesToUpload cesta k souboru musí začínat ./[název souboru]
|
|
17
17
|
*
|
|
18
|
+
* @param timeout
|
|
18
19
|
* @example
|
|
19
20
|
* await defaultDropzone.uploadFiles(["./Jpg-test.jpg"]);
|
|
20
21
|
*/
|
|
21
|
-
uploadFiles(filesToUpload) {
|
|
22
|
-
return testcafe_1.t
|
|
22
|
+
uploadFiles(filesToUpload, timeout = 10000) {
|
|
23
|
+
return testcafe_1.t
|
|
24
|
+
.setFilesToUpload(dropzoneSelector, filesToUpload)
|
|
25
|
+
.expect(dropzoneSelector.parent(".uxf-dropzone").nextSibling(".uxf-dropzone-list").find(".uxf-loader")
|
|
26
|
+
.exists)
|
|
27
|
+
.notOk(`The loader ('.uxf-loader') is still visible after ${timeout}ms.`, { timeout });
|
|
28
|
+
},
|
|
29
|
+
async uploadedFilesShouldExist(uploadedFiles) {
|
|
30
|
+
await uploadedFiles.reduce((promise, file) => promise.then(() => testcafe_1.t
|
|
31
|
+
.expect((0, testcafe_1.Selector)(".uxf-dropzone-list").find("li").withText(file).exists)
|
|
32
|
+
.ok(`File "${file}" does not exists but it should exists in dropzone ${finder.name}`, {
|
|
33
|
+
timeout: 5000,
|
|
34
|
+
})), Promise.resolve());
|
|
35
|
+
},
|
|
36
|
+
async uploadedFilesShouldNotExist(uploadedFiles) {
|
|
37
|
+
await uploadedFiles.reduce((promise, file) => promise.then(() => testcafe_1.t
|
|
38
|
+
.expect((0, testcafe_1.Selector)(".uxf-dropzone-list").find("li").withText(file).exists)
|
|
39
|
+
.notOk(`File "${file}" exists but it should not exists in dropzone ${finder.name}`)), Promise.resolve());
|
|
40
|
+
},
|
|
41
|
+
async removeUploadedFile(fileName) {
|
|
42
|
+
await testcafe_1.t.click(dropzoneSelector
|
|
43
|
+
.parent(".uxf-dropzone")
|
|
44
|
+
.nextSibling(".uxf-dropzone-list")
|
|
45
|
+
.find(".uxf-dropzone-list__item")
|
|
46
|
+
.withText(fileName)
|
|
47
|
+
.find(".uxf-dropzone-list__item__block__remove-button__icon"));
|
|
48
|
+
},
|
|
49
|
+
shouldExists() {
|
|
50
|
+
return testcafe_1.t
|
|
51
|
+
.expect(dropzoneSelector.exists)
|
|
52
|
+
.ok(`Dropzone with name ${finder.name} not exists or was not found should exists`);
|
|
53
|
+
},
|
|
54
|
+
shouldNotExists() {
|
|
55
|
+
return testcafe_1.t
|
|
56
|
+
.expect(dropzoneSelector.exists)
|
|
57
|
+
.notOk(`Dropzone with name ${finder.name} exists but it should not exists`);
|
|
58
|
+
},
|
|
59
|
+
shouldBeDisabled() {
|
|
60
|
+
return testcafe_1.t
|
|
61
|
+
.expect(dropzoneSelector.parent().hasClass("is-disabled"))
|
|
62
|
+
.ok(`Dropzone with name ${finder.name} should be disabled but it is not disabled`);
|
|
63
|
+
},
|
|
64
|
+
shouldNotBeDisabled() {
|
|
65
|
+
return testcafe_1.t
|
|
66
|
+
.expect(dropzoneSelector.parent().hasClass("is-disabled"))
|
|
67
|
+
.notOk(`Dropzone with name ${finder.name} should not be disabled but it is disabled`);
|
|
23
68
|
},
|
|
24
|
-
//TODO v ui kitu nové featury - dodělate metody a test
|
|
25
69
|
};
|
|
26
70
|
}
|
package/ui/select.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BaseFinder } from "../utils/base-finder";
|
|
|
2
2
|
interface SelectInputFinder extends BaseFinder {
|
|
3
3
|
dataName: string;
|
|
4
4
|
}
|
|
5
|
-
export declare function select(finder: SelectInputFinder): {
|
|
5
|
+
export declare function select(finder: SelectInputFinder, selectIndex?: number): {
|
|
6
6
|
selectNthItem(nth: number): TestControllerPromise<any>;
|
|
7
7
|
selectItemWithText(optionText: string, nth?: number): TestControllerPromise<any>;
|
|
8
8
|
shouldHaveValue(value: string): TestControllerPromise<any>;
|
package/ui/select.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.select = select;
|
|
4
4
|
const testcafe_1 = require("testcafe");
|
|
5
5
|
const create_selector_1 = require("../utils/create-selector");
|
|
6
|
-
function select(finder) {
|
|
6
|
+
function select(finder, selectIndex = 0) {
|
|
7
7
|
const buttonSelector = (0, create_selector_1.createSelector)(finder)
|
|
8
8
|
.find(".uxf-select")
|
|
9
9
|
.withAttribute("data-name", finder.dataName)
|
|
10
|
+
.nth(selectIndex)
|
|
10
11
|
.find("div.uxf-input__element");
|
|
11
12
|
return {
|
|
12
13
|
selectNthItem(nth) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseFinder } from "../utils/base-finder";
|
|
2
|
+
interface ToolbarTab extends BaseFinder {
|
|
3
|
+
text: string;
|
|
4
|
+
nth?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function toolbarTab(finder: ToolbarTab): {
|
|
7
|
+
click(): TestControllerPromise<any>;
|
|
8
|
+
shouldExists(): TestControllerPromise<any>;
|
|
9
|
+
shouldNotExists(): TestControllerPromise<any>;
|
|
10
|
+
shouldNotBeActive(): TestControllerPromise<any>;
|
|
11
|
+
shouldBeActive(): TestControllerPromise<any>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toolbarTab = toolbarTab;
|
|
4
|
+
const testcafe_1 = require("testcafe");
|
|
5
|
+
const create_selector_1 = require("../utils/create-selector");
|
|
6
|
+
function toolbarTab(finder) {
|
|
7
|
+
var _a;
|
|
8
|
+
const selector = (0, create_selector_1.createSelector)(finder)
|
|
9
|
+
.find(".uxf-data-grid__toolbar-tab")
|
|
10
|
+
.withExactText(finder.text)
|
|
11
|
+
.nth((_a = finder.nth) !== null && _a !== void 0 ? _a : 0);
|
|
12
|
+
return {
|
|
13
|
+
click() {
|
|
14
|
+
return testcafe_1.t.click(selector);
|
|
15
|
+
},
|
|
16
|
+
shouldExists() {
|
|
17
|
+
return testcafe_1.t
|
|
18
|
+
.expect(selector.exists)
|
|
19
|
+
.ok(`Toolbar tab with text ${finder.text} should exists but it was not found.`);
|
|
20
|
+
},
|
|
21
|
+
shouldNotExists() {
|
|
22
|
+
return testcafe_1.t
|
|
23
|
+
.expect(selector.exists)
|
|
24
|
+
.notOk(`Toolbar tab with text ${finder.text} should not exists but it was found`);
|
|
25
|
+
},
|
|
26
|
+
shouldNotBeActive() {
|
|
27
|
+
return testcafe_1.t
|
|
28
|
+
.expect(selector.hasClass("is-active"))
|
|
29
|
+
.notOk(`Toolbar tab with text ${finder.text} should not be selected but it is active.`);
|
|
30
|
+
},
|
|
31
|
+
shouldBeActive() {
|
|
32
|
+
return testcafe_1.t
|
|
33
|
+
.expect(selector.hasClass("is-active"))
|
|
34
|
+
.ok(`Toolbar tab with text ${finder.text} should be selected bu it is not active.`);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|