|
| 1 | +import { EventType, eventWithTime, IncrementalSource } from '../../src/types'; |
| 2 | + |
| 3 | +const now = Date.now(); |
| 4 | + |
| 5 | +const events: eventWithTime[] = [ |
| 6 | + { |
| 7 | + type: EventType.DomContentLoaded, |
| 8 | + data: {}, |
| 9 | + timestamp: now, |
| 10 | + }, |
| 11 | + { |
| 12 | + type: EventType.Load, |
| 13 | + data: {}, |
| 14 | + timestamp: now + 100, |
| 15 | + }, |
| 16 | + { |
| 17 | + type: EventType.Meta, |
| 18 | + data: { |
| 19 | + href: 'http://localhost', |
| 20 | + width: 1200, |
| 21 | + height: 500, |
| 22 | + }, |
| 23 | + timestamp: now + 100, |
| 24 | + }, |
| 25 | + { |
| 26 | + type: EventType.FullSnapshot, |
| 27 | + data: { |
| 28 | + node: { |
| 29 | + type: 0, |
| 30 | + childNodes: [ |
| 31 | + { |
| 32 | + type: 2, |
| 33 | + tagName: 'html', |
| 34 | + attributes: {}, |
| 35 | + childNodes: [ |
| 36 | + { |
| 37 | + type: 2, |
| 38 | + tagName: 'head', |
| 39 | + attributes: {}, |
| 40 | + childNodes: [ |
| 41 | + { type: 3, textContent: '\n ', id: 4 }, |
| 42 | + { |
| 43 | + type: 2, |
| 44 | + tagName: 'meta', |
| 45 | + attributes: { charset: 'utf-8' }, |
| 46 | + childNodes: [], |
| 47 | + id: 5, |
| 48 | + }, |
| 49 | + { type: 3, textContent: ' \n ', id: 6 }, |
| 50 | + ], |
| 51 | + id: 3, |
| 52 | + }, |
| 53 | + { type: 3, textContent: '\n ', id: 7 }, |
| 54 | + { |
| 55 | + type: 2, |
| 56 | + tagName: 'body', |
| 57 | + attributes: {}, |
| 58 | + childNodes: [ |
| 59 | + { type: 3, textContent: '\n ', id: 9 }, |
| 60 | + { |
| 61 | + type: 2, |
| 62 | + tagName: 'iframe', |
| 63 | + attributes: { id: 'target' }, |
| 64 | + childNodes: [], |
| 65 | + id: 19, |
| 66 | + }, |
| 67 | + { type: 3, textContent: '\n\n', id: 27 }, |
| 68 | + ], |
| 69 | + id: 8, |
| 70 | + }, |
| 71 | + ], |
| 72 | + id: 2, |
| 73 | + }, |
| 74 | + ], |
| 75 | + compatMode: 'BackCompat', |
| 76 | + id: 1, |
| 77 | + }, |
| 78 | + initialOffset: { left: 0, top: 0 }, |
| 79 | + }, |
| 80 | + timestamp: now + 200, |
| 81 | + }, |
| 82 | + // add an iframe |
| 83 | + { |
| 84 | + type: EventType.IncrementalSnapshot, |
| 85 | + data: { |
| 86 | + source: IncrementalSource.Mutation, |
| 87 | + adds: [ |
| 88 | + { |
| 89 | + parentId: 19, |
| 90 | + nextId: null, |
| 91 | + node: { |
| 92 | + type: 0, |
| 93 | + childNodes: [ |
| 94 | + { |
| 95 | + type: 2, |
| 96 | + tagName: 'html', |
| 97 | + attributes: {}, |
| 98 | + childNodes: [ |
| 99 | + { |
| 100 | + type: 2, |
| 101 | + tagName: 'head', |
| 102 | + attributes: {}, |
| 103 | + childNodes: [], |
| 104 | + rootId: 30, |
| 105 | + id: 32, |
| 106 | + }, |
| 107 | + { |
| 108 | + type: 2, |
| 109 | + tagName: 'body', |
| 110 | + attributes: {}, |
| 111 | + childNodes: [], |
| 112 | + rootId: 30, |
| 113 | + id: 33, |
| 114 | + }, |
| 115 | + ], |
| 116 | + rootId: 30, |
| 117 | + id: 31, |
| 118 | + }, |
| 119 | + ], |
| 120 | + compatMode: 'BackCompat', |
| 121 | + id: 30, |
| 122 | + }, |
| 123 | + }, |
| 124 | + ], |
| 125 | + removes: [], |
| 126 | + texts: [], |
| 127 | + attributes: [], |
| 128 | + isAttachIframe: true, |
| 129 | + }, |
| 130 | + timestamp: now + 500, |
| 131 | + }, |
| 132 | + // add two canvas, one is blank ans the other is filled with data |
| 133 | + { |
| 134 | + type: EventType.IncrementalSnapshot, |
| 135 | + data: { |
| 136 | + source: 0, |
| 137 | + texts: [], |
| 138 | + attributes: [], |
| 139 | + removes: [], |
| 140 | + adds: [ |
| 141 | + { |
| 142 | + parentId: 33, |
| 143 | + nextId: null, |
| 144 | + node: { |
| 145 | + type: 2, |
| 146 | + tagName: 'canvas', |
| 147 | + attributes: { |
| 148 | + width: '10', |
| 149 | + height: '10', |
| 150 | + id: 'blank_canvas', |
| 151 | + }, |
| 152 | + childNodes: [], |
| 153 | + rootId: 30, |
| 154 | + id: 34, |
| 155 | + }, |
| 156 | + }, |
| 157 | + { |
| 158 | + parentId: 33, |
| 159 | + nextId: null, |
| 160 | + node: { |
| 161 | + type: 2, |
| 162 | + tagName: 'canvas', |
| 163 | + attributes: { |
| 164 | + width: '10', |
| 165 | + height: '10', |
| 166 | + rr_dataURL: |
| 167 | + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAB5JREFUKFNjZCASMBKpjmEQKvzPwIDqrEHoRozgBQC/ZQELU4DiXAAAAABJRU5ErkJggg==', |
| 168 | + id: 'canvas_with_data', |
| 169 | + }, |
| 170 | + childNodes: [], |
| 171 | + rootId: 30, |
| 172 | + id: 35, |
| 173 | + }, |
| 174 | + }, |
| 175 | + ], |
| 176 | + }, |
| 177 | + timestamp: now + 500, |
| 178 | + }, |
| 179 | +]; |
| 180 | + |
| 181 | +export default events; |
0 commit comments