Merge pull request #7540 from MaximKhlobystov/webdriverio-tests

WebdriverIO Tests
This commit is contained in:
Anton Georgiev 2019-06-04 11:10:24 -04:00 committed by GitHub
commit 2c85ff6c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 598 additions and 6 deletions

View File

@ -49,6 +49,7 @@ class EndMeetingComponent extends React.PureComponent {
</div>
<div className={styles.footer}>
<Button
data-test="confirmEndMeeting"
color="primary"
className={styles.button}
label={intl.formatMessage(intlMessages.yesLabel)}

View File

@ -170,7 +170,7 @@ class MeetingEnded extends React.PureComponent {
<div className={styles.parent}>
<div className={styles.modal}>
<div className={styles.content}>
<h1 className={styles.title}>
<h1 className={styles.title} data-test="meetingEndedModalTitle">
{
intl.formatMessage(intlMessage[code] || intlMessage[430])
}

View File

@ -466,6 +466,12 @@
"resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz",
"integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI="
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
"dev": true
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -905,6 +911,24 @@
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true
},
"chrome-remote-interface": {
"version": "0.25.7",
"resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.25.7.tgz",
"integrity": "sha512-6zI6LbR2IiGmduFZededaerEr9hHXabxT/L+fRrdq65a0CfyLMzpq0BKuZiqN0Upqcacsb6q2POj7fmobwBsEA==",
"dev": true,
"requires": {
"commander": "2.11.x",
"ws": "3.3.x"
},
"dependencies": {
"commander": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==",
"dev": true
}
}
},
"ci-info": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
@ -3233,6 +3257,12 @@
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
"dev": true
},
"is-wsl": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
"integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=",
"dev": true
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@ -3254,6 +3284,22 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"jasmine": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.4.0.tgz",
"integrity": "sha512-sR9b4n+fnBFDEd7VS2el2DeHgKcPiMVn44rtKFumq9q7P/t8WrxsVIZPob4UDdgcDNCwyDqwxCt4k9TDRmjPoQ==",
"dev": true,
"requires": {
"glob": "^7.1.3",
"jasmine-core": "~3.4.0"
}
},
"jasmine-core": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.4.0.tgz",
"integrity": "sha512-HU/YxV4i6GcmiH4duATwAbJQMlE0MsDIR5XmSVxURxKHn3aGAdbY1/ZJFmVRbKtnLwIxxMJD7gYaPsypcbYimg==",
"dev": true
},
"jimp": {
"version": "0.2.28",
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.2.28.tgz",
@ -4565,6 +4611,15 @@
}
}
},
"node-netstat": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/node-netstat/-/node-netstat-1.6.0.tgz",
"integrity": "sha512-KPDopkvPllhcILoHMWYUxvOO5c+VcPB38LxlOFPiZhZ/hJTMH/GXGCs6nvxu4d6unwsbEfgzJ4pPye3CFv9yTg==",
"dev": true,
"requires": {
"is-wsl": "^1.1.0"
}
},
"node-releases": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.1.tgz",
@ -6741,6 +6796,12 @@
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
},
"ultron": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
"integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==",
"dev": true
},
"union-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz",
@ -6925,12 +6986,34 @@
"loose-envify": "^1.0.0"
}
},
"wdio-devtools-service": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/wdio-devtools-service/-/wdio-devtools-service-0.1.6.tgz",
"integrity": "sha512-6SpiFf7QcBmUINV63ezgahpohH00NG6MpEm5OkWQrtAmqUOkFxQvpAk2pGk/4JdXXoj5s/AeSF6v5ILa8IxLTA==",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"chrome-remote-interface": "^0.25.3",
"node-netstat": "^1.4.2"
}
},
"wdio-dot-reporter": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/wdio-dot-reporter/-/wdio-dot-reporter-0.0.10.tgz",
"integrity": "sha512-A0TCk2JdZEn3M1DSG9YYbNRcGdx/YRw19lTiRpgwzH4qqWkO/oRDZRmi3Snn4L2j54KKTfPalBhlOtc8fojVgg==",
"dev": true
},
"wdio-jasmine-framework": {
"version": "0.3.8",
"resolved": "https://registry.npmjs.org/wdio-jasmine-framework/-/wdio-jasmine-framework-0.3.8.tgz",
"integrity": "sha512-oOM/h8HcXdmbFEZcm2Cm3rKxaz9o0KDk7pMwJ3Coqk29qDUwaUChZHrF3L1ls1mTxL28o5q8ad+Fbm6d4Kzdvg==",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"jasmine": "^3.3.0",
"wdio-sync": "0.7.3"
}
},
"wdio-junit-reporter": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/wdio-junit-reporter/-/wdio-junit-reporter-0.4.4.tgz",
@ -6970,6 +7053,17 @@
"humanize-duration": "~3.15.0"
}
},
"wdio-sync": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/wdio-sync/-/wdio-sync-0.7.3.tgz",
"integrity": "sha512-ukASSHOQmOxaz5HTILR0jykqlHBtAPsBpMtwhpiG0aW9uc7SO7PF+E5LhVvTG4ypAh+UGmY3rTjohOsqDr39jw==",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"fibers": "^3.0.0",
"object.assign": "^4.0.3"
}
},
"wdio-visual-regression-service": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/wdio-visual-regression-service/-/wdio-visual-regression-service-0.9.0.tgz",
@ -6987,9 +7081,9 @@
}
},
"webdriver-manager": {
"version": "12.1.1",
"resolved": "https://registry.npmjs.org/webdriver-manager/-/webdriver-manager-12.1.1.tgz",
"integrity": "sha512-L9TEQmZs6JbMMRQI1w60mfps265/NCr0toYJl7p/R2OAk6oXAfwI6jqYP7EWae+d7Ad2S2Aj4+rzxoSjqk3ZuA==",
"version": "12.1.4",
"resolved": "https://registry.npmjs.org/webdriver-manager/-/webdriver-manager-12.1.4.tgz",
"integrity": "sha512-aNUzdimlHSl3EotUTdE2QwP9sBUjZgWPCy8C+m1wMmF9jBDKuO/24nnpr2O25Db8dYtsjvj9drPTpSIGqRrNnQ==",
"dev": true,
"requires": {
"adm-zip": "^0.4.9",
@ -7271,6 +7365,17 @@
"mkdirp": "^0.5.1"
}
},
"ws": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz",
"integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==",
"dev": true,
"requires": {
"async-limiter": "~1.0.0",
"safe-buffer": "~5.1.0",
"ultron": "~1.1.0"
}
},
"xhr": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz",

View File

@ -9,7 +9,7 @@
"generate-refs-visual-regression-desktop": "rm -rf tests/webdriverio/screenshots; npm run test-visual-regression-desktop",
"start:prod": "meteor reset && ROOT_URL=http://127.0.0.1/html5client NODE_ENV=production meteor --production",
"start:dev": "ROOT_URL=http://127.0.0.1/html5client NODE_ENV=development meteor",
"test": "jest",
"test": "wdio ./tests/webdriverio/wdio.conf.js",
"lint": "eslint . --ext .jsx,.js"
},
"meteor": {
@ -90,10 +90,12 @@
"postcss-modules-local-by-default": "1.2.0",
"postcss-modules-scope": "1.1.0",
"postcss-modules-values": "1.3.0",
"wdio-devtools-service": "^0.1.6",
"wdio-jasmine-framework": "^0.3.8",
"wdio-junit-reporter": "~0.4.4",
"wdio-spec-reporter": "^0.1.5",
"wdio-visual-regression-service": "~0.9.0",
"webdriver-manager": "^12.1.1",
"webdriver-manager": "^12.1.4",
"webdriverio": "^4.14.2"
},
"cssModules": {

View File

@ -0,0 +1,79 @@
const Page = require('./page');
const pageObject = new Page();
const chai = require('chai');
class ChatPage extends Page {
get publicChatSelector() {
return '#message-input';
}
get publicChatElement() {
return $(this.publicChatSelector);
}
sendPublicChatMessage(message) {
this.publicChatElement.setValue(message);
pageObject.pressEnter();
}
// ////////
get chatDropdownTriggerSelector() {
return '[data-test=chatDropdownTrigger]';
}
get chatDropdownTriggerElement() {
return $(this.chatDropdownTriggerSelector);
}
triggerChatDropdown() {
this.chatDropdownTriggerElement.click();
}
// ////////
get clearChatButtonSelector() {
return '[data-test=chatClear]';
}
get clearChatButtonElement() {
return $(this.clearChatButtonSelector);
}
clearChat() {
this.clearChatButtonElement.click();
}
// ////////
get saveChatButtonSelector() {
return '[data-test=chatSave]';
}
get saveChatButtonElement() {
return $(this.saveChatButtonSelector);
}
saveChat() {
this.saveChatButtonElement.click();
}
// ////////
get copyChatButtonSelector() {
return '[data-test=chatCopy]';
}
get copyChatButtonElement() {
return $(this.copyChatButtonSelector);
}
copyChat() {
this.copyChatButtonElement.click();
}
}
module.exports = new ChatPage();

View File

@ -0,0 +1,54 @@
const Page = require('./page');
const pageObject = new Page();
const chai = require('chai');
class LandingPage extends Page {
get meetingNameInputSelector() {
return 'input[name=meetingname]';
}
get meetingNameInputElement() {
return $(this.meetingNameInputSelector);
}
// ////////
get usernameInputSelector() {
return 'input[name=username]';
}
get usernameInputElement() {
return $(this.usernameInputSelector);
}
// ////////
joinWithButtonClick() {
this.joinButtonElement.click();
}
joinWithEnterKey() {
pageObject.pressEnter();
}
// ////////
get joinButtonSelector() {
return 'input[type=submit]';
}
get joinButtonElement() {
return $(this.joinButtonSelector);
}
// ////////
open() {
super.open('demo/demoHTML5.jsp');
}
}
module.exports = new LandingPage();

View File

@ -0,0 +1,38 @@
const Page = require('./page');
const pageObject = new Page();
const chai = require('chai');
class ModalPage extends Page {
get modalCloseSelector() {
return 'i.icon-bbb-close';
}
get modalCloseElement() {
return $(this.modalCloseSelector);
}
closeAudioModal() {
this.modalCloseElement.click();
}
get meetingEndedModalTitleSelector() {
return '[data-test=meetingEndedModalTitle]';
}
get aboutModalSelector() {
return '[aria-label=About]';
}
get modalConfirmButtonSelector() {
return '[data-test=modalConfirmButton]';
}
get modalConfirmButtonElement() {
return browser.element(this.modalConfirmButtonSelector);
}
}
module.exports = new ModalPage();

View File

@ -0,0 +1,13 @@
class Page {
open(path) {
browser.url(path);
}
pressEnter() {
browser.keys('Enter');
}
}
module.exports = Page;

View File

@ -0,0 +1,93 @@
const Page = require('./page');
const pageObject = new Page();
const chai = require('chai');
class SettingsPage extends Page {
// open the settings dropdown
get openSettingsDropdownSelector() {
return 'i.icon-bbb-more';
}
get openSettingsDropdownElement() {
return $(this.openSettingsDropdownSelector);
}
openSettingsDropdown() {
this.openSettingsDropdownElement.click();
}
// ////////
get endMeetingButtonSelector() {
return 'i.icon-bbb-application';
}
get endMeetingButtonElement() {
return $(this.endMeetingButtonSelector);
}
clickEndMeetingButton() {
this.endMeetingButtonElement.click();
}
// ////////
get confirmEndMeetingSelector() {
return '[data-test=confirmEndMeeting]';
}
get confirmEndMeetingElement() {
return $(this.confirmEndMeetingSelector);
}
confirmEndMeeting() {
this.confirmEndMeetingElement.click();
}
// ////////
get logoutButtonSelector() {
return 'i.icon-bbb-logout';
}
get logoutButtonElement() {
return $(this.logoutButtonSelector);
}
clickLogoutButton() {
this.logoutButtonElement.click();
}
// ////////
get settingsButtonSelector() {
return 'i.icon-bbb-settings';
}
get settingsButtonElement() {
return $(this.settingsButtonSelector);
}
clickSettingsButton() {
this.settingsButtonElement.click();
}
// ////////
get languageSelectSelector() {
return '#langSelector';
}
get languageSelectElement() {
return $(this.languageSelectSelector);
}
clickLanguageSelect() {
this.languageSelectElement.click();
}
}
module.exports = new SettingsPage();

View File

@ -0,0 +1,76 @@
const LandingPage = require('../pageobjects/landing.page');
const ModalPage = require('../pageobjects/modal.page');
const ChatPage = require('../pageobjects/chat.page');
const Utils = require('../utils');
const WAIT_TIME = 10000;
const loginWithoutAudio = function () {
// login
LandingPage.open();
browser.setValue(LandingPage.usernameInputSelector, 'user');
LandingPage.joinWithEnterKey();
// close audio modal
browser.waitForExist(ModalPage.modalCloseSelector, WAIT_TIME);
ModalPage.closeAudioModal();
};
describe('Chat', () => {
beforeEach(() => {
Utils.configureViewport();
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
});
it('should be able to send a message',
() => {
loginWithoutAudio();
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
});
it('should be able to save chat',
() => {
loginWithoutAudio();
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
browser.waitForExist(ChatPage.chatDropdownTriggerSelector, WAIT_TIME);
ChatPage.triggerChatDropdown();
browser.waitForExist(ChatPage.saveChatButtonSelector, WAIT_TIME);
ChatPage.saveChat();
});
it('should be able to copy chat',
() => {
loginWithoutAudio();
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
browser.waitForExist(ChatPage.chatDropdownTriggerSelector, WAIT_TIME);
ChatPage.triggerChatDropdown();
browser.waitForExist(ChatPage.copyChatButtonSelector, WAIT_TIME);
ChatPage.copyChat();
});
it('should be able to clear chat',
() => {
loginWithoutAudio();
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
browser.waitForExist(ChatPage.chatDropdownTriggerSelector, WAIT_TIME);
ChatPage.triggerChatDropdown();
browser.waitForExist(ChatPage.clearChatButtonSelector, WAIT_TIME);
ChatPage.clearChat();
});
});

View File

@ -0,0 +1,109 @@
const chai = require('chai');
const LandingPage = require('../pageobjects/landing.page');
const ModalPage = require('../pageobjects/modal.page');
const SettingsPage = require('../pageobjects/settings.page');
const Utils = require('../utils');
const openSettingsDropdown = function () {
browser.waitForExist(SettingsPage.openSettingsDropdownSelector, WAIT_TIME);
SettingsPage.openSettingsDropdown();
};
const closeAudioModal = function () {
browser.waitForExist(ModalPage.modalCloseSelector, WAIT_TIME);
ModalPage.closeAudioModal();
};
const openSettingsModal = function () {
browser.waitForExist(SettingsPage.settingsButtonSelector, WAIT_TIME);
SettingsPage.clickSettingsButton();
};
const WAIT_TIME = 10000;
let errorsCounter = 0;
describe('Settings', () => {
beforeAll(() => {
Utils.configureViewport();
jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;
});
beforeEach(() => {
LandingPage.open();
browser.setValue(LandingPage.usernameInputSelector, 'user');
browser.setValue(LandingPage.meetingNameInputSelector, 'Demo Meeting Tests');
LandingPage.joinWithEnterKey();
closeAudioModal();
});
it('should be able to use all locales',
() => {
openSettingsDropdown();
openSettingsModal();
browser.waitForExist(`${SettingsPage.languageSelectSelector} option:not([disabled]`, WAIT_TIME);
const locales = browser.elements('#langSelector option:not([disabled]').value.map(e => e.getValue());
browser.refresh();
browser.cdp('Console', 'enable');
browser.on('Console.messageAdded', (log) => {
if (log.message.level === 'error') {
console.log(log.message.text);
errorsCounter += 1;
}
});
locales.forEach((locale) => {
errorsCounter = 0;
closeAudioModal();
openSettingsDropdown();
openSettingsModal();
browser.waitForExist(SettingsPage.languageSelectSelector, WAIT_TIME);
SettingsPage.clickLanguageSelect();
browser.waitForExist(`option[value=${locale}]`, WAIT_TIME);
$(`option[value=${locale}]`).click();
browser.waitForExist(ModalPage.modalConfirmButtonSelector, WAIT_TIME);
ModalPage.modalConfirmButtonElement.click();
browser.pause(500);
browser.refresh();
browser.pause(500);
console.log(`[switching to ${locale}] number of errors: ${errorsCounter}`);
chai.expect(errorsCounter < 5).to.be.true;
});
});
it('should be able to end meeting and get confirmation',
() => {
openSettingsDropdown();
// click End Meeting
browser.waitForExist(SettingsPage.endMeetingButtonSelector, WAIT_TIME);
SettingsPage.clickEndMeetingButton();
// confirm
browser.waitForExist(SettingsPage.confirmEndMeetingSelector, WAIT_TIME);
SettingsPage.confirmEndMeeting();
// check the confirmation page
browser.waitForExist(ModalPage.meetingEndedModalTitleSelector, WAIT_TIME);
});
it('should be able to logout and get confirmation',
() => {
openSettingsDropdown();
// click Logout
browser.waitForExist(SettingsPage.logoutButtonSelector, WAIT_TIME);
SettingsPage.clickLogoutButton();
// check the confirmation page
browser.waitForExist(ModalPage.meetingEndedModalTitleSelector, WAIT_TIME);
});
});

View File

@ -0,0 +1,12 @@
class Utils {
configureViewport() {
browser.setViewportSize({
width: 1366,
height: 768,
});
}
}
module.exports = new Utils();

View File

@ -0,0 +1,10 @@
exports.config = {
specs: ['tests/webdriverio/specs/**/*.spec.js'],
capabilities: [{
browserName: 'chrome',
}],
services: ['devtools'],
framework: 'jasmine',
reporters: ['spec'],
baseUrl: '',
};