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

ci: Add legacy browsers for testing #800

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions test/cross-browser-testing/browserstack.karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,42 @@ if (DEBUG === 'true') {

const customLaunchers = {
// Full list of supported browsers - https://www.browserstack.com/list-of-browsers-and-platforms/live
// Fails a few tests related to setTimeout
bs_chrome_mac_48: {
// https://www.w3schools.com/js/js_versions.asp shows a list of browsers that support ES6.
// The below list is primarily the version just before that, or if that version was not available on Browserstack to test, the next version was
// All versions below, including earlier versions of each browser, have a combined ~0.37% market share according to
// www.browserslist.dev. Query for "opera < 38, safari < 12, chrome < 51, firefox <52, edge < 15"
bs_chrome_mac_50: {
base: 'BrowserStack',
browser: 'chrome',
browser_version: '48.0',
browser_version: '50.0',
os: 'OS X',
os_version: 'Mojave'
},
// Oldest Chrome version to pass all tests
bs_chrome_mac_49: {
bs_firefox_mac_51: {
base: 'BrowserStack',
browser: 'chrome',
browser_version: '49.0',
browser: 'firefox',
browser_version: '51.0',
os: 'OS X',
os_version: 'Mojave'
},
bs_edge_windows_15: {
base: 'BrowserStack',
browser: 'edge',
browser_version: '15.0',
os: 'Windows',
os_version: '10'
},
bs_safari_mac_11: {
base: 'BrowserStack',
browser: 'safari',
browser_version: '11.1',
os: 'OS X',
os_version: 'High Sierra'
},
bs_opera_mac_37: {
base: 'BrowserStack',
browser: 'opera',
browser_version: '37.0',
os: 'OS X',
os_version: 'Mojave'
},
Expand Down
22 changes: 9 additions & 13 deletions test/src/tests-core-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,20 @@ describe('core SDK', function() {
});

it('creates a new dateLastEventSent when logging an event, and retains the previous one when ending session', function(done) {
const clock = sinon.useFakeTimers();
mParticle.logEvent('Test Event1');
const testEvent1 = findEventFromRequest(fetchMock.calls(), 'Test Event1');
clock.tick(100);

setTimeout(function() {
mParticle.logEvent('Test Event2');
const testEvent2 = findEventFromRequest(fetchMock.calls(), 'Test Event2');

mParticle.endSession();
const sessionEndEvent = findEventFromRequest(fetchMock.calls(), 'session_end');

const result1 = testEvent1.data.timestamp_unixtime_ms === testEvent2.data.timestamp_unixtime_ms;
const result2 = testEvent2.data.timestamp_unixtime_ms === sessionEndEvent.data.timestamp_unixtime_ms;
mParticle.logEvent('Test Event2');
const testEvent2 = findEventFromRequest(fetchMock.calls(), 'Test Event2');

Should(result1).not.be.ok();
Should(result2).be.ok();
mParticle.endSession();
const sessionEndEvent = findEventFromRequest(fetchMock.calls(), 'session_end');
Should(testEvent1.data.timestamp_unixtime_ms).not.equal(testEvent2.data.timestamp_unixtime_ms);
Should(testEvent2.data.timestamp_unixtime_ms).equal(sessionEndEvent.data.timestamp_unixtime_ms);

done();
}, 5);
done();
});

it('should process ready queue when initialized', function(done) {
Expand Down
Loading