Closed joelgriffith closed 7 years ago
:whoa:
This is really interesting.
So, if I'm following correctly, the idea is after executing a workflow, a user would have the option of querying elements / properties on the page using GraphQL syntax?
It's actually all done at once, so you'd have to get everything lined up properly before executing. It does open the doors for more interactive workflows, but they'd need to be built on top of this
I'll throw up an example gif in the AM since it is an odd concept
Posted a gif in the first comment, still needs some work and API changes to line up just right, but the core is there
The API structure you came up with is really interesting -- so is there basically an implicit .then
between each of the statements?
Yes, which kind of goes against the norm in GraphQL where each field is executed in parallel. Otherwise queries would just be pyramids (and since all actions have side-effects here). Might regret it later 😬
I wonder if the parallelism piece might actually be really useful here, though?
Like, even though this is a pyramid, I think something like this would actually be awesome:
{
goto(url:"duckduckgo.com") {
click(selector:".load-button") {
text(selector: ".whatever")
text(selector: ".other")
}
click(selector:'.-other-load-button') {
text(selector: ".something-else")
text(selector: ".something-other")
}
}
}
The idea here would be that at each tier, the queries should be parallelizable, and each leaf node can thus run in a new tab.
So, in this specific case, we'd end up with 4 tabs executing in parallel, two clicking -load-button
and then returning the results of a different selector, the other two clicking -other-load-button
and waiting on the results of their selectors.
What do you think? I totally get the concern about huge query pyramids, but I think that it's possible to work around that concern by using fragments intelligently, too.
Let's discuss more in https://github.com/joelgriffith/navalia/issues/30. This idea is incredibly intriguing...
Exposes a global
navalia
CLI, that'll boot up a GraphQL server for interacting with interactively! This does change some of the typings inChrome.ts
, but shouldn't be a major change