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

OFFI-78: Support different base path for OC app #386

Merged
merged 13 commits into from
Jul 17, 2024
Merged

Conversation

wAsnk
Copy link
Member

@wAsnk wAsnk commented Jul 7, 2024

@@ -481,7 +481,7 @@ private async Task SetupAsync()

_dockerConfiguration = TestConfigurationManager.GetConfiguration<DockerConfiguration>();

var resultUri = await _currentSetupSnapshotManager.RunOperationAndSnapshotIfNewAsync(async () =>
Copy link
Member

Choose a reason for hiding this comment

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

Please keep this. The setup operation needs to be able to create the URL the test should start from.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, and in what form is it used currently? How can UI tests be started on different URLs currently? I can't seem to find it.

Copy link
Member

Choose a reason for hiding this comment

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

It's this feature you removed here. The URL returned by the setup operation will be the starting URL of the test.

Copy link
Member Author

Choose a reason for hiding this comment

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

I luled, obviously this is what it was using it, but it is not anymore. So let me rephrase my question. Why is it needed to use this URL to navigate to the relative URL at the end of the setup? Is there a reason for that? If so, I don't think resultUri.PathAndQuery is the right way of doing it.

So e.g. what you say is if you set a URL of https://example.com/path/ to start the test on, you would get the relative Url https://example.com/path/path at line await _context.GoToRelativeUrlAsync(resultUri.PathAndQuery); which is obviously not okay.
So the correct navigation step is to navigate to /, which means resultUri isn't needed.

Copy link
Member

Choose a reason for hiding this comment

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

Why would it be correct to always navigate to /? The reason we have the setup operation return a URL is precisely because that's not necessarily the case: the URL it returns is the start URL of the test. This is the URL that'll be open when control arrives at the beginning of a test's code. The setup operation is not necessarily just filling out the setup screen, it can be anything to initialize the app to a testable state.

Copy link
Member Author

Choose a reason for hiding this comment

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

image

Copy link
Member Author

Choose a reason for hiding this comment

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

I swear I did not spend several hours on this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Uhm this actually won't work because we also need a different base path during setup.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay nvm, I can still do it with this, but now it just seems like another solution, and not necessarily a better solution. But I can do it this way if you say so.

Copy link
Member

Choose a reason for hiding this comment

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

Utilizing an existing mechanism, just also earlier, seems like the solution to go, yes.


/// <summary>
/// Gets or sets the base path of the application if mapped to a different URL. For example, if the Orchard Core
/// application is mapped to "/cms" then this should be "/cms/". The / is important at the end, otherwise during
Copy link
Member

Choose a reason for hiding this comment

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

You can make sure this happens with TrimEnd('/') + "/'".

@sarahelsaig sarahelsaig merged commit e82f1a1 into dev Jul 17, 2024
1 check passed
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.

3 participants