Skip to content

Commit 9a9231c

Browse files
committed
openvidu-components: Added e2e test for audio only mediastream
Tested if NO_STREAM_PLAYING_EVENT exception is not showing when participant has video muted and MediaStream is audio only.
1 parent 1fe005c commit 9a9231c

File tree

2 files changed

+184
-102
lines changed

2 files changed

+184
-102
lines changed

openvidu-components-angular/e2e/webcomponent-app/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ $(document).ready(() => {
170170
var user = JSON.parse(e.target.connection.data).clientData;
171171
appendElement(user + '-sessionDisconnected');
172172
});
173+
174+
session.on('exception', (e) => appendElement(e.name));
173175
});
174176

175177
webComponent.addEventListener('onParticipantCreated', (event) => {

openvidu-components-angular/e2e/webcomponent.test.ts

Lines changed: 182 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ describe('Testing API Directives', () => {
500500

501501
// Go to first tab
502502
const tabs = await browser.getAllWindowHandles();
503-
browser.switchTo().window(tabs[0]);
503+
await browser.switchTo().window(tabs[0]);
504504

505505
// Checking if mute button is not displayed in participant item
506506
await utils.waitForElement('#remote-participant-item');
@@ -1531,6 +1531,187 @@ describe('Testing CHAT features', () => {
15311531
});
15321532
});
15331533

1534+
1535+
describe('Testing video is playing', () => {
1536+
let browser: WebDriver;
1537+
let utils: OpenViduComponentsPO;
1538+
1539+
async function createChromeBrowser(): Promise<WebDriver> {
1540+
return await new Builder()
1541+
.forBrowser(WebComponentConfig.browserName)
1542+
.withCapabilities(WebComponentConfig.browserCapabilities)
1543+
.setChromeOptions(WebComponentConfig.browserOptions)
1544+
.usingServer(WebComponentConfig.seleniumAddress)
1545+
.build();
1546+
}
1547+
1548+
beforeEach(async () => {
1549+
browser = await createChromeBrowser();
1550+
utils = new OpenViduComponentsPO(browser);
1551+
});
1552+
1553+
afterEach(async () => {
1554+
await browser.quit();
1555+
});
1556+
1557+
it('should play the participant video with only audio', async () => {
1558+
const sessionName = 'audioOnlyE2E';
1559+
const fixedUrl = `${url}&sessionName=${sessionName}`;
1560+
await browser.get(fixedUrl);
1561+
1562+
await utils.checkPrejoinIsPresent();
1563+
await utils.clickOn('#join-button');
1564+
1565+
// Starting new browser for adding the second participant
1566+
const newTabScript = `window.open("${fixedUrl}")`;
1567+
await browser.executeScript(newTabScript);
1568+
const tabs = await browser.getAllWindowHandles();
1569+
await browser.switchTo().window(tabs[1]);
1570+
1571+
await utils.checkPrejoinIsPresent();
1572+
await utils.clickOn('#camera-button');
1573+
await utils.clickOn('#join-button');
1574+
1575+
// Go to first tab
1576+
await browser.switchTo().window(tabs[0]);
1577+
1578+
// Wait until NO_STREAM_PLAYING_EVENT exception timeout is reached
1579+
await browser.sleep(6000);
1580+
1581+
const exceptionQuantity = await utils.getNumberOfElements('#NO_STREAM_PLAYING_EVENT');
1582+
expect(exceptionQuantity).equals(0);
1583+
});
1584+
1585+
it('should play the participant video with only video', async () => {
1586+
const sessionName = 'audioOnlyE2E';
1587+
const fixedUrl = `${url}&sessionName=${sessionName}`;
1588+
await browser.get(fixedUrl);
1589+
1590+
await utils.checkPrejoinIsPresent();
1591+
await utils.clickOn('#join-button');
1592+
1593+
// Starting new browser for adding the second participant
1594+
const newTabScript = `window.open("${fixedUrl}")`;
1595+
await browser.executeScript(newTabScript);
1596+
const tabs = await browser.getAllWindowHandles();
1597+
await browser.switchTo().window(tabs[1]);
1598+
1599+
await utils.checkPrejoinIsPresent();
1600+
await utils.clickOn('#microphone-button');
1601+
await utils.clickOn('#join-button');
1602+
1603+
// Go to first tab
1604+
await browser.switchTo().window(tabs[0]);
1605+
1606+
// Wait until NO_STREAM_PLAYING_EVENT exception timeout is reached
1607+
await browser.sleep(6000);
1608+
1609+
const exceptionQuantity = await utils.getNumberOfElements('#NO_STREAM_PLAYING_EVENT');
1610+
expect(exceptionQuantity).equals(0);
1611+
});
1612+
});
1613+
1614+
describe('Testing WITHOUT MEDIA DEVICES permissions', () => {
1615+
let browser: WebDriver;
1616+
let utils: OpenViduComponentsPO;
1617+
async function createChromeBrowser(): Promise<WebDriver> {
1618+
return await new Builder()
1619+
.forBrowser(WebComponentConfig.browserName)
1620+
.withCapabilities(WebComponentConfig.browserCapabilities)
1621+
.setChromeOptions(getBrowserOptionsWithoutDevices())
1622+
.usingServer(WebComponentConfig.seleniumAddress)
1623+
.build();
1624+
}
1625+
1626+
beforeEach(async () => {
1627+
browser = await createChromeBrowser();
1628+
utils = new OpenViduComponentsPO(browser);
1629+
});
1630+
1631+
afterEach(async () => {
1632+
await browser.quit();
1633+
});
1634+
1635+
it('should be able to ACCESS to PREJOIN page', async () => {
1636+
await browser.get(`${url}`);
1637+
1638+
await utils.checkPrejoinIsPresent();
1639+
1640+
let button = await utils.waitForElement('#camera-button');
1641+
expect(await button.isEnabled()).to.be.false;
1642+
1643+
button = await utils.waitForElement('#microphone-button');
1644+
expect(await button.isEnabled()).to.be.false;
1645+
});
1646+
1647+
it('should be able to ACCESS to ROOM page', async () => {
1648+
await browser.get(`${url}`);
1649+
1650+
await utils.checkPrejoinIsPresent();
1651+
1652+
await utils.clickOn('#join-button');
1653+
1654+
await utils.checkSessionIsPresent();
1655+
1656+
await utils.checkToolbarIsPresent();
1657+
1658+
let button = await utils.waitForElement('#camera-btn');
1659+
expect(await button.isEnabled()).to.be.false;
1660+
1661+
button = await utils.waitForElement('#mic-btn');
1662+
expect(await button.isEnabled()).to.be.false;
1663+
});
1664+
1665+
it('should be able to ACCESS to ROOM page without prejoin', async () => {
1666+
await browser.get(`${url}&prejoin=false`);
1667+
1668+
await utils.checkSessionIsPresent();
1669+
1670+
await utils.checkToolbarIsPresent();
1671+
1672+
let button = await utils.waitForElement('#camera-btn');
1673+
expect(await button.isEnabled()).to.be.false;
1674+
1675+
button = await utils.waitForElement('#mic-btn');
1676+
expect(await button.isEnabled()).to.be.false;
1677+
});
1678+
1679+
it('should the settings buttons be disabled', async () => {
1680+
await browser.get(`${url}&prejoin=false`);
1681+
1682+
await utils.checkToolbarIsPresent();
1683+
1684+
// Open more options menu
1685+
await utils.clickOn('#more-options-btn');
1686+
1687+
await browser.sleep(500);
1688+
1689+
// Checking if fullscreen button is not present
1690+
await utils.waitForElement('.mat-menu-content');
1691+
expect(await utils.isPresent('.mat-menu-content')).to.be.true;
1692+
1693+
await utils.clickOn('#toolbar-settings-btn');
1694+
1695+
await browser.sleep(500);
1696+
1697+
await utils.waitForElement('.settings-container');
1698+
expect(await utils.isPresent('.settings-container')).to.be.true;
1699+
1700+
await utils.clickOn('#video-opt');
1701+
expect(await utils.isPresent('ov-video-devices-select')).to.be.true;
1702+
1703+
let button = await utils.waitForElement('#camera-button');
1704+
expect(await button.isEnabled()).to.be.false;
1705+
1706+
await utils.clickOn('#audio-opt');
1707+
expect(await utils.isPresent('ov-audio-devices-select')).to.be.true;
1708+
1709+
button = await utils.waitForElement('#microphone-button');
1710+
expect(await button.isEnabled()).to.be.false;
1711+
1712+
});
1713+
});
1714+
15341715
describe('Testing PRO features with OpenVidu CE', () => {
15351716
let browser: WebDriver;
15361717
let utils: OpenViduComponentsPO;
@@ -1813,104 +1994,3 @@ describe('Testing PRO features with OpenVidu CE', () => {
18131994

18141995
// });
18151996
// });
1816-
1817-
describe('Testing WITHOUT MEDIA DEVICES permissions', () => {
1818-
let browser: WebDriver;
1819-
let utils: OpenViduComponentsPO;
1820-
async function createChromeBrowser(): Promise<WebDriver> {
1821-
return await new Builder()
1822-
.forBrowser(WebComponentConfig.browserName)
1823-
.withCapabilities(WebComponentConfig.browserCapabilities)
1824-
.setChromeOptions(getBrowserOptionsWithoutDevices())
1825-
.usingServer(WebComponentConfig.seleniumAddress)
1826-
.build();
1827-
}
1828-
1829-
beforeEach(async () => {
1830-
browser = await createChromeBrowser();
1831-
utils = new OpenViduComponentsPO(browser);
1832-
});
1833-
1834-
afterEach(async () => {
1835-
await browser.quit();
1836-
});
1837-
1838-
it('should be able to ACCESS to PREJOIN page', async () => {
1839-
await browser.get(`${url}`);
1840-
1841-
await utils.checkPrejoinIsPresent();
1842-
1843-
let button = await utils.waitForElement('#camera-button');
1844-
expect(await button.isEnabled()).to.be.false;
1845-
1846-
button = await utils.waitForElement('#microphone-button');
1847-
expect(await button.isEnabled()).to.be.false;
1848-
});
1849-
1850-
it('should be able to ACCESS to ROOM page', async () => {
1851-
await browser.get(`${url}`);
1852-
1853-
await utils.checkPrejoinIsPresent();
1854-
1855-
await utils.clickOn('#join-button');
1856-
1857-
await utils.checkSessionIsPresent();
1858-
1859-
await utils.checkToolbarIsPresent();
1860-
1861-
let button = await utils.waitForElement('#camera-btn');
1862-
expect(await button.isEnabled()).to.be.false;
1863-
1864-
button = await utils.waitForElement('#mic-btn');
1865-
expect(await button.isEnabled()).to.be.false;
1866-
});
1867-
1868-
it('should be able to ACCESS to ROOM page without prejoin', async () => {
1869-
await browser.get(`${url}&prejoin=false`);
1870-
1871-
await utils.checkSessionIsPresent();
1872-
1873-
await utils.checkToolbarIsPresent();
1874-
1875-
let button = await utils.waitForElement('#camera-btn');
1876-
expect(await button.isEnabled()).to.be.false;
1877-
1878-
button = await utils.waitForElement('#mic-btn');
1879-
expect(await button.isEnabled()).to.be.false;
1880-
});
1881-
1882-
it('should the settings buttons be disabled', async () => {
1883-
await browser.get(`${url}&prejoin=false`);
1884-
1885-
await utils.checkToolbarIsPresent();
1886-
1887-
// Open more options menu
1888-
await utils.clickOn('#more-options-btn');
1889-
1890-
await browser.sleep(500);
1891-
1892-
// Checking if fullscreen button is not present
1893-
await utils.waitForElement('.mat-menu-content');
1894-
expect(await utils.isPresent('.mat-menu-content')).to.be.true;
1895-
1896-
await utils.clickOn('#toolbar-settings-btn');
1897-
1898-
await browser.sleep(500);
1899-
1900-
await utils.waitForElement('.settings-container');
1901-
expect(await utils.isPresent('.settings-container')).to.be.true;
1902-
1903-
await utils.clickOn('#video-opt');
1904-
expect(await utils.isPresent('ov-video-devices-select')).to.be.true;
1905-
1906-
let button = await utils.waitForElement('#camera-button');
1907-
expect(await button.isEnabled()).to.be.false;
1908-
1909-
await utils.clickOn('#audio-opt');
1910-
expect(await utils.isPresent('ov-audio-devices-select')).to.be.true;
1911-
1912-
button = await utils.waitForElement('#microphone-button');
1913-
expect(await button.isEnabled()).to.be.false;
1914-
1915-
});
1916-
});

0 commit comments

Comments
 (0)