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

#389 Fix invalid bahaviour of MAGENTO_BACKEND_BASE_URL #547

Merged
merged 2 commits into from
Jun 23, 2020

Conversation

lbajsarowicz
Copy link
Contributor

Description

Finally - for admin area I've changed the method from amOnPage to amOnUrl. This solution works like a charm. Also introduced the single class to provide proper URL, as it was done inconsistently across the application

Fixed Issues (if relevant)

  1. [Discussion] Add possibility to access frontend and backend on different domains #389

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/verification tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
  • Changes to Framework doesn't have backward incompatible changes for tests or have related Pull Request with fixes to tests

@magento-engcom-team magento-engcom-team added Partner: Mediotype partners-contribution Pull Request is created by Magento Partner labels Jan 11, 2020
@coveralls
Copy link

coveralls commented Jan 11, 2020

Coverage Status

Coverage increased (+1.6%) to 52.741% when pulling b6a245f on lbajsarowicz:bugfix/389-backend-domain into 2fe1372 on magento:2.x-develop.

@lbajsarowicz lbajsarowicz force-pushed the bugfix/389-backend-domain branch 2 times, most recently from b6ae26b to 9901145 Compare January 11, 2020 23:22
@KevinBKozan
Copy link
Contributor

@lbajsarowicz Thank you for your contribution! I've created an internal issue to track progress on revieweing this, I'll keep you updated with comments here.

@jilu1
Copy link
Contributor

jilu1 commented Jan 23, 2020

@lbajsarowicz Can you share the issue you had that motivated you to make the fix? Because recently we had investigated around MAGENTO_BASE_URL, MAGENTO_BACKEND_BASE_URL and MAGENTO_BACKEND_NAME, and MFTF should be able to construct Magento backend url correctly.

@jilu1
Copy link
Contributor

jilu1 commented Jan 23, 2020

@lbajsarowicz I just noticed that you are trying to fix issue #389

  1. MAGENTO_BACKEND_BASE_HOST was wrongly used in .env.example. It has been renamed to MAGENTO_BACKEND_BASE_URL and that's why there is no usage of MAGENTO_BACKEND_BASE_HOST mentioned in issue [Discussion] Add possibility to access frontend and backend on different domains #389
  2. The problem becomes to re-examine all the usage of MAGENTO_BASE_URL and see if MAGENTO_BACKEND_BASE_URL needs to be considered. By looking at it, ModuleResolver.php should be covered. Have you checked it?
  3. I think the persistent object handler should already handle it correctly

@lbajsarowicz
Copy link
Contributor Author

lbajsarowicz commented Jan 24, 2020

  1. MAGENTO_BACKEND_BASE_HOST was wrongly used in .env.example. It has been renamed to MAGENTO_BACKEND_BASE_URL and that's why there is no usage of MAGENTO_BACKEND_BASE_HOST mentioned in issue [Discussion] Add possibility to access frontend and backend on different domains #389

Even with the right configuration - most of the tests arund Magento Admin Panel were failing. I found out that the MAGENTO_BACKEND_BASE_URL was incorrectly implemented - especially with <amOnPage placeholders. As you may noticed in my change - I extended the overall approach.

  1. The problem becomes to re-examine all the usage of MAGENTO_BASE_URL and see if MAGENTO_BACKEND_BASE_URL needs to be considered. By looking at it, ModuleResolver.php should be covered. Have you checked it?

Looks like I forgot to cover it. Working on it already

  1. I think the persistent object handler should already handle it correctly

What actually?

@lbajsarowicz
Copy link
Contributor Author

Module Resolver refactored, too...
I also extracted a few elements to separate methods.

@lbajsarowicz
Copy link
Contributor Author

After changes to Module Resolver, the API Key request does not work properly. I'm investigating that.

@lbajsarowicz
Copy link
Contributor Author

@jilu1 Calling you for review.

@lbajsarowicz
Copy link
Contributor Author

@okolesnyk / @jilu1 Any updates?

@lbajsarowicz
Copy link
Contributor Author

There's nothing about to happen regarding that.
Closing PR.

@okolesnyk okolesnyk reopened this Jun 17, 2020
@okolesnyk
Copy link
Member

okolesnyk commented Jun 17, 2020

