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

New Feature Tests #113

Open
1 of 5 tasks
silverbackdan opened this issue Nov 11, 2020 · 9 comments
Open
1 of 5 tasks

New Feature Tests #113

silverbackdan opened this issue Nov 11, 2020 · 9 comments
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest

Comments

@silverbackdan
Copy link
Collaborator

silverbackdan commented Nov 11, 2020

During development, some features may have been added which tests have not been written for in the interest of development speed. Some tests should be written in future for these features.

  • Filtering and ordering of layout resource
  • Filtering and ordering of page resource
  • Page data normalization inc. throwing errors if page data not found and skipping if admin user and returning components anyway for page template admin.
  • OpenApi Factory decorator
  • UserDataProvider and the /me endpoint is using the username instead of id for lookup
@silverbackdan silverbackdan added enhancement New feature or request good first issue Good for newcomers labels Nov 11, 2020
@bofalke
Copy link
Contributor

bofalke commented Oct 10, 2022

Hi @silverbackdan I'd like to try to give this issue a shot.

Can you maybe give me some information for the dev setup? I saw there was a docker-compose file in the v1 branch, is there something similar for the main branch as well?

@silverbackdan
Copy link
Collaborator Author

Hi @bofalke - that's great thank you.
Sorry there's no docker compose in this one.
It's dependent on PHP >=8.1
And I think for such a long time now, I've simply been running this as tests to make sure things work.
It's installed as a bundle in the template repository in the /api directory.
https://github.com/components-web-app/components-web-app

Although you could do this, I want to make your life a lot easier, so I will look to get a docker-compose setup in place tomorrow for you.

The test application is run from tests/Functional/app/ so I'll create some configurations to make this spin up and run nicely so it can be viewed and manually tested easily too.

@bofalke
Copy link
Contributor

bofalke commented Oct 11, 2022

That sounds great, thank you for the support!

I already ran the phpunit test suite locally, that worked fine 👍

I will try and figure out a way to setup a test for the filtering and ordering tasks mentioned in the issue description first

@silverbackdan
Copy link
Collaborator Author

Thanks. You can see the front-end interacting with the API at https://demo.cwa.rocks
The filtering and ordering is done when you login at https://demo.cwa.rocks/login (username and password are both admin)
Then in the top bar you can navigate to view layouts and pages etc.
https://demo.cwa.rocks/_cwa/layouts?order%5BcreatedAt%5D=desc&page=1

As you search and reorder, you'll see the query-string update. This will be the same querystring to be appended to the request for the API too.

The API is live here:
https://api.cwa.rocks/

You could create Behat scenarios to test this functionality.
We run Behat for functional tests and PHPUnit for unit tests on the project.

@silverbackdan
Copy link
Collaborator Author

You can also run Behat features with ./vendor/bin/behat
And see how these tests are run in the Github actions too.
I'm sorry I'm being snowed under today but will do my best to have a docker setup going ASAP. might be late this evening or tomorrow.

@bofalke
Copy link
Contributor

bofalke commented Oct 11, 2022

Yeah no worries,

I think the behat tests will run even without a local dev setup so i can start already. I was so focused on the phpunit stuff that i did not see the behat configuration yesterday. Will be my first time actually working with behat but i'll figure it out 👍

Btw I saw your demo of the project at the api platform conference, thats why i wanted to see if i could help out somehow

@silverbackdan
Copy link
Collaborator Author

Oh amazing, thanks for jumping on board! This is super helpful.
Yes I usually just create tests for this project which is why I don't have a docker setup in place right now. :)

@silverbackdan
Copy link
Collaborator Author

Shout if you want any help or advice

bofalke added a commit to bofalke/api-components-bundle that referenced this issue Oct 26, 2022
@silverbackdan
Copy link
Collaborator Author

Layouts done: #150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Hacktoberfest
Projects
None yet
Development

No branches or pull requests

2 participants