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

Implement fixes in Raygun4JS to correctly handle XHRs and virtual pages + enables tests #491

Conversation

darcythomas
Copy link
Contributor

@darcythomas darcythomas commented Jul 11, 2023

This PR fixes:

  1. A bug where under some rare race conditions xhr requests get attributed to a different parent resource (page url)
  2. It also updates and allows the unit tests for this project, to be run under a GitHub Action

@darcythomas darcythomas requested a review from Olwiba July 11, 2023 04:54
@darcythomas darcythomas changed the title Darcy/mc 114/correctly handle xh rs and virtual pages with tests Implement fixes in Raygun4JS to correctly handle XHRs and virtual pages Jul 11, 2023
@darcythomas darcythomas changed the title Implement fixes in Raygun4JS to correctly handle XHRs and virtual pages Implement fixes in Raygun4JS to correctly handle XHRs and virtual pages + enables tests Jul 11, 2023
Copy link
Collaborator

@Olwiba Olwiba left a comment

Choose a reason for hiding this comment

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

Have completed my review of the changes. I'm a little concerned about the test timing blowing out or becoming flakey due to the async behaviour implemented, how come we added all this? Is it just to get GH actions to work?

Otherwise just some minor code formatting changes, I wonder if there is a eslint file in this project to standardise how IDEs apply code styles

CHANGELOG.md Outdated Show resolved Hide resolved
jasmine.json Outdated Show resolved Hide resolved
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-uglify": "^4.0.1",
"@wdio/cli": "^8.11.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

What led to all these dependencies needing to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well!

I needed to update the node version to one which was supported:

  1. Period
  2. On My machine
  3. On Github actions

I then had to update the testing libraries etc. So that would compile under a supported version of node.

Because of a breaking changes in the wdio & jasmine i needed to update thew tests (async and removing .not. respectively)

package.json Outdated Show resolved Hide resolved
Comment on lines -1026 to -1032
} else if (window.XDomainRequest) {
xhr.ontimeout = function() {
if (_enableOfflineSave) {
Raygun.Utilities.log('Raygun: saved locally');
offlineSave(url, data);
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

please explain this regression?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair.

This was a missed piece for another PR.
window.XDomainRequest has been obsoleted since IE8.

So I removed it from here as well.

browser.reloadSession();
beforeEach(function() {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the test execution time impact of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not much this only applies for these few tests. and most of them complete will within the timeout period.

It takes about 5 min to complete all of the tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To took about 5 min the last time these tests were run successfully

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok i have made this only pause as long as it needs to (up to 40 seconds)

Copy link
Collaborator

Choose a reason for hiding this comment

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

sounds good, seeing as these are only being run by GH actions this won't have an impact on any TC builds. Happy for the added test time due to the async behaviour 😄

Comment on lines 55 to 57
expect(payloadUrl === pairUrl).toBeTrue("failed for type: " + pairType);
expect(payloadStatus === pairStatus).toBeTrue( "failed for type: " + pairType);
expect(payloadDataType === payloadDataType).toBeTrue( "XHR data type missing for: " + pairType);
Copy link
Collaborator

Choose a reason for hiding this comment

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

we have lost the jasmine comparitors here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It throws a 'Negation comparison not an option' (or some thing like that).

tests/specs/v2/rumXhrStatusTracking.js Outdated Show resolved Hide resolved
tests/specs/v2/rumXhrStatusTracking.js Outdated Show resolved Hide resolved
tests/specs/v2/rumXhrStatusTracking.js Show resolved Hide resolved
@darcythomas darcythomas requested a review from Olwiba July 17, 2023 22:12
Copy link
Collaborator

@Olwiba Olwiba left a comment

Choose a reason for hiding this comment

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

Outstanding work on this one Darcy! Got some good wins in this PR for the provider 😄
Hopefully, you enjoyed working in the JS space..

Let me know how the pre-soak goes and if there's anything I can do to help with testing.

browser.reloadSession();
beforeEach(function() {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

sounds good, seeing as these are only being run by GH actions this won't have an impact on any TC builds. Happy for the added test time due to the async behaviour 😄

@darcythomas darcythomas merged commit 90b500b into master Jul 20, 2023
1 check passed
@darcythomas darcythomas deleted the darcy/MC-114/correctly-handle-XHRs-and-virtual-pages-with-Tests branch August 4, 2023 03:17
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.

2 participants