selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

Status: exporting to Javascript code

Open corevo opened this issue 8 years ago • 37 comments

Hey all, Everything regarding the release of code export to Javascript should be discussed centrally here.
Right now the biggest issue left to resolve is parallelization, I'll submit a followup PR for that, but unless its code specific comments, keep the conversation here.
The latest beta is 3.1.0-beta.7
Please make sure that is the version used before submitting bugs.

Beta 3

No longer need to export to javascript, just run it against your .side files.
Binaries are published as well, this way if you have the binary in PATH, you only need to call it in the project's root, this way, you can avoid installing node and npm.

Beta 7

There is a problem with the parallelization of test cases, I'm working on that, in the meantime I'm removing the feature from 3.1.0.
3.1.0 has great features, and I don't want to delay them anymore, I'm moving this one to 3.2.0.

corevo avatar Mar 19 '18 12:03 corevo

Hi, thanks for the new post. How can we run the generated JS tests?

This is the head of the generated file

// This file was generated using Selenium IDE
const By = require('selenium-webdriver').By;
const until = require('selenium-webdriver').until;
jest.setTimeout(30000);
afterAll(() => {
  Runner.cleaup();
});
const BASE_URL = 'http://localhost';

Do we need a library that combines jest and selenium? Runner and jest are not initialized

Naramsim avatar Mar 20 '18 10:03 Naramsim

Yes, have a look at the README

corevo avatar Mar 20 '18 16:03 corevo

Hi in the latest release you say that Javascript exporting is no longer needed, in fact, I don't find any button to export to Javascript.

Is it possible to maintain this feature, I really need to see and modify those Javascript files.

Thanks

Naramsim avatar Apr 17 '18 07:04 Naramsim

Hi,

I have the same issue with exporting to Python. We take the initial IDE scripts, convert them to python and then adjust accordingly. Will that be a future enhancement?

QA1MTG avatar May 03 '18 15:05 QA1MTG

I am entirely confused of the answer to the error #211. Can any one explain it to me?.

makarun007 avatar May 28 '18 13:05 makarun007

Yes, exporting in any language is now not allowed. You can only export in the crappy format Selenium team decided. So you can't modify anything

Naramsim avatar May 28 '18 13:05 Naramsim

Please be gentle and patient. This feature is going to be implemented sooner or later. If one wants it to progress faster one can give a hand of help, join the team or submit pull requests.

barancev avatar May 28 '18 13:05 barancev

I'll try to address some of the concerns.
The project is still very far behind on features than the predecessor, export included.
And so the first thing we want the IDE to do, is to solve one of the end results of exporting: running headlessly.
That being said, exporting to the plethora of languages available (Selenium bindings), requires a lot of work and maintenance on our part, and in order to move to more complex features sooner, the best solution is to enable you to run the project files, just like that.
Think of this as the HTML runner, we'll make sure you can run your project files first, and then free time to write exporting to different languages.

corevo avatar May 28 '18 13:05 corevo

@Naramsim I think it should be possible to write a "side-to-HTML" converter... I'm going to start looking into this now, because I actually like the User Experience of the Selenium IDE 3.x beta better than the old Selenium IDE 2.x, the export feature is the last piece of the puzzle for my team to adopt it. I'm not a ReactJS/WebExtensions expert so I'll look into a standalone tool first, but if it works out ok, I'm going to get cracking on learning that stuff because I'd also like to add jUnit5 as an export format.

As @barancev said, if you don't like the current state of things, roll up your sleeves and get coding or find some other more constructive ways to help than just complaining... this crew (which I should point out I'm a bystander/lurker on not member of at this time) is doing an awesome job on what I'm assuming is a shoestring, if not completely bootstrapped/volunteer-basis. Its up to all of us, the community to step up and build the features/tools we want.

bcmoney avatar Jun 04 '18 10:06 bcmoney

@bcmoney You're more than welcome.
I'm just hoping that with this runner, that let's you have fine tuning on parallelization (either run suites in parallel, or everything), will reduce the coupling of code export.
My idea is that if you have no use of editing the code once exported or if you don't have an ecosystem around a certain language, then we can do a much better job at managing these suites.

corevo avatar Jun 04 '18 10:06 corevo

Is there any workaround to export the recorded script. I need to enhance the recorded script. I need to parameterize, add check point validation (data validation, object validation). I also need to add conditions. The recorded and play is really useless unless enhanced. I am looking for a way to export the recorded script so I can edit.

mgdtest avatar Aug 13 '18 11:08 mgdtest

@mgdtest: We just released some new functionality today in 3.2.0 that can get at some of your challenges.

You can now add conditions to your tests with control flow commands (e.g., if, else if, else, end, while, times, do, and repeat if). You can also perform validations with generic assert and verify commands to confirm that variables contain expected values.

I'm not sure what our plans are for parameterized testing, though (that's a good question). But hopefully this helps move you closer to getting value out of your recorded scripts in the meantime.

tourdedave avatar Aug 13 '18 12:08 tourdedave

I checked out 3.2.0 version but I am not able to see the changes. I am not sure how to add conditions. It does not seem to support editing the code at all. Without editing the recorded code to enhance generated code. I don't see this will help my team to automate test cases. Is there away to see/edit generated script?

mgdtest avatar Aug 14 '18 03:08 mgdtest

@corevo "My idea is that if you have no use of editing the code once exported or if you don't have an ecosystem around a certain language, then we can do a much better job at managing these suites." -> a practical example is trying to keep your tests to one test suite - e.g. pytest - and trying to measure coverage.

Good luck on this work! I'd love to see exporting to Python, personally. Great work so far on what exists, it's super easy to use and looks great 👍

dibstern avatar Oct 18 '18 08:10 dibstern

I really don't care about adding conditionals or loops to "IDE" at this point. That ship sailed long time ago and I think that 100% of the time people use Selenium "IDE" just to grab gui elements and create a rough draft of the code to use. I have no idea who in their right mind would use it as an actual IDE and keep their tests in Selenese.

Trying to add all these features that may be marginally useful while blocking the functionality that's actually being used a lot is nonsense. I think that your team is detached from reality and trying to muscle the users into particular vision of Selenium use. Thanks, but no thanks. I will find something else to use instead. You are killing off your user-base.

Sometimes a simpler solution just works and there is no need to come up with anything fancier, especially at a detriment of existing functionality.

oooBORISooo avatar Oct 30 '18 20:10 oooBORISooo

Thanks for the feedback @oooBORISooo. It's worth keeping in mind that the IDE is used differently by different people. What might not be important to you may be important to others. Conditionals (and control flow in general) were used by many in prior versions of the IDE and this feature set landed months ago. Code export is an important feature too. We're just figuring out when to get the work done amongst everything else going on in the project. It's just me and @corevo pulling weight for the IDE, so if you want to help make code export happen sooner you're more than welcome to chip in.

tourdedave avatar Nov 04 '18 09:11 tourdedave

Has exporting to Python made it in to the official roadmap?

monokal avatar Dec 03 '18 23:12 monokal

Yes. All of the officially supported programming languages will be added for code export.

tourdedave avatar Dec 04 '18 07:12 tourdedave

when it will be added?

contorax avatar Dec 10 '18 06:12 contorax

We're going to start work on it later this month, starting with Java and working our way through the other languages after that.

tourdedave avatar Dec 10 '18 07:12 tourdedave