Automated browser testing (#1415)
* Move automated api tests to api directory * First pass at automated browser testing
This commit is contained in:
42
test/automated/browser/tests/chat.js
Normal file
42
test/automated/browser/tests/chat.js
Normal file
@@ -0,0 +1,42 @@
|
||||
async function interactiveChatTest(browser, page, newName, chatMessage, device) {
|
||||
it('should have the chat input', async () => {
|
||||
await page.waitForSelector('#message-input');
|
||||
});
|
||||
|
||||
it('should have the chat input enabled', async () => {
|
||||
const isDisabled = await page.evaluate(
|
||||
'document.querySelector("#message-input").getAttribute("disabled")'
|
||||
);
|
||||
expect(isDisabled).not.toBe('true');
|
||||
});
|
||||
|
||||
it('should have the username label', async () => {
|
||||
await page.waitForSelector('#username-display');
|
||||
});
|
||||
|
||||
it('should allow changing the username on ' + device, async () => {
|
||||
await page.waitForSelector('#username-display');
|
||||
await page.evaluate(()=>document.querySelector('#username-display').click())
|
||||
|
||||
await page.waitForSelector('#username-change-input');
|
||||
await page.evaluate(()=>document.querySelector('#username-change-input').click())
|
||||
await page.type('#username-change-input', 'a new name');
|
||||
|
||||
await page.evaluate(()=>document.querySelector('#username-change-input').click())
|
||||
await page.type('#username-change-input', newName);
|
||||
|
||||
await page.waitForSelector('#button-update-username');
|
||||
await page.evaluate(()=>document.querySelector('#button-update-username').click())
|
||||
});
|
||||
|
||||
it('should allow typing a chat message', async () => {
|
||||
await page.waitForSelector('#message-input');
|
||||
await page.evaluate(()=>document.querySelector('#message-input').click())
|
||||
await page.waitForTimeout(1000);
|
||||
await page.focus('#message-input')
|
||||
await page.keyboard.type(chatMessage)
|
||||
page.keyboard.press('Enter');
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.interactiveChatTest = interactiveChatTest;
|
||||
11
test/automated/browser/tests/video.js
Normal file
11
test/automated/browser/tests/video.js
Normal file
@@ -0,0 +1,11 @@
|
||||
async function videoTest(browser, page) {
|
||||
it('should have the video container element', async () => {
|
||||
await page.waitForSelector('#video-container');
|
||||
});
|
||||
|
||||
it('should have the stream info status bar', async () => {
|
||||
await page.waitForSelector('#stream-info');
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.videoTest = videoTest;
|
||||
Reference in New Issue
Block a user