Skip to content

Commit

Permalink
fix(iframe-events): Support for iframe click events
Browse files Browse the repository at this point in the history
Fixes checkly#12, Fixes checkly#47
  • Loading branch information
rationalthinker1 committed Apr 15, 2019
1 parent eee7174 commit fc0e003
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/background/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class RecordingController {
}

injectScript () {
chrome.tabs.executeScript({ file: 'content-script.js', allFrames: false })
chrome.tabs.executeScript({ file: 'content-script.js', allFrames: true })
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/code-generator/CodeGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class CodeGenerator {

switch (action) {
case 'keydown':
if (keyCode === 9) {
if (keyCode === 9) { // tab key
this._blocks.push(this._handleKeyDown(selector, value, keyCode))
}
break
Expand Down
1 change: 0 additions & 1 deletion src/content-scripts/__tests__/forms.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ let server
let browser
let page


describe('forms', () => {
beforeAll(async (done) => {
await runDist()
Expand Down
13 changes: 8 additions & 5 deletions src/content-scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class EventRecorder {
this.eventLog = []
this.previousEvent = null
this.dataAttribute = null
this.isTopFrame = (window.location === window.parent.location)
}

start () {
Expand All @@ -26,18 +27,20 @@ class EventRecorder {
_initializeRecorder () {
const events = Object.values(eventsToRecord)
if (!window.pptRecorderAddedControlListeners) {
this.addAllListeners(elementsToBindTo, events)
this.addAllListeners(events)
window.pptRecorderAddedControlListeners = true
}

if (!window.document.pptRecorderAddedControlListeners && chrome.runtime && chrome.runtime.onMessage) {
window.document.pptRecorderAddedControlListeners = true
}

this.sendMessage({ control: 'event-recorder-started' })
this.sendMessage({ control: 'get-current-url', href: window.location.href })
this.sendMessage({ control: 'get-viewport-size', coordinates: { width: window.innerWidth, height: window.innerHeight } })
console.debug('Puppeteer Recorder in-page EventRecorder started')
if (this.isTopFrame) {
this.sendMessage({ control: 'event-recorder-started' })
this.sendMessage({ control: 'get-current-url', href: window.location.href })
this.sendMessage({ control: 'get-viewport-size', coordinates: { width: window.innerWidth, height: window.innerHeight } })
console.debug('Puppeteer Recorder in-page EventRecorder started')
}
}

addAllListeners (events) {
Expand Down
8 changes: 4 additions & 4 deletions src/popup/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
<script>
import { version } from '../../../package.json'
import CodeGenerator from '../../code-generator/CodeGenerator'
import RecordingTab from "./RecordingTab.vue"
import ResultsTab from "./ResultsTab.vue";
import HelpTab from "./HelpTab.vue";
import RecordingTab from './RecordingTab.vue'
import ResultsTab from './ResultsTab.vue'
import HelpTab from './HelpTab.vue'
export default {
export default {
name: 'App',
components: { ResultsTab, RecordingTab, HelpTab },
data () {
Expand Down

0 comments on commit fc0e003

Please sign in to comment.