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

[Regression] grabFromCurrentUrl() doesn't work with REST in v2.2 #3197

Closed
konstin opened this Issue Jun 9, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@konstin

konstin commented Jun 9, 2016

After upgrading to v2.2, grabFromCurrentUrl() does no longer return the url requested using sendGET() but instead errors after printing [LogicException] The page history is empty.. This change is not mentioned in the release notes.

Minimal example

The following example works v2.1 but fails in v2.2
acceptance.suite.yml:

class_name: AcceptanceTester
modules:
    enabled:
        - REST:
            depends: PhpBrowser
            url: http://localhost:8080
        - PhpBrowser

acceptance/grabUrlCept.cept:

$I = new AcceptanceTester($scenario);
$I->wantTo('I want to retrieve the current URL');
$I->sendGET('/');
$I->grabFromCurrentUrl();
@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Jun 9, 2016

Member

I think that this is not even a bug,
sendGET is a REST method, grabFromCurrentUrl is a method of PhpBrowser - mixing methods of REST module and connection module in one test is not documented and not recommended

Member

Naktibalda commented Jun 9, 2016

I think that this is not even a bug,
sendGET is a REST method, grabFromCurrentUrl is a method of PhpBrowser - mixing methods of REST module and connection module in one test is not documented and not recommended

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Jun 9, 2016

Member

REST requests are no longer added to browser history, so PhpBrowser methods that are relying on history are not working.

Member

Naktibalda commented Jun 9, 2016

REST requests are no longer added to browser history, so PhpBrowser methods that are relying on history are not working.

@konstin

This comment has been minimized.

Show comment
Hide comment
@konstin

konstin Jun 9, 2016

I think that this is not even a bug,
sendGET is a REST method, grabFromCurrentUrl is a method of PhpBrowser - mixing methods of REST module and connection module in one test is not documented and not recommended

I'm actually not keen on mixing them, but the REST modules lacks an analogous method.

REST requests are no longer added to browser history, so PhpBrowser methods that are relying on history are not working.

What's the reason for this behavior? And why is a breaking change like this one not mentioned in the release notes?

konstin commented Jun 9, 2016

I think that this is not even a bug,
sendGET is a REST method, grabFromCurrentUrl is a method of PhpBrowser - mixing methods of REST module and connection module in one test is not documented and not recommended

I'm actually not keen on mixing them, but the REST modules lacks an analogous method.

REST requests are no longer added to browser history, so PhpBrowser methods that are relying on history are not working.

What's the reason for this behavior? And why is a breaking change like this one not mentioned in the release notes?

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Jun 16, 2016

Member

And why is a breaking change like this one not mentioned in the release notes?

Yes, this was our fault. I think we had a discussion about history list for REST module but forgot to set it in the changelog. Sorry.

Basically REST module doesn't change history so can't access current URL.

There is a good reason for that. If you need to execute API requests inside PhpBrowser acceptance test you shouldn't have it to change request history. This way you can be sure that *currentUrl methods work only with currently opened web page.

REST modules lacks an analogous method.

Yes, there is no. Could you provide a use case for it? This way we could also agree on a patch to Codeception or provie an alternative way to solve your issue.

Member

DavertMik commented Jun 16, 2016

And why is a breaking change like this one not mentioned in the release notes?

Yes, this was our fault. I think we had a discussion about history list for REST module but forgot to set it in the changelog. Sorry.

Basically REST module doesn't change history so can't access current URL.

There is a good reason for that. If you need to execute API requests inside PhpBrowser acceptance test you shouldn't have it to change request history. This way you can be sure that *currentUrl methods work only with currently opened web page.

REST modules lacks an analogous method.

Yes, there is no. Could you provide a use case for it? This way we could also agree on a patch to Codeception or provie an alternative way to solve your issue.

@konstin

This comment has been minimized.

Show comment
Hide comment
@konstin

konstin Jun 20, 2016

The grabFromCurrentUrl() is required for an actor method that verifies that a value in the JSON response equals the requested URL. This is a requirement of the API. This is what I assume to add the missing functionality.

konstin commented Jun 20, 2016

The grabFromCurrentUrl() is required for an actor method that verifies that a value in the JSON response equals the requested URL. This is a requirement of the API. This is what I assume to add the missing functionality.

@konstin

This comment has been minimized.

Show comment
Hide comment
@konstin

konstin Aug 15, 2016

@DavertMik: Any progress here?

konstin commented Aug 15, 2016

@DavertMik: Any progress here?

Naktibalda added a commit to Naktibalda/Codeception that referenced this issue Aug 15, 2016

@Naktibalda Naktibalda closed this in #3446 Aug 26, 2016

@konstin

This comment has been minimized.

Show comment
Hide comment
@konstin

konstin Aug 27, 2016

Thank you!

konstin commented Aug 27, 2016

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment