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

End to end testing #3066

Merged
merged 26 commits into from
Apr 30, 2024
Merged

Conversation

patrickrb
Copy link
Contributor

@patrickrb patrickrb commented Apr 7, 2024

This pull request was branched from the #3038 branch, but could be merged independently if we close the other one.

You can see the tests running against this PR here: https://github.com/magicbug/Cloudlog/actions/runs/8591149336/job/23539563254

This pull request introduces significant changes to the project, primarily focusing on the introduction of Docker and Cypress for containerization and end-to-end testing respectively. The changes facilitate the setup of a local development environment using Docker and Docker Compose, and the implementation of Cypress for automated testing. Additionally, there are updates to the .env.sample file and a new GitHub workflow for Cypress tests.

Docker and Docker Compose setup:

  • .env.sample: Added new environment variables for MySQL configuration, base locator, website URL, and directory.
  • Dockerfile: Introduced a Dockerfile for PHP and Apache with necessary system dependencies.
  • Dockerfile-db: Created a Dockerfile for MariaDB.
  • docker-compose.yml: Added a Docker Compose file to manage the services for the web application and database.
  • script.sh: Added a shell script to replace placeholders in the configuration files with environment variables and start Apache in the foreground. This eliminates the need for the install page which was necessary for automated testing.

Cypress and GitHub Workflow:

  • .github/workflows/cypress-tests.yml: Introduced a new GitHub workflow for running Cypress tests.
  • cypress.config.js: Added a Cypress configuration file.
  • cypress/e2e/1-login.cy.js, cypress/e2e/2-version-info.cy.js: Implemented Cypress tests for login and version info modal. [1] [2]
  • cypress/support/commands.js, cypress/support/e2e.js: Added Cypress support files for custom commands and e2e tests. [1] [2]
  • package.json: Added Cypress as a devDependency.

Other changes:

Cypress tests running locally:

Login tests

gif of cypress tests running login tests locally

Version info tests

gif of cypress tests running version info tests locally

Cypress tests running in github actions:

Login tests:

login tests github output

Version info tests

version info github tests output

Summary:

summary of github tests running

@magicbug
Copy link
Owner

magicbug commented Apr 9, 2024

Bit early for me to comment as I've just not had time to try it, that being said some testing is very much needed.

Hopefully have some time during this week

@magicbug
Copy link
Owner

Hi @patrickrb

Sorry for delay but finally got time to look into it all

When I do composer up I'm getting the following error

cloudlog-web-1  | /usr/local/bin/docker-php-entrypoint: 9: exec: ./script.sh: not found
cloudlog-web-1 exited with code 127

@magicbug
Copy link
Owner

Got past that error using https://stackoverflow.com/questions/44460825/entrypoint-file-not-found

However getting

A PHP Error was encountered
Severity: Warning

Message: mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known

Filename: mysqli/mysqli_driver.php

Line Number: 203

@magicbug
Copy link
Owner

Ok got passed that with adding mynet see commit.

What I have noticed is that when creating the config.php

$config['base_url']	= 'http://localhost
';

It seems to add a new line which of course is a breaking item

@magicbug
Copy link
Owner

Cypress works fantastic and overall very happy with this PR.. @patrickrb not sure what you think about the base_url or if just ignore it could be just windows CRLF issues

@patrickrb
Copy link
Contributor Author

Cypress works fantastic and overall very happy with this PR.. @patrickrb not sure what you think about the base_url or if just ignore it could be just windows CRLF issues

Awesome, glad you were able to get it working! Excited to see this implemented further.

Going to be at a conference this weekend, should have some time to look at it on Sunday, thanks for trying it out and adding some fixes!

@magicbug
Copy link
Owner

Going to be at a conference this weekend, should have some time to look at it on Sunday, thanks for trying it out and adding some fixes!

Have fun at the conference!

@magicbug
Copy link
Owner

@patrickrb did you have any ideas on the new line issue in config.php or think like me it was windows related and nothing to worry about

@patrickrb
Copy link
Contributor Author

@patrickrb did you have any ideas on the new line issue in config.php or think like me it was windows related and nothing to worry about

Going to take a look at it today!

@patrickrb
Copy link
Contributor Author

@patrickrb did you have any ideas on the new line issue in config.php or think like me it was windows related and nothing to worry about

Going to take a look at it today!

havent been able to replicate it so far, still looking

@magicbug
Copy link
Owner

I think it was a windows one off issue, shall merge it in and see how it acts :)

@magicbug magicbug merged commit 6af3c2f into magicbug:dev Apr 30, 2024
1 check passed
@patrickrb
Copy link
Contributor Author

I think it was a windows one off issue, shall merge it in and see how it acts :)

Awesome, i'll start writing some more tests for some of the main stuff like submitting QSO's. Ideally we'll write tests around areas where bugs are reported, no sense in having tests for code that doesnt break.

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

Successfully merging this pull request may close these issues.

2 participants