appium-xcuitest-driver 7.21.1 → 7.21.2

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 (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/commands/context.d.ts.map +1 -1
  3. package/build/lib/commands/context.js +4 -1
  4. package/build/lib/commands/context.js.map +1 -1
  5. package/build/lib/commands/log.d.ts.map +1 -1
  6. package/build/lib/commands/log.js +3 -2
  7. package/build/lib/commands/log.js.map +1 -1
  8. package/build/lib/device-log/ios-device-log.d.ts +16 -10
  9. package/build/lib/device-log/ios-device-log.d.ts.map +1 -1
  10. package/build/lib/device-log/ios-device-log.js +9 -24
  11. package/build/lib/device-log/ios-device-log.js.map +1 -1
  12. package/build/lib/device-log/ios-log.d.ts +23 -44
  13. package/build/lib/device-log/ios-log.d.ts.map +1 -1
  14. package/build/lib/device-log/ios-log.js +6 -52
  15. package/build/lib/device-log/ios-log.js.map +1 -1
  16. package/build/lib/device-log/ios-performance-log.d.ts +18 -26
  17. package/build/lib/device-log/ios-performance-log.d.ts.map +1 -1
  18. package/build/lib/device-log/ios-performance-log.js +9 -28
  19. package/build/lib/device-log/ios-performance-log.js.map +1 -1
  20. package/build/lib/device-log/ios-simulator-log.d.ts +21 -24
  21. package/build/lib/device-log/ios-simulator-log.d.ts.map +1 -1
  22. package/build/lib/device-log/ios-simulator-log.js +14 -30
  23. package/build/lib/device-log/ios-simulator-log.js.map +1 -1
  24. package/build/lib/device-log/line-consuming-log.d.ts +9 -0
  25. package/build/lib/device-log/line-consuming-log.d.ts.map +1 -0
  26. package/build/lib/device-log/line-consuming-log.js +16 -0
  27. package/build/lib/device-log/line-consuming-log.js.map +1 -0
  28. package/lib/commands/context.js +4 -1
  29. package/lib/commands/log.js +3 -2
  30. package/lib/device-log/ios-device-log.ts +52 -0
  31. package/lib/device-log/ios-log.ts +87 -0
  32. package/lib/device-log/ios-performance-log.ts +61 -0
  33. package/lib/device-log/{ios-simulator-log.js → ios-simulator-log.ts} +36 -37
  34. package/lib/device-log/line-consuming-log.ts +16 -0
  35. package/npm-shrinkwrap.json +2 -2
  36. package/package.json +1 -1
  37. package/lib/device-log/ios-device-log.js +0 -56
  38. package/lib/device-log/ios-log.js +0 -116
  39. package/lib/device-log/ios-performance-log.js +0 -68
@@ -1,116 +0,0 @@
1
- import {EventEmitter} from 'events';
2
- import { LRUCache } from 'lru-cache';
3
- import { toLogEntry } from './helpers';
4
-
5
- // We keep only the most recent log entries to avoid out of memory error
6
- const MAX_LOG_ENTRIES_COUNT = 10000;
7
-
8
- // TODO: Rewrite this class to typescript for better generic typing
9
-
10
- export class IOSLog extends EventEmitter {
11
- constructor(maxBufferSize = MAX_LOG_ENTRIES_COUNT) {
12
- super();
13
- this.maxBufferSize = maxBufferSize;
14
- /** @type {LRUCache<number, any>} */
15
- this.logs = new LRUCache({
16
- max: this.maxBufferSize,
17
- });
18
- /** @type {number?} */
19
- this.logIndexSinceLastRequest = null;
20
- }
21
-
22
- /** @returns {Promise<void>} */
23
- // eslint-disable-next-line require-await
24
- async startCapture() {
25
- throw new Error(`Sub-classes need to implement a 'startCapture' function`);
26
- }
27
-
28
- /** @returns {Promise<void>} */
29
- // eslint-disable-next-line require-await
30
- async stopCapture() {
31
- throw new Error(`Sub-classes need to implement a 'stopCapture' function`);
32
- }
33
-
34
- /** @returns {boolean} */
35
- get isCapturing() {
36
- throw new Error(`Sub-classes need to implement a 'isCapturing' function`);
37
- }
38
-
39
- /**
40
- *
41
- * @param {any} entry
42
- * @returns {void}
43
- */
44
- broadcast(entry) {
45
- let recentIndex = -1;
46
- for (const key of this.logs.rkeys()) {
47
- recentIndex = key;
48
- break;
49
- }
50
- const serializedEntry = this._serializeEntry(entry);
51
- this.logs.set(++recentIndex, serializedEntry);
52
- if (this.listenerCount('output')) {
53
- this.emit('output', this._deserializeEntry(serializedEntry));
54
- }
55
- }
56
-
57
- /**
58
- *
59
- * @returns {import('../commands/types').LogEntry[]}
60
- */
61
- getLogs() {
62
- /** @type {import('../commands/types').LogEntry[]} */
63
- const result = [];
64
- /** @type {number?} */
65
- let recentLogIndex = null;
66
- for (const [index, value] of this.logs.entries()) {
67
- if (this.logIndexSinceLastRequest && index > this.logIndexSinceLastRequest
68
- || !this.logIndexSinceLastRequest) {
69
- recentLogIndex = index;
70
- result.push(this._deserializeEntry(value));
71
- }
72
- }
73
- if (recentLogIndex !== null) {
74
- this.logIndexSinceLastRequest = recentLogIndex;
75
- }
76
- return result;
77
- }
78
-
79
- /**
80
- *
81
- * @returns {import('../commands/types').LogEntry[]}
82
- */
83
- getAllLogs() {
84
- /** @type {import('../commands/types').LogEntry[]} */
85
- const result = [];
86
- for (const value of this.logs.values()) {
87
- result.push(this._deserializeEntry(value));
88
- }
89
- return result;
90
- }
91
-
92
- /**
93
- *
94
- * @param {any} value
95
- * @returns {any}
96
- */
97
- _serializeEntry(value) {
98
- return [value, Date.now()];
99
- }
100
-
101
- /**
102
- *
103
- * @param {any} value
104
- * @returns {any}
105
- */
106
- _deserializeEntry(value) {
107
- const [message, timestamp] = value;
108
- return toLogEntry(message, timestamp);
109
- }
110
-
111
- _clearEntries() {
112
- this.logs.clear();
113
- }
114
- }
115
-
116
- export default IOSLog;
@@ -1,68 +0,0 @@
1
- import {logger} from 'appium/support';
2
- import _ from 'lodash';
3
- import { IOSLog } from './ios-log';
4
-
5
- const log = logger.getLogger('IOSPerformanceLog');
6
- const MAX_EVENTS = 5000;
7
-
8
- export class IOSPerformanceLog extends IOSLog {
9
- constructor(remoteDebugger, maxEvents = MAX_EVENTS) {
10
- super(maxEvents);
11
- this.remoteDebugger = remoteDebugger;
12
- this.maxEvents = parseInt(String(maxEvents), 10);
13
- this._started = false;
14
- }
15
-
16
- /**
17
- * @override
18
- */
19
- async startCapture() {
20
- log.debug('Starting performance (Timeline) log capture');
21
- this._clearEntries();
22
- const result = await this.remoteDebugger.startTimeline(this.onTimelineEvent.bind(this));
23
- this._started = true;
24
- return result;
25
- }
26
-
27
- /**
28
- * @override
29
- */
30
- async stopCapture() {
31
- log.debug('Stopping performance (Timeline) log capture');
32
- const result = await this.remoteDebugger.stopTimeline();
33
- this._started = false;
34
- return result;
35
- }
36
-
37
- /**
38
- * @override
39
- */
40
- get isCapturing() {
41
- return this._started;
42
- }
43
-
44
- /**
45
- * @override
46
- */
47
- _serializeEntry(value) {
48
- return value;
49
- }
50
-
51
- /**
52
- * @override
53
- */
54
- _deserializeEntry(value) {
55
- return value;
56
- }
57
-
58
- /**
59
- *
60
- * @param {import('../commands/types').LogEntry} event
61
- */
62
- onTimelineEvent(event) {
63
- log.debug(`Received Timeline event: ${_.truncate(JSON.stringify(event))}`);
64
- this.broadcast(event);
65
- }
66
- }
67
-
68
- export default IOSPerformanceLog;