@jilu1 @soumyau please review original issue and check with @lbajsarowicz the fix in this pull request.
Please also check community #mftf slack channel, Alexander Ruban having issue with MAGENTO_BACKEND_BASE_URL, please check with him as well if this fix helps.

@soumyau
Copy link
Contributor

soumyau commented Jun 17, 2020

@lbajsarowicz can you resolve conflicts on this branch, so that I can test this out on builds/ configurations?

@lbajsarowicz
Copy link
Contributor Author

lbajsarowicz commented Jun 17, 2020

I'll do that in the night


EDIT: I haven't managed time during the night, I'll do that another night.

@soumyau
Copy link
Contributor

soumyau commented Jun 18, 2020

@lbajsarowicz since this is configuration related bug-fix, we intend to roll this out for both 2.x and 3.x releases. Can I also request you to create another pull request as a patch to 2.x (last patch release being 2.6.4)? Though, this can wait until we've QA'ed this PR.
Thank you!

@okolesnyk
Copy link
Member

Hey @lbajsarowicz
Just to clarify above message.
We would like to deliver this bug fix to both Major releases 2.x and 3.x
For 3.x you have current PullRequest which is created to develop branch
For 2.x please create PullRequest to 2.x-develop branch

Thank you

@lbajsarowicz lbajsarowicz changed the base branch from develop to 2.x-develop June 18, 2020 21:15
@lbajsarowicz lbajsarowicz changed the base branch from 2.x-develop to develop June 18, 2020 21:16
@lbajsarowicz lbajsarowicz changed the base branch from develop to 2.x-develop June 18, 2020 21:34
@lbajsarowicz lbajsarowicz changed the base branch from 2.x-develop to develop June 18, 2020 21:34
@lbajsarowicz lbajsarowicz changed the base branch from develop to 2.x-develop June 18, 2020 21:59
@lbajsarowicz
Copy link
Contributor Author

Please test it very thoroughly, as I was working on this at the very beginning of the year. Now we have almost July, so some things have changed :-)

Copy link
Contributor

@soumyau soumyau left a comment

Choose a reason for hiding this comment

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

Changes look good. Got a green build for 2.3-develop for default configuration ( storefront and admin on same domain). Internal pipeline doesn't support different domain configuration, so couldn't run all tests.
On running a few tests locally with different domain and backend name configuration, found that we have many *Page.xml where url is defined, probably incorrectly.
eg: In AdminShipmentNewPage, url has value order_shipment/new/order_id/

The test failed with this error -
Step See in current url "http://magentoadmin.local/backend/order_shipment/new/order_id/" Fail Failed asserting that 'http://magentoadmin.local/backend/admin/order_shipment/new/order_id/1/' contains "http://magentoadmin.local/backend/order_shipment/new/order_id/".

The right value, in this case should have been admin/order_shipment/new/order_id/.

Someone using a different MAGENTO_BACKEND_NAME to run existing magento tests, may end up with many test failures.

Many magento admin pages have this format as URL:
MAGENTO_BASE_URL/MAGENTO_BACKEND_NAME/admin/rest_of_the_path.
So for amOnPage and seeInCurrentUrl, the argument passed should include admin/rest_of_path in such cases.

@okolesnyk should the page urls be rectified along with the roll out of this fix, or can they be delivered separately?
UR build (with custom MAGENTO_BACKEND_NAME value): https://m2build-ur.devops.magento.com/job/All-User-Requested-Tests/34043/

Copy link
Contributor

@soumyau soumyau left a comment

Choose a reason for hiding this comment

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

Approved! Discussed with team, test fixes will be done in scope of https://jira.corp.magento.com/browse/MQE-1801
@lbajsarowicz good work! You can now proceed creating a PR to develop

@lbajsarowicz
Copy link
Contributor Author

I'll provide that for develop during the weekend
Thank you for the review.

@soumyau soumyau merged commit 88cd0fa into magento:2.x-develop Jun 23, 2020
@soumyau
Copy link
Contributor

soumyau commented Jul 8, 2020

I'll provide that for develop during the weekend

@lbajsarowicz any updates on your PR to develop? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-jira-ticket Partner: Mediotype partners-contribution Pull Request is created by Magento Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants