-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handles multiple resets and better autocomplete
- Loading branch information
AutoSponge
committed
Mar 29, 2020
1 parent
18bfecb
commit 2f569df
Showing
15 changed files
with
3,608 additions
and
182 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 |
---|---|---|
|
@@ -104,4 +104,7 @@ dist | |
.tern-port | ||
|
||
# IDE | ||
.vscode/ | ||
.vscode/ | ||
|
||
# docs | ||
docs/ |
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
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
const dlv = require('dlv') | ||
module.exports = async function(scriptwriter) { | ||
const { company, config } = scriptwriter | ||
const dlv = require('dlv'); | ||
module.exports = async function (scriptwriter) { | ||
const { company, config } = scriptwriter; | ||
const { browser, playwright } = company; | ||
const contextConfig = { | ||
viewport: null, | ||
...dlv(playwright.devices, [config.device], {}), | ||
...dlv(config, 'context', {}) | ||
} | ||
...dlv(config, 'context', {}), | ||
}; | ||
const context = await browser.newContext(contextConfig); | ||
scriptwriter.assign({ context }); | ||
}; |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
module.exports = async function(scriptwriter) { | ||
module.exports = async function (scriptwriter) { | ||
const { client } = scriptwriter.company; | ||
await Promise.all([ | ||
client.send('Accessibility.enable'), | ||
client.send('Runtime.enable'), | ||
client.send('DOM.enable'), | ||
]); | ||
client.send('Accessibility.enable'), | ||
client.send('Runtime.enable'), | ||
client.send('DOM.enable'), | ||
]); | ||
}; |
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
module.exports = async function(scriptwriter) { | ||
const { context } = scriptwriter.company; | ||
const page = await context.newPage(); | ||
scriptwriter.assign({ page }); | ||
if (context.newCDPSession) { | ||
const client = await context.newCDPSession(page); | ||
scriptwriter.assign({ client }); | ||
try { | ||
const page = await context.newPage(); | ||
scriptwriter.assign({ page }); | ||
if (context.newCDPSession) { | ||
const client = await context.newCDPSession(page); | ||
scriptwriter.assign({ client }); | ||
} | ||
} catch (err) { | ||
scriptwriter.log(err); | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
const { magenta } = require('kleur'); | ||
|
||
module.exports = function() { | ||
console.log(magenta('repl session ended.')); | ||
process.exit(); | ||
module.exports = function(scriptwriter) { | ||
scriptwriter.log(magenta('repl session ended.')); | ||
/* istanbul ignore if */ | ||
if (process.env.NODE_ENV !== 'test') process.exit(); | ||
}; |
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
const { magenta } = require('kleur'); | ||
|
||
module.exports = async function(scriptwriter) { | ||
const { browser, director } = scriptwriter.company; | ||
await browser.close(); | ||
await scriptwriter.init(); | ||
console.log(magenta('repl session reset.')); | ||
director.setPrompt('> '); | ||
director.displayPrompt(); | ||
}; | ||
const handler = async function (scriptwriter) { | ||
const { browser, director } = scriptwriter.company; | ||
await browser.close(); | ||
await scriptwriter.init(); | ||
scriptwriter.log(magenta('repl session reset.')); | ||
director.setPrompt('> '); | ||
director.displayPrompt(); | ||
} | ||
handler.once = true | ||
|
||
module.exports = handler; |
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.