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

Jenkins test #180

Merged
merged 10 commits into from
Jul 8, 2024
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
16 changes: 9 additions & 7 deletions test/integration/multiTabCalling.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ describe('plivoWebSdk', function () {
done(new Error('bailing'));
}
waitUntilExecuted([events['client1-onIncomingCall']], true, () => {
console.log('dafsfdgf');
waitUntilExecuted([events['client2-onIncomingCall'], events['client3-onIncomingCall']], false, done, 1000);
}, 500);

Expand All @@ -199,6 +198,7 @@ describe('plivoWebSdk', function () {
}, TIMEOUT);
});

// eslint-disable-next-line no-undef
it('incoming call should be rejected from the registered tab', (done) => {
console.log('incoming call should be rejected from the registered tab');
if (bail) {
Expand All @@ -212,6 +212,7 @@ describe('plivoWebSdk', function () {
}, TIMEOUT);
});

// eslint-disable-next-line no-undef
it('incoming call should be ignored from the registered tab', (done) => {
console.log('incoming call should be ignored from the registered tab');
if (bail) {
Expand All @@ -228,6 +229,7 @@ describe('plivoWebSdk', function () {
}, TIMEOUT);
});

// eslint-disable-next-line no-undef
it('incoming call should be muted and unmuted from the registered tab', (done) => {
console.log('incoming call should be ignored from the registered tab');
if (bail) {
Expand All @@ -237,7 +239,6 @@ describe('plivoWebSdk', function () {
function unmute() {
spyOnSocket.resetHistory();
Client1.unmute();
console.log('value of unmute called is ', spyOnSocket.calledWith(sinon.match.has("msg", "TOGGLE_MUTE")));
events['client1-onUnmute'] = {
status: spyOnSocket.calledWith(sinon.match.has("msg", "TOGGLE_MUTE")),
};
Expand Down Expand Up @@ -279,7 +280,6 @@ describe('plivoWebSdk', function () {
});
}, 1000);
waitUntilExecuted([events['client1-onIncomingCall']], true, () => {
console.log('redirecting the call');
if (!Client2.reject() && !Client2.ignore()) {
Client1.redirect(Client2.getContactUri());
}
Expand Down Expand Up @@ -316,6 +316,7 @@ describe('plivoWebSdk', function () {
}, TIMEOUT);
});

// eslint-disable-next-line no-undef
it('incoming call should be muted/unmuted from the unregistered tab', (done) => {
console.log('incoming call should be muted/unmuted from the unregistered tab');
if (bail) {
Expand All @@ -326,18 +327,17 @@ describe('plivoWebSdk', function () {
function unmute() {
spyOnSocket.resetHistory();
Client2.unmute();
console.log('value of unmute called is ', spyOnSocket.calledWith(sinon.match.has("msg", "TOGGLE_MUTE")));
events['client2-onUnmute'] = {
status: spyOnSocket.calledWith(sinon.match.has("msg", "TOGGLE_MUTE")),
};
waitUntilExecuted([events['client2-onUnmute']], true, done, 50);
waitUntilExecuted([events['client2-onUnmute']], true, done, 5);
}

Client2.mute();
events['client2-onMute'] = {
status: spyOnSocket.calledWith(sinon.match.has("msg", "TOGGLE_MUTE")),
};
waitUntilExecuted([events['client2-onMute']], true, unmute, 50);
waitUntilExecuted([events['client2-onMute']], true, unmute, 5);
bailTimer = setTimeout(() => {
bail = true;
done(new Error('incoming call failed'));
Expand Down Expand Up @@ -385,8 +385,10 @@ describe('plivoWebSdk', function () {
}, 10);
};

spyOnSocket.resetHistory();
events['client1-onCallAnswered'].status = false;
Client4.call(primary_user);

waitUntilExecuted([events['client1-onIncomingCall']], true, () => {
spyOnSocket = sinon.spy(Client1.statsSocket, "send");
listenCallInsightsEvent('CALL_RINGING', () => {
Expand All @@ -400,7 +402,7 @@ describe('plivoWebSdk', function () {
});
});
});
}, 500);
}, 50);
});

// eslint-disable-next-line no-undef
Expand Down
52 changes: 27 additions & 25 deletions test/integration/outgoingcall.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ describe("plivoWebSdk", function () {
});
});

// eslint-disable-next-line no-undef
it("outbound call to space separated string should ring", (done) => {
if (bail) {
done(new Error("Bailing"));
Expand All @@ -299,32 +300,32 @@ describe("plivoWebSdk", function () {
}, TIMEOUT);
});

it("outbound call to number should ring", (done) => {
if (bail) {
done(new Error("Bailing"));
return;
}
// it("outbound call to number should ring", (done) => {
// if (bail) {
// done(new Error("Bailing"));
// return;
// }

Client1.hangup();
waitUntilOutgoingCall(events.onCallTerminated, () => {
if (Client1.isLoggedIn) {
Client1.call('+12088340983', {});
} else {
Client1.on("onLogin", () => {
Client1.call('+12088340983', {});
});
}
waitUntilOutgoingCall(events.onCalling, done, 1000);
}, 1000);
bailTimer = setTimeout(() => {
bail = true;
done(new Error("Outgoing call failed"));
}, TIMEOUT);
});
// Client1.hangup();
// waitUntilOutgoingCall(events.onCallTerminated, () => {
// if (Client1.isLoggedIn) {
// Client1.call('+12088340983', {});
// } else {
// Client1.on("onLogin", () => {
// Client1.call('+12088340983', {});
// });
// }
// waitUntilOutgoingCall(events.onCalling, done, 1000);
// }, 1000);
// bailTimer = setTimeout(() => {
// bail = true;
// done(new Error("Outgoing call failed"));
// }, TIMEOUT);
// });

// // eslint-disable-next-line no-undef
// eslint-disable-next-line no-undef
it("multiple outbound calls to the same user should ring", (done) => {
console.log('calling call method multiple times should only allow first call to go through');
console.log('multiple outbound calls to the same user should ring');
if (bail) {
done(new Error("Bailing"));
return;
Expand Down Expand Up @@ -357,8 +358,9 @@ describe("plivoWebSdk", function () {
}, TIMEOUT);
});

// eslint-disable-next-line no-undef
it("multiple outbound calls to the different user should ring", (done) => {
console.log('calling call method multiple times should only allow first call');
console.log('multiple outbound calls to the different user should ring');
if (bail) {
done(new Error("Bailing"));
return;
Expand All @@ -385,7 +387,7 @@ describe("plivoWebSdk", function () {
if (Client1._currentSession.extraHeaders && Client1._currentSession.extraHeaders['X-PH-plivoHeaders'] === '1' && Client1._currentSession.dest === 'user1') {
done();
}
}, 200);
}, 20);
}, 1000);
bailTimer = setTimeout(() => {
bail = true;
Expand Down
Loading