Skip to content
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

Generate taiko api calls from the REPL #3

Closed
zabil opened this issue Oct 30, 2017 · 4 comments
Closed

Generate taiko api calls from the REPL #3

zabil opened this issue Oct 30, 2017 · 4 comments

Comments

@zabil
Copy link
Member

zabil commented Oct 30, 2017

After implementing #2
Provide an option in the REPL to convert the sequence of REPL commands to taiko compatible API.

For e.g.

$ taiko
>> openBrowser
>> goto http://getgauge.io
>> click Get Started
>> .copy

should copy the following to clipboard

(async => {
 await openBrowser();
 await goto("http://getauge.io");
 await click("Get Started");
})();
@zabil zabil added the ready label Oct 30, 2017
@zabil
Copy link
Member Author

zabil commented Nov 3, 2017

This is now changed to

$ taiko
>> openBrowser()
undefined
>> goto("https://getgauge.io")
undefined
>> click("Get Started")
undefined
>> closeBrowser()
undefined
>> .code
const { browser, page, openBrowser, closeBrowser, goto, reload, $, $$, link, listItem, inputField, textField, 
image, button, comboBox, checkBox, radioButton, alert, prompt, confirm, beforeunload, text, contains, click,
 doubleClick, rightClick, write, press, upload, highlight, focus, scrollTo, scrollRight, scrollLeft, scrollUp, 
scrollDown, hover, screenshot, timeoutSecs, intervalSecs, waitForNavigation, to, into } = require('taiko');

(async => {
    await openBrowser({headless: false});
    await goto("https://getgauge.io");
    await click("Get Started");
    await closeBrowser();
})();
>>

@zabil
Copy link
Member Author

zabil commented Nov 3, 2017

Modify the .code to take a filename

>> .code file.js

will save the code to a file

@BugDiver
Copy link
Member

BugDiver commented Nov 3, 2017

The command .code should capture only successful commands.

Example :

➜  ~ taiko
>> openBrowser()
undefined
>> goto()
Error: Protocol error (Page.navigate): Invalid parameters url: string value expected
    at Session._onMessage (/usr/local/lib/node_modules/taiko/node_modules/puppeteer/lib/Connection.js:194:25)
    at Connection._onMessage (/usr/local/lib/node_modules/taiko/node_modules/puppeteer/lib/Connection.js:98:19)
    at emitOne (events.js:115:13)
    at WebSocket.emit (events.js:210:7)
    at Receiver._receiver.onmessage 
>> goto("https://getgauge.io")
undefined
>> .code
const { browser, page, openBrowser, closeBrowser, goto, reload, $, $$, link, listItem, inputField, textField, image, button, comboBox, checkBox, radioButton, alert, prompt, confirm, beforeunload, text, contains, click, doubleClick, rightClick, write, press, upload, highlight, focus, scrollTo, scrollRight, scrollLeft, scrollUp, scrollDown, hover, screenshot, timeoutSecs, intervalSecs, waitForNavigation, to, into } = require('taiko');

(async => {
	openBrowser();
	goto();
	goto("https://getgauge.io");
})();
>>

In above example, .code should not capture goto() action

@kashishm
Copy link
Contributor

kashishm commented Nov 8, 2017

Implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants