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

Leverage IDE window on command error #1066

Open
dstekanov opened this issue Jun 3, 2020 · 7 comments
Open

Leverage IDE window on command error #1066

dstekanov opened this issue Jun 3, 2020 · 7 comments

Comments

@dstekanov
Copy link

💬 Questions and Help

Hello guys!

My intro:

We have a separate plugin for exporting new language: Selenide for Selenium IDE

I've used your example 'extension-boilerplate' package and documentation https://www.selenium.dev/selenium-ide/docs/en/plugins/code-export as you suggested

Also previously I've thought to directly merge it to the core codebase #1032

My question:

We've faced with the next behavior:

When there is some error while emitting the command (for example, if command 'type' missing expected target argument) and I export it to 'vendor' language, nothing is happening.

So my goal is to trigger the same window as your codebase has:

2020-06-03_13h25_13

Could you suggest me please how can I do it?

@tourdedave
Copy link

There is a preliminary check in code export to make sure that the commands are valid before proceeding. If it's not then it displays an error message with details about what was missing.

In the example you provided, you're trying to export an incomplete type command. Details about what the command needs can be seen in the reference tab in the IDE, or here.

@dstekanov
Copy link
Author

@tourdedave thanks for your answer.

Yes, I have such checks. But when I clicked 'export' button (choosing my new language) the error message was not shown (I only can see it in plugin console).

Here is a background.js

What should I do to have such a dialog with error as above on the screenshot?

@tourdedave
Copy link

Ah, apologies. I misunderstood.

You need to catch and pass the error back through sendResponse (e.g., sendResponse({error: 'error message'})).

Otherwise it will only bubble to the console.

@dstekanov
Copy link
Author

thanks!

I've added it selenide/selenide-for-selenium-ide#5 but now I see 'Save' window with filename, like 'c27c5e16-d11e-4649-a4a3-d6c431b3edd4' and no errors.

maybe I misunderstand how to use it...

@tourdedave
Copy link

If I recall correctly there's something odd about onMesage and onMessageExternal when using async functions.

You'll need to return true after the async function in order for Chrome to know to wait for the function to complete execution.

You can see an example here, and an explanation here.

@tourdedave tourdedave reopened this Jun 4, 2020
@dstekanov
Copy link
Author

dstekanov commented Jun 9, 2020

@tourdedave seems this does not work for me too...

Also, I've even tried to just send error block but nothing happens:

if (message.action === 'export' && message.entity === 'vendor') {
      sendResponse({
        error: 'error message'
      });
}

@tourdedave
Copy link

Seems like a bug.

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

No branches or pull requests

2 participants