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

Tests: Enable cypress to run cucumber tests #133

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

miskopo
Copy link
Member

@miskopo miskopo commented Jul 21, 2023

Add libraries needed to run cucumber tests with cypress, namely cypress-cucumber-preprocessor and cypress-esbuild-preprocessor in order to translate gherkin steps to cypress executable test.

Configure cypress to run the gherkin tests.

@miskopo miskopo requested a review from carma12 July 21, 2023 09:29
@miskopo miskopo self-assigned this Jul 21, 2023
@miskopo miskopo force-pushed the enable_cucumber_cypress branch 3 times, most recently from a46407b to 3814caa Compare July 21, 2023 13:05
@miskopo
Copy link
Member Author

miskopo commented Jul 21, 2023

Vagrant spawning is little bit flaky, I need to look deeper into this

@miskopo miskopo force-pushed the enable_cucumber_cypress branch 24 times, most recently from e55e841 to 0c1e424 Compare July 31, 2023 08:58
@miskopo miskopo force-pushed the enable_cucumber_cypress branch 7 times, most recently from 7a62c2c to 08ff79b Compare July 31, 2023 14:11
@miskopo miskopo added needs-review This PR is waiting on a review tests PR related to testing labels Aug 1, 2023
Copy link
Collaborator

@carma12 carma12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left some questions and notes.

@@ -10,6 +10,11 @@ Vagrant.configure("2") do |config|

# Needed by Cypress - optional if you edit your /etc/hosts
config.vm.network "forwarded_port", guest: 443, host: 443
config.vm.network "private_network",
:ip => "192.168.56.10",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this pointing to the live instance instead of the local one?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why you set this specific IP and where it points to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, this is pointing to a local instance. Once the server is deployed, it's running on 192.168.56.101

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, so it seems that it might be this IP as any other (from my understanding, it is a matter of choice).

FYI: While I was researching the config.vm.network "private_network" command, I read the following in this article (good to take it into account):

To enable this feature we need to add config.vm.network "private_network" to our Vagrantfile. We’re also going to specify the IP address used by the VM. The downside to this is that we have to manage what VMs have what IP if we’re working with multiple VMs. The upsides are that it makes it easier to know what the IP address is without vagrant sshing in and the IP doesn’t get randomly reset forcing us to update a bunch of configuration files.

May there be also a missing number at the end? 192.168.56.101 instead of 192.168.56.10 :)

@@ -0,0 +1,5 @@
const cucumber = require("cypress-cucumber-preprocessor").default;

module.exports = (on, config) => {
Copy link
Collaborator

@carma12 carma12 Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where this config refers to. Considering that this project uses Webpack, it should point to the webpack.config.js file as stated here (Under 'With Webpack' section) and here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Carla!
To be completely frankly honest with you, I don't know either. I was setting it up using the documentation from cypress-cucumber-preprocessor.
The config is not directly in the export statement anyway, so it is very much possible it's either injected or redundant

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, after a second (and even third) reading, it seems that the article mentioned above refers to the use Webpack loader to process feature files. It is still a bit confusing to me if this step is entirely necessary...

But in any case, we can keep the current configuration from now (and change it afterward to adapt it to WebPack if we feel there is something missing).

@carma12 carma12 removed the needs-review This PR is waiting on a review label Aug 22, 2023
Add libraries needed to run cucumber tests with cypress,
namely cypress-cucumber-preprocessor and cypress-esbuild-preprocessor
in order to translate gherkin steps to cypress executable test.

Configure cypress to run the gherkin tests.

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Test the addition of the user.
This test still depends on login via old_UI and will be changed in the
future.
It also depends on freeipa#134

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
@carma12
Copy link
Collaborator

carma12 commented Sep 8, 2023

LGTM. As mentioned in one of the comments, we can keep the current configuration for the Cucumber configuration and change it in the future to adapt it to WebPack if we feel there is some feature we can take advantage of.

@carma12 carma12 added the ack Pull Request approved, it can be merged label Sep 8, 2023
@miskopo
Copy link
Member Author

miskopo commented Sep 8, 2023

Thank you, Carla, I will merge this PR and keep an eye on it. Regarding the network, I have tried too many combinations to remember, but this seems to be the only one that works. Since it's stable, I would also prefer to keep it as it is right now.

Thank you for the review!

@miskopo miskopo merged commit bbf685a into freeipa:main Sep 8, 2023
2 checks passed
@miskopo miskopo deleted the enable_cucumber_cypress branch September 8, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, it can be merged tests PR related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants