@uxf/e2e 11.35.0 → 11.36.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/components.d.ts CHANGED
@@ -9,6 +9,7 @@ import { datePickerInput } from "./ui/date-picker-input";
9
9
  import { datetimePickerInput } from "./ui/datetime-picker-input";
10
10
  import { dropzone } from "./ui/dropzone";
11
11
  import { flashMessage } from "./ui/flash-message";
12
+ import { iconButton } from "./ui/icon-button";
12
13
  import { input } from "./ui/input";
13
14
  import { message } from "./ui/message";
14
15
  import { modal } from "./ui/modal";
@@ -18,6 +19,7 @@ import { select } from "./ui/select";
18
19
  import { textInput } from "./ui/text-input";
19
20
  import { textLink } from "./ui/text-link";
20
21
  import { textarea } from "./ui/textarea";
22
+ import { toggle } from "./ui/toggle";
21
23
  export declare const components: {
22
24
  button: typeof button;
23
25
  buttonGroup: typeof buttonGroup;
@@ -29,6 +31,7 @@ export declare const components: {
29
31
  flashMessage: typeof flashMessage;
30
32
  checkboxButton: typeof checkboxButton;
31
33
  checkboxInput: typeof checkboxInput;
34
+ iconButton: typeof iconButton;
32
35
  input: typeof input;
33
36
  message: typeof message;
34
37
  modal: typeof modal;
@@ -38,6 +41,7 @@ export declare const components: {
38
41
  textarea: typeof textarea;
39
42
  textInput: typeof textInput;
40
43
  textLink: typeof textLink;
44
+ toggle: typeof toggle;
41
45
  cms: {
42
46
  menu: typeof menu;
43
47
  };
package/components.js CHANGED
@@ -12,6 +12,7 @@ const date_picker_input_1 = require("./ui/date-picker-input");
12
12
  const datetime_picker_input_1 = require("./ui/datetime-picker-input");
13
13
  const dropzone_1 = require("./ui/dropzone");
14
14
  const flash_message_1 = require("./ui/flash-message");
15
+ const icon_button_1 = require("./ui/icon-button");
15
16
  const input_1 = require("./ui/input");
16
17
  const message_1 = require("./ui/message");
17
18
  const modal_1 = require("./ui/modal");
@@ -21,6 +22,7 @@ const select_1 = require("./ui/select");
21
22
  const text_input_1 = require("./ui/text-input");
22
23
  const text_link_1 = require("./ui/text-link");
23
24
  const textarea_1 = require("./ui/textarea");
25
+ const toggle_1 = require("./ui/toggle");
24
26
  exports.components = {
25
27
  button: button_1.button,
26
28
  buttonGroup: button_group_1.buttonGroup,
@@ -32,6 +34,7 @@ exports.components = {
32
34
  flashMessage: flash_message_1.flashMessage,
33
35
  checkboxButton: checkbox_button_1.checkboxButton,
34
36
  checkboxInput: checkbox_input_1.checkboxInput,
37
+ iconButton: icon_button_1.iconButton,
35
38
  input: input_1.input,
36
39
  message: message_1.message,
37
40
  modal: modal_1.modal,
@@ -41,6 +44,7 @@ exports.components = {
41
44
  textarea: textarea_1.textarea,
42
45
  textInput: text_input_1.textInput,
43
46
  textLink: text_link_1.textLink,
47
+ toggle: toggle_1.toggle,
44
48
  cms: {
45
49
  menu: menu_1.menu,
46
50
  },
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
- "name": "@uxf/e2e",
3
- "version": "11.35.0",
4
- "description": "UXF TestCafe helpers",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "scripts": {
9
- "build": "npm run compile",
10
- "compile": "tsc -P tsconfig.json",
11
- "e2e": "../../node_modules/.bin/testcafe chrome ./tests",
12
- "e2e:dev": "../../node_modules/.bin/testcafe chrome ./tests --live",
13
- "typecheck": "../../node_modules/.bin/tsc --noEmit --skipLibCheck"
14
- },
15
- "author": "UX Fans s.r.o",
16
- "license": "MIT",
17
- "devDependencies": {
18
- "testcafe": "3.6.2"
19
- },
20
- "peerDependencies": {
21
- "testcafe": "3.6.2"
22
- }
23
- }
2
+ "name": "@uxf/e2e",
3
+ "version": "11.36.0",
4
+ "description": "UXF TestCafe helpers",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "scripts": {
9
+ "build": "npm run compile",
10
+ "compile": "tsc -P tsconfig.json",
11
+ "e2e": "../../node_modules/.bin/testcafe chrome ./tests",
12
+ "e2e:dev": "../../node_modules/.bin/testcafe chrome ./tests --live",
13
+ "typecheck": "../../node_modules/.bin/tsc --noEmit --skipLibCheck"
14
+ },
15
+ "author": "UX Fans s.r.o",
16
+ "license": "MIT",
17
+ "devDependencies": {
18
+ "testcafe": "3.6.2"
19
+ },
20
+ "peerDependencies": {
21
+ "testcafe": "3.6.2"
22
+ }
23
+ }
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const testcafe_1 = require("testcafe");
4
4
  const components_1 = require("../components");
5
5
  const wait_for_react_1 = require("../utils/wait-for-react");
6
- (0, testcafe_1.fixture)("Home page")
6
+ (0, testcafe_1.fixture)("Button")
7
7
  .page("https://fe.uxf.dev/examples/ui/button/Default")
8
8
  .httpAuth({ username: "uxf", password: "uxf" })
9
9
  .beforeEach(async (t) => {
10
10
  await (0, wait_for_react_1.waitForReact)(10000, t);
11
11
  });
12
12
  (0, testcafe_1.test)("UI Button", async () => {
13
+ await components_1.components.button({ text: "Default" }).click();
13
14
  await components_1.components.button({ text: "Default" }).shouldExists();
14
15
  await components_1.components.button({ text: "Not found" }).shouldNotExists();
16
+ await components_1.components.button({ text: "Disabled" }).shouldBeDisabled();
17
+ await components_1.components.button({ text: "Custom width" }).shouldNotBeDisabled();
15
18
  });
@@ -4,17 +4,28 @@ const testcafe_1 = require("testcafe");
4
4
  const components_1 = require("../components");
5
5
  const wait_for_react_1 = require("../utils/wait-for-react");
6
6
  (0, testcafe_1.fixture)("Combobox")
7
- .page("https://fe.uxf.dev/examples/ui/combobox/Default")
7
+ .page("https://fe.uxf.dev/examples/form/combobox/Default")
8
8
  .httpAuth({ username: "uxf", password: "uxf" })
9
9
  .beforeEach(async (t) => {
10
10
  await (0, wait_for_react_1.waitForReact)(10000, t);
11
11
  });
12
12
  (0, testcafe_1.test)("Combobox", async () => {
13
- const defaultCombobox = components_1.components.combobox({ dataName: "combobox" });
13
+ const defaultCombobox = components_1.components.combobox({ dataName: "firstname" });
14
+ await components_1.components.button({ text: "Submit" }).click();
15
+ await components_1.components.combobox({ dataName: "combobox-required" }).shouldBeInvalid();
16
+ await components_1.components.combobox({ dataName: "combobox-required" }).shouldShowInvalidText("Toto pole je povinné");
17
+ await components_1.components.combobox({ dataName: "combobox-required" }).shouldBeRequired();
14
18
  await defaultCombobox.shouldExist();
15
19
  await defaultCombobox.shouldBeEmpty();
16
20
  await defaultCombobox.selectItemWithTextFromDropdown("Option one");
17
21
  await defaultCombobox.shouldHaveValue("Option one");
18
- await components_1.components.combobox({ dataName: "combobox", nth: 1 }).replace("Option three");
19
- await components_1.components.combobox({ dataName: "combobox", nth: 1 }).shouldHaveValue("Option three");
22
+ await components_1.components.combobox({ dataName: "combobox-required" }).replace("Option three");
23
+ await components_1.components.combobox({ dataName: "combobox-required" }).shouldHaveValue("Option three");
24
+ await components_1.components.combobox({ dataName: "combobox-disabled" }).shouldBeDisabled();
25
+ await components_1.components.combobox({ dataName: "firstname" }).shouldNotBeDisabled();
26
+ await (0, testcafe_1.ClientFunction)(() => {
27
+ document.location.reload();
28
+ })();
29
+ await defaultCombobox.typeTextAndSelectItemByIndex("Option t");
30
+ await defaultCombobox.shouldHaveValue("Option two");
20
31
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const testcafe_1 = require("testcafe");
4
+ const components_1 = require("../components");
5
+ const wait_for_react_1 = require("../utils/wait-for-react");
6
+ (0, testcafe_1.fixture)("Icon button")
7
+ .page("https://fe.uxf.dev/examples/ui/icon-button/Default")
8
+ .httpAuth({ username: "uxf", password: "uxf" })
9
+ .beforeEach(async (t) => {
10
+ await (0, wait_for_react_1.waitForReact)(10000, t);
11
+ });
12
+ (0, testcafe_1.test)("UI Icon Button", async () => {
13
+ await components_1.components.iconButton({ iconName: "icon-sprite--user" }).shouldExists();
14
+ await components_1.components.iconButton({ iconName: "whatever-icon" }).shouldNotExists();
15
+ await components_1.components.iconButton({ iconName: "icon-sprite--user" }).click();
16
+ await components_1.components.iconButton({ iconName: "icon-sprite--user" }).shouldNotBeDisabled();
17
+ await components_1.components.toggle({ text: "Disabled" }).click();
18
+ await components_1.components.iconButton({ iconName: "icon-sprite--user" }).shouldBeDisabled();
19
+ });
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const testcafe_1 = require("testcafe");
4
4
  const components_1 = require("../components");
5
+ const select_1 = require("../ui/select");
5
6
  const wait_for_react_1 = require("../utils/wait-for-react");
6
7
  (0, testcafe_1.fixture)("Select")
7
8
  .page("https://fe.uxf.dev/examples/ui/select/Default")
@@ -15,4 +16,10 @@ const wait_for_react_1 = require("../utils/wait-for-react");
15
16
  await defaultSelect.selectNthItem(2);
16
17
  await defaultSelect.shouldHaveValue("Option three");
17
18
  await defaultSelect.shouldNotBeEmpty();
19
+ await defaultSelect.shouldExists();
20
+ await (0, select_1.select)({ dataName: "test" }).shouldNotExists();
21
+ await (0, select_1.select)({ dataName: "select-disabled" }).shouldBeDisabled();
22
+ await defaultSelect.shouldNotBeDisabled();
23
+ await defaultSelect.selectItemWithText("Option six");
24
+ await defaultSelect.shouldHaveValue("Option six");
18
25
  });
@@ -32,7 +32,6 @@ const wait_for_react_1 = require("../utils/wait-for-react");
32
32
  });
33
33
  (0, testcafe_1.test)("Menu mobile", async () => {
34
34
  await testcafe_1.t.resizeWindow(390, 844);
35
- await testcafe_1.t.setTestSpeed(0.5);
36
35
  await components_1.components.textInput({ name: "username" }).type("root@uxf.cz");
37
36
  await components_1.components.textInput({ name: "password" }).type("root");
38
37
  await components_1.components.button({ text: "Přihlásit se" }).click();
@@ -12,11 +12,13 @@ const wait_for_react_1 = require("../utils/wait-for-react");
12
12
  (0, testcafe_1.test)("Text input", async () => {
13
13
  const defaultInput = components_1.components.textInput({ name: "default" });
14
14
  await defaultInput.shouldNotBeDisabled();
15
- await defaultInput.type("Value");
16
- await defaultInput.shouldHaveValue("Value");
17
- await defaultInput.type(" suffix");
18
- await defaultInput.shouldHaveValue("Value suffix");
15
+ await defaultInput.type("Lorem");
16
+ await defaultInput.shouldHaveValue("Lorem");
17
+ await defaultInput.type(" ipsum");
18
+ await defaultInput.shouldHaveValue("Lorem ipsum");
19
19
  await defaultInput.replace("Replaced value");
20
20
  await defaultInput.shouldHaveValue("Replaced value");
21
+ await defaultInput.shouldExist();
22
+ await components_1.components.textInput({ name: "defaultt" }).shouldNotExist();
21
23
  await components_1.components.textInput({ name: "disabled" }).shouldBeDisabled();
22
24
  });
@@ -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 wait_for_react_1 = require("../utils/wait-for-react");
6
+ (0, testcafe_1.fixture)("Toggle")
7
+ .page("https://fe.uxf.dev/examples/ui/toggle/Default")
8
+ .httpAuth({ username: "uxf", password: "uxf" })
9
+ .beforeEach(async (t) => {
10
+ await (0, wait_for_react_1.waitForReact)(10000, t);
11
+ });
12
+ (0, testcafe_1.test)("UI Toggle", async () => {
13
+ await components_1.components.toggle({ text: "Opravdu?" }).shouldExists();
14
+ await components_1.components.toggle({ text: "example?" }).shouldNotExists();
15
+ await components_1.components.toggle({ text: "Opravdu?" }).shouldNotBeDisabled();
16
+ await components_1.components.toggle({ text: "Opravdu?" }).shouldBeSelected();
17
+ await components_1.components.toggle({ text: "Opravdu?" }).click();
18
+ await components_1.components.toggle({ text: "Opravdu?" }).shouldNotBeSelected();
19
+ await components_1.components.toggle({ text: "Disabled" }).shouldBeDisabled();
20
+ });
package/ui/button.d.ts CHANGED
@@ -7,6 +7,7 @@ export declare function button(finder: ButtonFinder): {
7
7
  click(): TestControllerPromise<any>;
8
8
  shouldExists(): TestControllerPromise<any>;
9
9
  shouldNotExists(): TestControllerPromise<any>;
10
- shouldBeDisabled(): void;
10
+ shouldBeDisabled(): TestControllerPromise<any>;
11
+ shouldNotBeDisabled(): TestControllerPromise<any>;
11
12
  };
12
13
  export {};
package/ui/button.js CHANGED
@@ -14,13 +14,20 @@ function button(finder) {
14
14
  return testcafe_1.t.click(selector);
15
15
  },
16
16
  shouldExists() {
17
- return testcafe_1.t.expect(selector.exists).ok();
17
+ return testcafe_1.t.expect(selector.exists).ok(`Button ${finder.text} should exists but it does not exists`);
18
18
  },
19
19
  shouldNotExists() {
20
- return testcafe_1.t.expect(selector.exists).notOk();
20
+ return testcafe_1.t.expect(selector.exists).notOk(`Button ${finder.text} should not exists but it exists`);
21
21
  },
22
22
  shouldBeDisabled() {
23
- // TODO
23
+ return testcafe_1.t
24
+ .expect(selector.hasClass("uxf-button--is-disabled"))
25
+ .ok(`Button ${finder.text} should be disabled but is not disabled`);
26
+ },
27
+ shouldNotBeDisabled() {
28
+ return testcafe_1.t
29
+ .expect(selector.hasClass("uxf-button--is-disabled"))
30
+ .notOk(`Button ${finder.text} should not disabled but is disabled`);
24
31
  },
25
32
  };
26
33
  }
package/ui/combobox.d.ts CHANGED
@@ -10,5 +10,10 @@ export declare function combobox(finder: ComboboxFinder): {
10
10
  shouldHaveValue(value: string): TestControllerPromise<any>;
11
11
  shouldBeEmpty(): TestControllerPromise<any>;
12
12
  replace(optionText: string, index?: number): TestControllerPromise<any>;
13
+ shouldBeDisabled(): TestControllerPromise<any>;
14
+ shouldNotBeDisabled(): TestControllerPromise<any>;
15
+ shouldBeInvalid(): TestControllerPromise<any>;
16
+ shouldShowInvalidText(errorText: string): TestControllerPromise<any>;
17
+ shouldBeRequired(): TestControllerPromise<any>;
13
18
  };
14
19
  export {};
package/ui/combobox.js CHANGED
@@ -33,5 +33,20 @@ function combobox(finder) {
33
33
  .typeText(comboboxSelector, optionText, { replace: true })
34
34
  .click((0, testcafe_1.Selector)("li.uxf-dropdown__item").nth(index));
35
35
  },
36
+ shouldBeDisabled() {
37
+ return testcafe_1.t.expect(comboboxSelector.find("div").hasClass("is-disabled")).ok();
38
+ },
39
+ shouldNotBeDisabled() {
40
+ return testcafe_1.t.expect(comboboxSelector.find("div").hasClass("is-disabled")).notOk();
41
+ },
42
+ shouldBeInvalid() {
43
+ return testcafe_1.t.expect(comboboxSelector.parent().hasClass("is-invalid")).ok();
44
+ },
45
+ shouldShowInvalidText(errorText) {
46
+ return testcafe_1.t.expect(comboboxSelector.innerText).contains(errorText);
47
+ },
48
+ shouldBeRequired() {
49
+ return testcafe_1.t.expect(comboboxSelector.parent().hasClass("is-required")).ok();
50
+ },
36
51
  };
37
52
  }
@@ -26,7 +26,7 @@ function datePickerInput(finder) {
26
26
  return testcafe_1.t.expect(datepickerInputSelector.hasClass("is-disabled")).notOk();
27
27
  },
28
28
  shouldBeInvalid() {
29
- return testcafe_1.t.expect(datepickerInputSelector.hasAttribute("disabled")).notOk();
29
+ return testcafe_1.t.expect(datepickerInputSelector.hasClass("is-invalid")).ok();
30
30
  },
31
31
  clear() {
32
32
  return testcafe_1.t.click(datepickerInputSelector.find(".uxf-input__remove-button-inner"));
package/ui/dropzone.js CHANGED
@@ -21,5 +21,6 @@ function dropzone(finder) {
21
21
  uploadFiles(filesToUpload) {
22
22
  return testcafe_1.t.setFilesToUpload(dropzoneSelector, filesToUpload);
23
23
  },
24
+ //TODO v ui kitu nové featury - dodělate metody a test
24
25
  };
25
26
  }
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flashMessage = flashMessage;
4
- const empty_object_1 = require("@uxf/core/constants/empty-object");
5
4
  const testcafe_1 = require("testcafe");
6
5
  const create_selector_1 = require("../utils/create-selector");
7
6
  function flashMessage(finder) {
8
- const FlashMessageSelector = (0, create_selector_1.createSelector)(finder !== null && finder !== void 0 ? finder : empty_object_1.EMPTY_OBJECT).find(".uxf-flash-messages");
7
+ const FlashMessageSelector = (0, create_selector_1.createSelector)(finder !== null && finder !== void 0 ? finder : {}).find(".uxf-flash-messages");
9
8
  return {
10
9
  shouldExists() {
11
10
  return testcafe_1.t.expect(FlashMessageSelector.exists).ok();
@@ -0,0 +1,13 @@
1
+ import { BaseFinder } from "../utils/base-finder";
2
+ interface IconFinder extends BaseFinder {
3
+ iconName: string;
4
+ nth?: number;
5
+ }
6
+ export declare function iconButton(finder: IconFinder): {
7
+ click(): TestControllerPromise<any>;
8
+ shouldExists(): TestControllerPromise<any>;
9
+ shouldNotExists(): TestControllerPromise<any>;
10
+ shouldBeDisabled(): TestControllerPromise<any>;
11
+ shouldNotBeDisabled(): TestControllerPromise<any>;
12
+ };
13
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.iconButton = iconButton;
4
+ const testcafe_1 = require("testcafe");
5
+ const create_selector_1 = require("../utils/create-selector");
6
+ function iconButton(finder) {
7
+ var _a;
8
+ const iconPattern = new RegExp(`#${finder.iconName}$`);
9
+ const selector = (0, create_selector_1.createSelector)(finder)
10
+ .find("use")
11
+ .withAttribute("xlink:href", iconPattern)
12
+ .nth((_a = finder.nth) !== null && _a !== void 0 ? _a : 0);
13
+ const clickableParent = selector.parent("a");
14
+ return {
15
+ click() {
16
+ return testcafe_1.t.click(clickableParent);
17
+ },
18
+ shouldExists() {
19
+ return testcafe_1.t
20
+ .expect(clickableParent.exists)
21
+ .ok(`Icon with xlink:href containing "${iconPattern}" should exist but does not.`);
22
+ },
23
+ shouldNotExists() {
24
+ return testcafe_1.t
25
+ .expect(clickableParent.exists)
26
+ .notOk(`Icon with xlink:href containing "${iconPattern}" should not exist but it does.`);
27
+ },
28
+ shouldBeDisabled() {
29
+ return testcafe_1.t
30
+ .expect(clickableParent.hasClass("is-disabled"))
31
+ .ok(`Icon button with xlink:href containing ${iconPattern} should be disabled but it is not disabled or does not exist`);
32
+ },
33
+ shouldNotBeDisabled() {
34
+ return testcafe_1.t
35
+ .expect(clickableParent.hasClass("is-disabled"))
36
+ .notOk(`Icon button with xlink:href containing ${iconPattern} should be enabled but it is not enabled or does not exist`);
37
+ },
38
+ };
39
+ }
package/ui/input.d.ts CHANGED
@@ -8,5 +8,7 @@ export declare function input(finder: InputFinder): {
8
8
  shouldHaveValue(value: string): TestControllerPromise<any>;
9
9
  shouldBeDisabled(): TestControllerPromise<any>;
10
10
  shouldNotBeDisabled(): TestControllerPromise<any>;
11
+ shouldExist(): TestControllerPromise<any>;
12
+ shouldNotExist(): TestControllerPromise<any>;
11
13
  };
12
14
  export {};
package/ui/input.js CHANGED
@@ -21,5 +21,11 @@ function input(finder) {
21
21
  shouldNotBeDisabled() {
22
22
  return testcafe_1.t.expect(inputElementSelector.hasAttribute("disabled")).notOk();
23
23
  },
24
+ shouldExist() {
25
+ return testcafe_1.t.expect(inputElementSelector.exists).ok();
26
+ },
27
+ shouldNotExist() {
28
+ return testcafe_1.t.expect(inputElementSelector.exists).notOk();
29
+ },
24
30
  };
25
31
  }
package/ui/select.d.ts CHANGED
@@ -4,9 +4,13 @@ interface SelectInputFinder extends BaseFinder {
4
4
  }
5
5
  export declare function select(finder: SelectInputFinder): {
6
6
  selectNthItem(nth: number): TestControllerPromise<any>;
7
+ selectItemWithText(optionText: string, nth?: number): TestControllerPromise<any>;
7
8
  shouldHaveValue(value: string): TestControllerPromise<any>;
8
9
  shouldBeEmpty(): TestControllerPromise<any>;
9
10
  shouldNotBeEmpty(): TestControllerPromise<any>;
10
- shouldBeDisabled(): void;
11
+ shouldBeDisabled(): TestControllerPromise<any>;
12
+ shouldNotBeDisabled(): TestControllerPromise<any>;
13
+ shouldExists(): TestControllerPromise<any>;
14
+ shouldNotExists(): TestControllerPromise<any>;
11
15
  };
12
16
  export {};
package/ui/select.js CHANGED
@@ -13,6 +13,9 @@ function select(finder) {
13
13
  // TODO - asi použít helper na dropdown až bude existovat
14
14
  return testcafe_1.t.click(buttonSelector).click((0, testcafe_1.Selector)(".uxf-dropdown__item").nth(nth));
15
15
  },
16
+ selectItemWithText(optionText, nth = 0) {
17
+ return testcafe_1.t.click(buttonSelector).click((0, testcafe_1.Selector)(".uxf-dropdown__item").withText(optionText).nth(nth));
18
+ },
16
19
  shouldHaveValue(value) {
17
20
  return testcafe_1.t.expect(buttonSelector.textContent).eql(value);
18
21
  },
@@ -23,7 +26,16 @@ function select(finder) {
23
26
  return testcafe_1.t.expect(buttonSelector.hasClass("is-empty")).notOk();
24
27
  },
25
28
  shouldBeDisabled() {
26
- //TODO chytáme ten selector moc zanořený. Pak se nedá chytit is-disabled
29
+ return testcafe_1.t.expect(buttonSelector.parent(1).hasClass("is-disabled")).ok();
30
+ },
31
+ shouldNotBeDisabled() {
32
+ return testcafe_1.t.expect(buttonSelector.parent(1).hasClass("is-disabled")).notOk();
33
+ },
34
+ shouldExists() {
35
+ return testcafe_1.t.expect(buttonSelector.exists).ok(`Select with data-name: ${finder.dataName} should exists`);
36
+ },
37
+ shouldNotExists() {
38
+ return testcafe_1.t.expect(buttonSelector.exists).notOk(`Select with data-name: ${finder.dataName} should not exists`);
27
39
  },
28
40
  };
29
41
  }
