SeleniumHQ / selenium-ide

Open Source record and playback test automation for the web.
https://selenium.dev/selenium-ide/
Apache License 2.0
2.73k stars 740 forks source link

How to import files in selenium ide #1713

Closed asimo1998 closed 8 months ago

asimo1998 commented 9 months ago

Dear dev team, We work another team and each member creates a different testscript file, now I need to merge those files together but the selenium version we are using cannot import the file. Can you have an alternative beta version so we can fix this issue. We use selenium ide version 3.17.2 on google chrome.

asimo1998 commented 9 months ago

@toddtarsi Please help me with this problem, thank you

toddtarsi commented 9 months ago

@asimo1998 - I have a package just for you to make upgrading to v4 easy:

https://www.npmjs.com/package/@seleniumhq/side-migrate

asimo1998 commented 9 months ago

@toddtarsi So will this version support file import?

toddtarsi commented 9 months ago

@asimo1998 - Basically, this should take in a v3 side file and spit out a v4 side file. Is this close enough to resolve any issues in your workflow here?

asimo1998 commented 9 months ago

@toddtarsi Let me be more specific

Environment

Problem Using Selenium IDE, we created multiple projects, each project has some tests.

Now we want to run all tests in all project automatically, in 1 click.

Out solution is to merge all tests to 1 project, then run that project.

For example, we have:

Now we want to run tests in order project A -> project B, so we think of merging tests from project A and B to new project, called C, then run project C.

Problem is that we are moving test by copying manually, because we cannot find import feature in Selenium IDE.

Can you provide solution for our problem?

toddtarsi commented 9 months ago

@asimo1998 - Oh! Interesting, you need some way of merging projects. I've been kicking around something around this in v4 for a bit. Since we're native in v4, I think the solution here is going to be to kill the project json and to instead have v4 projects be a directory with each test being a file in a tests folder, and each suite being a file in a suites folder. Reviewing merge conflicts on project jsons in git is just such a nightmare experience. It really caps how many people can edit a project concurrently.

To merge these in v3, you'd need some function to combine two json objects right? It seems like it wouldn't be too bad. Here's an example nodeJS script to merge two projects:

const fs = require('fs');

const projectA = JSON.parse(fs.readFileSync('./projectA.side', 'utf8'))
const projectB = JSON.parse(fs.readFileSync('./projectB.side', 'utf8'))

const mergedProject = {
  ...projectA,
  tests: projectA.tests.concat(projectB.tests),
  suites: projectA.suites.concat(projectB.suites),
};

fs.writeFileSync('./mergedProject.side', JSON.stringify(mergedProject), 'utf8');
asimo1998 commented 9 months ago

@toddtarsi We have referred to the method you provided and it has greatly supported the file merging of team members, your creativity is great Thank you very much for this help. I hope this will likely be a built-in feature for the Selenium IDE in the future <3

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.