expect-webdriverio 5.3.3 → 5.4.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.
Files changed (81) hide show
  1. package/jasmine.d.ts +1 -1
  2. package/lib/{src/matchers → matchers}/element/toHaveAttribute.js +1 -1
  3. package/lib/{tsconfig.tsbuildinfo → tsconfig.build.tsbuildinfo} +1 -1
  4. package/package.json +5 -3
  5. package/types/standalone.d.ts +2 -2
  6. package/lib/test/__fixtures__/utils.js +0 -19
  7. package/lib/test/index.test.js +0 -8
  8. package/lib/test/matchers/beMatchers.test.js +0 -109
  9. package/lib/test/matchers/browser/toHaveClipboardText.test.js +0 -21
  10. package/lib/test/matchers/browserMatchers.test.js +0 -102
  11. package/lib/test/matchers/element/toBeDisabled.test.js +0 -121
  12. package/lib/test/matchers/element/toHaveAttribute.test.js +0 -131
  13. package/lib/test/matchers/element/toHaveChildren.test.js +0 -62
  14. package/lib/test/matchers/element/toHaveComputedLabel.test.js +0 -284
  15. package/lib/test/matchers/element/toHaveComputedRole.test.js +0 -284
  16. package/lib/test/matchers/element/toHaveElementClass.test.js +0 -125
  17. package/lib/test/matchers/element/toHaveElementProperty.test.js +0 -111
  18. package/lib/test/matchers/element/toHaveHTML.test.js +0 -291
  19. package/lib/test/matchers/element/toHaveHeight.test.js +0 -171
  20. package/lib/test/matchers/element/toHaveHref.test.js +0 -54
  21. package/lib/test/matchers/element/toHaveId.test.js +0 -54
  22. package/lib/test/matchers/element/toHaveSize.test.js +0 -109
  23. package/lib/test/matchers/element/toHaveStyle.test.js +0 -199
  24. package/lib/test/matchers/element/toHaveText.test.js +0 -333
  25. package/lib/test/matchers/element/toHaveValue.test.js +0 -81
  26. package/lib/test/matchers/element/toHaveWidth.test.js +0 -171
  27. package/lib/test/matchers/elements/toBeElementsArrayOfSize.test.js +0 -141
  28. package/lib/test/matchers/mock/toBeRequested.test.js +0 -73
  29. package/lib/test/matchers/mock/toBeRequestedTimes.test.js +0 -108
  30. package/lib/test/matchers/mock/toBeRequestedWith.test.js +0 -343
  31. package/lib/test/matchers.test.js +0 -54
  32. package/lib/test/snapshot.test.js +0 -53
  33. package/lib/test/softAssertions.test.js +0 -332
  34. package/lib/test/util/elementsUtil.test.js +0 -18
  35. package/lib/test/util/formatMessage.test.js +0 -96
  36. package/lib/test/util/refetchElements.test.js +0 -19
  37. package/lib/test/utils.test.js +0 -117
  38. /package/lib/{src/constants.js → constants.js} +0 -0
  39. /package/lib/{src/index.js → index.js} +0 -0
  40. /package/lib/{src/jasmineUtils.js → jasmineUtils.js} +0 -0
  41. /package/lib/{src/matchers → matchers}/browser/toHaveClipboardText.js +0 -0
  42. /package/lib/{src/matchers → matchers}/browser/toHaveTitle.js +0 -0
  43. /package/lib/{src/matchers → matchers}/browser/toHaveUrl.js +0 -0
  44. /package/lib/{src/matchers → matchers}/element/toBeClickable.js +0 -0
  45. /package/lib/{src/matchers → matchers}/element/toBeDisabled.js +0 -0
  46. /package/lib/{src/matchers → matchers}/element/toBeDisplayed.js +0 -0
  47. /package/lib/{src/matchers → matchers}/element/toBeDisplayedInViewport.js +0 -0
  48. /package/lib/{src/matchers → matchers}/element/toBeEnabled.js +0 -0
  49. /package/lib/{src/matchers → matchers}/element/toBeExisting.js +0 -0
  50. /package/lib/{src/matchers → matchers}/element/toBeFocused.js +0 -0
  51. /package/lib/{src/matchers → matchers}/element/toBeSelected.js +0 -0
  52. /package/lib/{src/matchers → matchers}/element/toHaveChildren.js +0 -0
  53. /package/lib/{src/matchers → matchers}/element/toHaveClass.js +0 -0
  54. /package/lib/{src/matchers → matchers}/element/toHaveComputedLabel.js +0 -0
  55. /package/lib/{src/matchers → matchers}/element/toHaveComputedRole.js +0 -0
  56. /package/lib/{src/matchers → matchers}/element/toHaveElementProperty.js +0 -0
  57. /package/lib/{src/matchers → matchers}/element/toHaveHTML.js +0 -0
  58. /package/lib/{src/matchers → matchers}/element/toHaveHeight.js +0 -0
  59. /package/lib/{src/matchers → matchers}/element/toHaveHref.js +0 -0
  60. /package/lib/{src/matchers → matchers}/element/toHaveId.js +0 -0
  61. /package/lib/{src/matchers → matchers}/element/toHaveSize.js +0 -0
  62. /package/lib/{src/matchers → matchers}/element/toHaveStyle.js +0 -0
  63. /package/lib/{src/matchers → matchers}/element/toHaveText.js +0 -0
  64. /package/lib/{src/matchers → matchers}/element/toHaveValue.js +0 -0
  65. /package/lib/{src/matchers → matchers}/element/toHaveWidth.js +0 -0
  66. /package/lib/{src/matchers → matchers}/elements/toBeElementsArrayOfSize.js +0 -0
  67. /package/lib/{src/matchers → matchers}/mock/toBeRequested.js +0 -0
  68. /package/lib/{src/matchers → matchers}/mock/toBeRequestedTimes.js +0 -0
  69. /package/lib/{src/matchers → matchers}/mock/toBeRequestedWith.js +0 -0
  70. /package/lib/{src/matchers → matchers}/snapshot.js +0 -0
  71. /package/lib/{src/matchers.js → matchers.js} +0 -0
  72. /package/lib/{src/snapshot.js → snapshot.js} +0 -0
  73. /package/lib/{src/softAssert.js → softAssert.js} +0 -0
  74. /package/lib/{src/softAssertService.js → softAssertService.js} +0 -0
  75. /package/lib/{src/softExpect.js → softExpect.js} +0 -0
  76. /package/lib/{src/types.js → types.js} +0 -0
  77. /package/lib/{src/util → util}/elementsUtil.js +0 -0
  78. /package/lib/{src/util → util}/executeCommand.js +0 -0
  79. /package/lib/{src/util → util}/formatMessage.js +0 -0
  80. /package/lib/{src/util → util}/refetchElements.js +0 -0
  81. /package/lib/{src/utils.js → utils.js} +0 -0