@@ -8,5 +8,7 @@ export declare function textInput(finder: TextInputFinder): {
8
8
  shouldHaveValue(value: string): TestControllerPromise<any>;
9
9
  shouldBeDisabled(): TestControllerPromise<any>;
10
10
  shouldNotBeDisabled(): TestControllerPromise<any>;
11
+ shouldExist(): TestControllerPromise<any>;
12
+ shouldNotExist(): TestControllerPromise<any>;
11
13
  };
12
14
  export {};
package/ui/text-input.js CHANGED
@@ -19,5 +19,11 @@ function textInput(finder) {
19
19
  shouldNotBeDisabled() {
20
20
  return (0, input_1.input)(finder).shouldNotBeDisabled();
21
21
  },
22
+ shouldExist() {
23
+ return (0, input_1.input)(finder).shouldExist();
24
+ },
25
+ shouldNotExist() {
26
+ return (0, input_1.input)(finder).shouldNotExist();
27
+ },
22
28
  };
23
29
  }
package/ui/toggle.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { BaseFinder } from "../utils/base-finder";
2
+ interface ToggleFinder extends BaseFinder {
3
+ text: string;
4
+ nth?: number;
5
+ }
6
+ export declare function toggle(finder: ToggleFinder): {
7
+ click(): TestControllerPromise<any>;
8
+ shouldExists(): TestControllerPromise<any>;
9
+ shouldNotExists(): TestControllerPromise<any>;
10
+ shouldBeDisabled(): TestControllerPromise<any>;
11
+ shouldNotBeDisabled(): TestControllerPromise<any>;
12
+ shouldNotBeSelected(): TestControllerPromise<any>;
13
+ shouldBeSelected(): TestControllerPromise<any>;
14
+ };
15
+ export {};
package/ui/toggle.js ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggle = toggle;
4
+ const testcafe_1 = require("testcafe");
5
+ const create_selector_1 = require("../utils/create-selector");
6
+ function toggle(finder) {
7
+ var _a;
8
+ const selector = (0, create_selector_1.createSelector)(finder)
9
+ .find(".uxf-toggle__wrapper")
10
+ .withExactText(finder.text)
11
+ .nth((_a = finder.nth) !== null && _a !== void 0 ? _a : 0)
12
+ .find("button");
13
+ return {
14
+ click() {
15
+ return testcafe_1.t.click(selector);
16
+ },
17
+ shouldExists() {
18
+ return testcafe_1.t.expect(selector.exists).ok(`Toggle with text ${finder.text} should exists but it was not found.`);
19
+ },
20
+ shouldNotExists() {
21
+ return testcafe_1.t
22
+ .expect(selector.exists)
23
+ .notOk(`Toggle with text ${finder.text} should not exists but it was found`);
24
+ },
25
+ shouldBeDisabled() {
26
+ return testcafe_1.t
27
+ .expect(selector.hasClass("is-disabled"))
28
+ .ok(`Toggle with text ${finder.text} should be disabled but it is not disabled or not found.`);
29
+ },
30
+ shouldNotBeDisabled() {
31
+ return testcafe_1.t
32
+ .expect(selector.hasClass("is-disabled"))
33
+ .notOk(`Toggle with text ${finder.text} should be enabled but it is disabled or not found.`);
34
+ },
35
+ shouldNotBeSelected() {
36
+ return testcafe_1.t
37
+ .expect(selector.hasClass("is-selected"))
38
+ .notOk(`Toggle with text ${finder.text} should not be selected but it is selected.`);
39
+ },
40
+ shouldBeSelected() {
41
+ return testcafe_1.t
42
+ .expect(selector.hasClass("is-selected"))
43
+ .ok(`Toggle with text ${finder.text} should be selected bu it is not selected.`);
44
+ },
45
+ };
46
+ }