-
Notifications
You must be signed in to change notification settings - Fork 483
Conversation
it('#property() works with input params', async () => { | ||
let page = await phantom.createPage(); | ||
let outObj = phantom.createOutObject(); | ||
describe('#property', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Property specs here in this describe block pass. All other specs in this change set fail.
await page.property('onResourceReceived', function(response, out) { | ||
out.lastResponse = response; | ||
}, outObj); | ||
await page.property('onResourceRequested', true, function(requestData, networkRequest, out) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pboling why you passing true
to property
? That's supposed to be for on
only according to the read me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. This is supposed to be a test of on
, not property
. Fixed in latest commit.
Almost all of your examples are using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for changes for property
Sorry, that was a transcription error. The specs that I care most about, because |
@amir20 the specs have been switched to call |
It is a little strange that I get 9 failures locally and Travis only gets 7, but even still all the ones testing the feature I need are failing on Travis as well as locally. |
I see what's going on. The problem is that Probably worth doing one of two things:
|
await page.property('onResourceReceived', function(response, out) { | ||
out.lastResponse = response; | ||
}, outObj); | ||
await page.on('onResourceRequested', true, function(requestData, networkRequest, out) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await page.property('onResourceRequested', function(requestData, networkRequest, out) {
out.lastRequest = requestData;
}, outObj);
works. So probably on
and outobject
have not been tested.
See my other comment
@amir20 the second to last line of the Readme section for https://github.com/amir20/phantomjs-node#pageon
|
@amir20 I have added robust working examples that accomplish what I need via |
if (out.isMatch) { | ||
responseObj.status = 'aborted'; | ||
out.urls_aborted.push(responseObj); | ||
networkRequest.abort(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
networkRequest.abort()
does work within property!!!
The thing I was doing that appears to have been breaking it was passing a regex into the outObj. It seems that is not possible. The specs show passing in of simple, JSON-valid data types. Perhaps a Regex is too complex to pass within an outObj?
This PR is no longer valid. Closing. The original issue is still valid and documentation needs to be updated. |
@amir20 Checking my understanding here:
If that is correct I will add a new PR that corrects the documentation and also adds the additional specs. NOTE: I was able to get my code working following the model of the passing specs! |
Yes.
Also yes. I actually didn't know you had added new tests. I'd be more than happy to add those in as a separate PR if you have 'em available. I love more tests. I just couldn't pass through the broken tests. |
I'll separate out the passing ones in a new PR! |
Proposed changes in this pull request
This PR is to show what is broken. Some of the things broken are mentioned in the Readme as expected to be working.
Checklist
npm test
passes successfully@amir20 to review