-
-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added new network events * Refactored runtime Event streaming * Added support of using keywords as variables * Added support of body property in response event * Added example of subscription to network response * Added example of subscription to network requests * Fixed infinite loop bug * Updated Google example * Updated unit tests * Reenamed Event to Message * Fixed navvigation filtering by frame
- Loading branch information
Showing
67 changed files
with
3,522 additions
and
2,048 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import random from "../../../utils/random.js"; | ||
|
||
const e = React.createElement; | ||
|
||
function request(url, body, method = 'GET') { | ||
fetch(url, { | ||
method, | ||
body | ||
}) | ||
.then((res) => res.text()) | ||
.then(text => console.log(text)).catch(er => console.error(er)); | ||
} | ||
|
||
export default class AjaxComponent extends React.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
target: '' | ||
}; | ||
} | ||
|
||
handleSeq(e) { | ||
[ | ||
'https://www.montferret.dev/try/', | ||
'https://www.montferret.dev/docs/', | ||
'https://www.montferret.dev/blog/', | ||
'https://www.montferret.dev/cookbook/' | ||
].forEach((url) => { | ||
setTimeout(() => { | ||
request(url) | ||
}, random(1000, 2000)) | ||
}); | ||
} | ||
|
||
handleTyping(evt) { | ||
this.setState({ | ||
target: evt.target.value | ||
}) | ||
} | ||
|
||
handleTarget(e) { | ||
setTimeout(() => { | ||
request(this.state.target) | ||
}, random()) | ||
} | ||
|
||
render() { | ||
const inputId = `${this.props.id}-input`; | ||
const contentId = `${this.props.id}-content`; | ||
const classNames = ["alert", "alert-success"]; | ||
|
||
return e("div", { id: this.props.id, className: "card ajax"}, [ | ||
e("div", { className: "card-header"}, [ | ||
"Ajax requests" | ||
]), | ||
e("div", { className: "card-body"}, [ | ||
e("div", { className: "form-group" }, [ | ||
e("label", null, "Make Sequential Request"), | ||
e("input", { | ||
id: inputId + "-seq-buttons", | ||
type: "button", | ||
className: "btn btn-primary", | ||
onClick: this.handleSeq.bind(this), | ||
value: "Send" | ||
}, | ||
) | ||
]), | ||
e("div", { className: "form-group" }, [ | ||
e("label", null, "Make Targeted Request"), | ||
e("input", { | ||
id: inputId, | ||
type: "text", | ||
onChange: this.handleTyping.bind(this), | ||
}, | ||
), | ||
e("input", { | ||
id: inputId + "-button", | ||
type: "button", | ||
className: "btn btn-primary", | ||
onClick: this.handleTarget.bind(this), | ||
value: "Send" | ||
}, | ||
) | ||
]), | ||
]) | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
timeout: 240 | ||
query: | ||
ref: file://../../../examples/wait_request.fql | ||
assert: | ||
text: RETURN T::NOT::EMPTY(@lab.data.query.result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
timeout: 240 | ||
query: | ||
ref: file://../../../examples/wait_response.fql | ||
assert: | ||
text: RETURN T::NOT::EMPTY(@lab.data.query.result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
LET doc = DOCUMENT('https://soundcloud.com/charts/top', { driver: "cdp", userAgent: "*" }) | ||
|
||
WAIT_ELEMENT(doc, '.chartTrack__details', 5000) | ||
SCROLL_BOTTOM(doc) | ||
|
||
LET evt = (WAITFOR EVENT "request" IN doc FILTER CURRENT.url LIKE "https://api-v2.soundcloud.com/charts?genre=soundcloud*") | ||
|
||
RETURN evt.headers["User-Agent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
LET doc = DOCUMENT('https://soundcloud.com/charts/top', { driver: "cdp" }) | ||
|
||
WAIT_ELEMENT(doc, '.chartTrack__details', 5000) | ||
SCROLL_BOTTOM(doc) | ||
|
||
LET evt = (WAITFOR EVENT "response" IN doc FILTER CURRENT.url LIKE "https://api-v2.soundcloud.com/charts?genre=soundcloud*") | ||
|
||
RETURN JSON_PARSE(evt.body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.