@@ -1,117 +0,0 @@
1
- import { describe, test, expect } from 'vitest';
2
- import { compareNumbers, compareText, compareTextWithArray } from '../src/utils.js';
3
- describe('utils', () => {
4
- describe('compareText', () => {
5
- test('should pass when strings match', () => {
6
- expect(compareText('foo', 'foo', {}).result).toBe(true);
7
- });
8
- test('should fail when strings do not match', () => {
9
- expect(compareText('foo', 'bar', {}).result).toBe(false);
10
- });
11
- test('should pass when trims away white space', () => {
12
- expect(compareText(' foo ', 'foo', {}).result).toBe(true);
13
- });
14
- test('should fail without trimming away white space', () => {
15
- expect(compareText(' foo ', 'foo ', { trim: false }).result).toBe(false);
16
- });
17
- test('should pass if same word but wrong case and using ignoreCase', () => {
18
- expect(compareText(' FOO ', 'foo', { ignoreCase: true }).result).toBe(true);
19
- expect(compareText(' foo ', 'FOO', { ignoreCase: true }).result).toBe(true);
20
- });
21
- test('should pass if string contains expected and using containing', () => {
22
- expect(compareText('qwe_AsD_zxc', 'asd', { ignoreCase: true, containing: true }).result).toBe(true);
23
- });
24
- test('should support asymmetric matchers', () => {
25
- expect(compareText('foo', expect.stringContaining('oo'), {}).result).toBe(true);
26
- expect(compareText('foo', expect.not.stringContaining('oo'), {}).result).toBe(false);
27
- });
28
- test('should support asymmetric matchers and using ignoreCase', () => {
29
- expect(compareText(' FOO ', expect.stringContaining('foo'), { ignoreCase: true }).result).toBe(true);
30
- expect(compareText(' FOO ', expect.not.stringContaining('foo'), { ignoreCase: true }).result).toBe(false);
31
- expect(compareText(' Foo ', expect.stringContaining('FOO'), { ignoreCase: true }).result).toBe(true);
32
- expect(compareText(' Foo ', expect.not.stringContaining('FOO'), { ignoreCase: true }).result).toBe(false);
33
- expect(compareText(' foo ', expect.stringContaining('foo'), { ignoreCase: true }).result).toBe(true);
34
- });
35
- });
36
- describe('compareTextWithArray', () => {
37
- test('should pass if strings match in array', () => {
38
- expect(compareTextWithArray('foo', ['foo', 'bar'], {}).result).toBe(true);
39
- });
40
- test('should fail if string does not match in array', () => {
41
- expect(compareTextWithArray('foo', ['foot', 'bar'], {}).result).toBe(false);
42
- });
43
- test('should pass if white space and using trim', () => {
44
- expect(compareTextWithArray(' foo ', ['foo', 'bar'], { trim: true }).result).toBe(true);
45
- });
46
- test('should pass if wrong case and using ignoreCase', () => {
47
- expect(compareTextWithArray(' FOO ', ['foO', 'bar'], { trim: true, ignoreCase: true }).result).toBe(true);
48
- expect(compareTextWithArray(' foo ', ['foO', 'BAR'], { trim: true, ignoreCase: true }).result).toBe(true);
49
- expect(compareTextWithArray(' foo ', ['foOo', 'BAR'], { trim: true, ignoreCase: true }).result).toBe(false);
50
- expect(compareTextWithArray(' FOO ', ['foOO', 'bar'], { trim: true, ignoreCase: true }).result).toBe(false);
51
- });
52
- test('should pass if string contains and using containing', () => {
53
- expect(compareTextWithArray('qwe_AsD_zxc', ['foo', 'ZXC'], { ignoreCase: true, containing: true }).result).toBe(true);
54
- expect(compareTextWithArray('qwe_AsD_ZXC', ['foo', 'zxc'], { ignoreCase: true, containing: true }).result).toBe(true);
55
- expect(compareTextWithArray('qwe_AsD_ZXC', ['foo', 'zxcc'], { ignoreCase: true, containing: true }).result).toBe(false);
56
- expect(compareTextWithArray('qwe_AsD_ZXC', ['foo', 'zxcc'], { ignoreCase: true, containing: false }).result).toBe(false);
57
- });
58
- test('should support asymmetric matchers', () => {
59
- expect(compareTextWithArray('foo', [expect.stringContaining('oo'), expect.stringContaining('oobb')], {}).result).toBe(true);
60
- expect(compareTextWithArray('foo', [expect.stringContaining('oobb'), expect.stringContaining('oo')], {}).result).toBe(true);
61
- expect(compareTextWithArray('foo', [expect.not.stringContaining('oo'), expect.stringContaining('oobb')], {}).result).toBe(false);
62
- expect(compareTextWithArray('foo', [expect.stringContaining('oobb'), expect.not.stringContaining('oo')], {}).result).toBe(false);
63
- expect(compareTextWithArray('foo', [expect.stringContaining('oo'), expect.not.stringContaining('oobb')], {}).result).toBe(true);
64
- expect(compareTextWithArray('foo', [expect.not.stringContaining('oobb'), expect.not.stringContaining('oo')], {}).result).toBe(true);
65
- expect(compareTextWithArray('foo', [expect.not.stringContaining('oof'), expect.not.stringContaining('oobb')], {}).result).toBe(true);
66
- expect(compareTextWithArray('foo', [expect.not.stringContaining('oo'), expect.not.stringContaining('foo')], {}).result).toBe(false);
67
- });
68
- test('should support asymmetric matchers and using ignoreCase', () => {
69
- expect(compareTextWithArray(' FOO ', [expect.stringContaining('foo'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(true);
70
- expect(compareTextWithArray(' FOO ', [expect.not.stringContaining('foo'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(false);
71
- expect(compareTextWithArray(' foo ', [expect.stringContaining('FOO'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(true);
72
- expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOO'), expect.stringContaining('oobb')], { ignoreCase: true }).result).toBe(false);
73
- expect(compareTextWithArray(' foo ', [expect.stringContaining('FOO'), 'oobb'], { ignoreCase: true }).result).toBe(true);
74
- expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOO'), 'oobb'], { ignoreCase: true }).result).toBe(false);
75
- expect(compareTextWithArray('foo', [expect.stringContaining('FOOO'), 'FOO'], { ignoreCase: true }).result).toBe(true);
76
- expect(compareTextWithArray(' foo ', [expect.not.stringContaining('OO'), expect.not.stringContaining('FOOO')], { ignoreCase: true }).result).toBe(true);
77
- expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOOO'), expect.not.stringContaining('OO')], { ignoreCase: true }).result).toBe(true);
78
- expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOOO'), expect.not.stringContaining('OOO')], { ignoreCase: true }).result).toBe(true);
79
- expect(compareTextWithArray(' foo ', [expect.not.stringContaining('FOO'), expect.not.stringContaining('OO')], { ignoreCase: true }).result).toBe(false);
80
- });
81
- });
82
- describe('compareNumbers', () => {
83
- test('should work when equal', () => {
84
- const actual = 10;
85
- const eq = 10;
86
- expect(compareNumbers(actual, { eq })).toBe(true);
87
- });
88
- test('should pass when using gte and number is greater', () => {
89
- const actual = 10;
90
- const gte = 5;
91
- expect(compareNumbers(actual, { gte })).toBe(true);
92
- });
93
- test('should pass when using lte and number is lower', () => {
94
- const actual = 10;
95
- const lte = 20;
96
- expect(compareNumbers(actual, { lte })).toBe(true);
97
- });
98
- test('should pass when usin lte and gte and number is in between', () => {
99
- const actual = 10;
100
- const lte = 20;
101
- const gte = 1;
102
- expect(compareNumbers(actual, { lte, gte })).toBe(true);
103
- });
104
- test('should fail when using lte and gte and is lte but not gte', () => {
105
- const actual = 10;
106
- const lte = 20;
107
- const gte = 15;
108
- expect(compareNumbers(actual, { lte, gte })).toBe(false);
109
- });
110
- test('should fail when using lte and gte and is gte but not lte', () => {
111
- const actual = 10;
112
- const lte = 9;
113
- const gte = 1;
114
- expect(compareNumbers(actual, { lte, gte })).toBe(false);
115
- });
116
- });
117
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes