New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to close demo after "end( )" ? #47
Comments
A previous PR seems to be related to this. Investigate the best approach to handle this issue. |
I don't know if I understood it right, but this PR is about returning a promise, right? But nothing about closing the terminal after "end()". If I'm mistaken please disregard this comment |
🤔 gdemo.openApp('terminal').command('node demo.js').end().then(() => {
// here you can make anything, including an animation to simulate terminal close.
}); However, you might be meaning: gdemo.openApp('terminal').command('node demo.js').closeApp('terminal').end(); Is this ( |
Now that you've mentioned... I can see purpose on both approaches! here is what I'm trying to do: new Promise((resolve, reject) => {
new GDemo('#shell').openApp('terminal', {minHeight: '350px', promptString: '$'})
.command('google-chrome index.html', {onCompleteDelay: 1500})
.respond('Opening in existing browser session.')
// .command('clear', {onCompleteDelay: 1500})
.command('')
.end();
setTimeout(() => resolve("done!"), 6500);
})
.then(() => {
// Trying to simulate terminal "clear"
// $('#shell > div > div > div > div.application-content-container > div:nth-child(1)').remove();
// $('#shell > div > div > div > div.application-content-container > div:nth-child(2)').remove();
// $('#shell > div > div > div > div.application-content-container > div:nth-child(3)').remove();
// Some logic here
var currentLine = $('.cursor-active');
var options = {
strings: ["Some string to be typed inside GDemo with this other lib (https://mattboldt.com/demos/typed-js/)"],
typeSpeed: 40,
startDelay: 200
}
$(currentLine).addClass('cursor');
var typed = new Typed(".cursor-active", options);
$(currentLine).removeClass('cursor-active');
})
.then(() => {
GDemo('#shell').closeApp()
}); |
I think I got it now. To do this, three improvements would be actually need: 1 - Doing so, your code will be something like that: const demo = new GDemo('#shell');
demo.openApp('terminal', {minHeight: '350px', promptString: '$'})
.command('google-chrome index.html', {onCompleteDelay: 1500})
.respond('Opening in existing browser session.')
.command('clear', {onCompleteDelay: 1500})
.clear()
.command('')
.end()
.then(() => {
return new Promise((resolve, reject) => {
// Do the stuff with third party lib
})
})
.then(() => {
demo.closeApp('terminal').end();
});
Is it right? |
Yeah, pretty much it! |
Split in the following issues: |
It should have a "close( )" method to close the terminal after ending.
The text was updated successfully, but these errors were encountered: