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

[WIP] Cypress on Travis #7201

Closed

Conversation

NickLaMuro
Copy link
Member

@NickLaMuro NickLaMuro commented Jul 15, 2020

V2 of this PR: #6683

Currenty have some spec fixes to make it "less red", and will remove before merge. Won't merge until we have a passing suite, so this is just getting some of the setup code in place to allow this on CI.

Links

Steps for Testing/QA

Is travis green?

@miq-bot miq-bot added the wip label Jul 15, 2020
@NickLaMuro NickLaMuro force-pushed the cypress-integration-travis branch 4 times, most recently from 3a1cceb to c6c64df Compare July 17, 2020 21:45
@NickLaMuro NickLaMuro force-pushed the cypress-integration-travis branch 2 times, most recently from 07e1b4c to b8075a4 Compare July 23, 2020 00:40
@NickLaMuro NickLaMuro force-pushed the cypress-integration-travis branch 5 times, most recently from edbff5c to 65de6ff Compare July 31, 2020 23:14
@NickLaMuro NickLaMuro force-pushed the cypress-integration-travis branch 2 times, most recently from c9e9889 to 76fb010 Compare August 11, 2020 01:38
desc "Run all cypress specs"
task :cypress => ["app:cypress:ui:run"]

namespace :cypress do
Copy link
Member Author

Choose a reason for hiding this comment

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

For those who might re-reviewing this again, this section was mostly to running get things running via manageiq-cross_repo-tests PR I have been using:

ManageIQ/manageiq-cross_repo-tests#150

I was trying to write too much bash scripting inside of environment variables, so this was a much easier way to not only debug, but also my idea standardize things a bit using rake.

That said, this probably won't be needed if we are running things from this repo, and I expect this is probably not a preferred way of doing things by most, so we can remove this once the core changes have been merged. I can always archive this commit somewhere to consider as an option in the future.

if Rails.root
require "manageiq/integration"

ManageIQ::Integration::CypressRakeTask.new(:ui)
Copy link
Member Author

Choose a reason for hiding this comment

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

You might also noticed that this file got... well way smaller.

The logic for this now lives in ManageIQ/manageiq as part of this PR:

ManageIQ/manageiq#20350

I figured if other plugins what to implement cypress testing, this should be shared code and easily repeatable.

Allows asset-compile tasks to run properly from manageiq-ui-classic,
allowing the full `cypress` test suite tasks to be invoked from there as
well.
Adds a new set of rake tasks for setting up and running cypress.  Makes
use of the `integration:*` rake tasks from core to leverage running a
server in the background.
Disables screenshots when running in travis.

cypress.env.json generation
---------------------------

Cypress handles environment variables itself, so `process.env` isn't
available.  As a result, "Option 2" is what is being done from here:

https://docs.cypress.io/guides/guides/environment-variables.html#Option-2-cypress-env-json

which makes sure a default config file exists as part of the `setup`
step for running the specs.  A `file` task is used here to only run it
if the file doesn't exist, but makes it a dependency for the `:setup`
task.

By default, screenshots are disabled in CI, but enabled in dev.

The cypress.env.json file is also ignored by git, so local edits can
happen and can be customized for each developer.  On CI, it will just be
copied in and the defaults from `.cypress.ci.env.json` will be what is
configured in that environment
Just a helper task for executing the cypress:specs (intended for CI)
- Install node for spec:cypress
- Do an app:cypress:ui:seed instead of update:ui

The app:cypress:ui:seed handles compiling assets, so that would be
duplicate work to run it twice.
Because I am tired of doing `bash -l`... for cross repo tests...

Edit:   Well... apparently it is required for anything `nvm` related...
Edit 2: `nvm` seems to install then use, so just makes sense to have
        this as one step.
Edit 3: `nvm` is a function, so have to source it first... ugh
Edit 4: Set PATH for node.  Add spec:cypress:ci exec task (sets path)
Edit 5: Debugging...
Edit 6: Forgot to add `../bin`... derp
Edit 7: Call seed prior to spec:cypress to avoid DB loaded errors

"DB loaded errors come from the following task:

    app:test:verify_no_db_access_loading_rails_environment
Breaks the file into multiple files of two different categories:

- commands
- assertions
@miq-bot
Copy link
Member

miq-bot commented Aug 11, 2020

Checked commits NickLaMuro/manageiq-ui-classic@0904e07~...0b81ff8 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint
3 files checked, 1 offense detected

Rakefile

@miq-bot
Copy link
Member

miq-bot commented Aug 12, 2020

This pull request is not mergeable. Please rebase and repush.

@chessbyte
Copy link
Member

Now that the move from Travis to GHA is nearly complete, should this be closed or updated for GHA?

@Fryguy
Copy link
Member

Fryguy commented Nov 7, 2022

Good question - I'll have to re-review it

@Fryguy Fryguy self-assigned this Nov 7, 2022
@NickLaMuro
Copy link
Member Author

Just jumping in for some context... but it has also been a minute (👋 )

I think this branch is built on top of #7194 which is just getting the UI able to run Cypress in general. I think if you wanted to start from somewhere, you could use that branch as a base.

That said, This is a 2+ year old branch, so you probably aren't going to loose anything much by starting from scratch. 🙂

@miq-bot miq-bot added the stale label Feb 27, 2023
@miq-bot
Copy link
Member

miq-bot commented Feb 27, 2023

This pull request has been automatically closed because it has not been updated for at least 3 months.

Feel free to reopen this pull request if these changes are still valid.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@miq-bot miq-bot closed this Feb 27, 2023
@Fryguy Fryguy removed the stale label Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants