Merge pull request #7665 from MaximKhlobystov/webdriverio-tests-update

WebdriverIO tests improvements
This commit is contained in:
Anton Georgiev 2019-06-24 09:13:07 -04:00 committed by GitHub
commit d5a6b9b4e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 24 deletions

View File

@ -10,6 +10,7 @@ module.exports = {
"node": true,
"browser": true,
"meteor": true,
"jasmine": true,
},
"rules": {
"no-underscore-dangle": 0,
@ -19,4 +20,7 @@ module.exports = {
"import/no-extraneous-dependencies": 1,
"react/prop-types": 1,
},
"globals": {
"browser": "writable",
},
};

View File

@ -62,6 +62,7 @@ const FullscreenButtonComponent = ({
hideLabel
className={cx(styles.button, styles.fullScreenButton, className)}
tooltipDistance={tooltipDistance}
data-test="presentationFullscreenButton"
/>
</div>
);

View File

@ -139,7 +139,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@ -286,6 +286,12 @@
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
},
"arch": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/arch/-/arch-2.1.1.tgz",
"integrity": "sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg==",
"dev": true
},
"archiver": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/archiver/-/archiver-2.1.1.tgz",
@ -652,7 +658,7 @@
},
"bl": {
"version": "1.2.2",
"resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
"integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==",
"dev": true,
"requires": {
@ -830,7 +836,7 @@
"dependencies": {
"callsites": {
"version": "2.0.0",
"resolved": "http://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz",
"integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=",
"dev": true
}
@ -1012,6 +1018,16 @@
"tiny-emitter": "^2.0.0"
}
},
"clipboardy": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-2.1.0.tgz",
"integrity": "sha512-2pzOUxWcLlXWtn+Jd6js3o12TysNOOVes/aQfg+MT/35vrxWzedHlLwyoJpXjsFKWm95BTNEcMGD9+a7mKzZkQ==",
"dev": true,
"requires": {
"arch": "^2.1.1",
"execa": "^1.0.0"
}
},
"cliui": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
@ -1508,7 +1524,7 @@
},
"enabled": {
"version": "1.0.2",
"resolved": "http://registry.npmjs.org/enabled/-/enabled-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/enabled/-/enabled-1.0.2.tgz",
"integrity": "sha1-ll9lE9LC0cX0ZStkouM5ZGf8L5M=",
"requires": {
"env-variable": "0.0.x"
@ -2112,7 +2128,7 @@
},
"fecha": {
"version": "2.3.3",
"resolved": "http://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz",
"integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg=="
},
"fibers": {
@ -2424,7 +2440,7 @@
},
"globby": {
"version": "6.1.0",
"resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
"dev": true,
"requires": {
@ -3602,7 +3618,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@ -4732,7 +4748,7 @@
},
"npm-install-package": {
"version": "2.1.0",
"resolved": "http://registry.npmjs.org/npm-install-package/-/npm-install-package-2.1.0.tgz",
"resolved": "https://registry.npmjs.org/npm-install-package/-/npm-install-package-2.1.0.tgz",
"integrity": "sha1-1+/jz816sAYUuJbqUxGdyaslkSU=",
"dev": true
},
@ -4915,7 +4931,7 @@
"dependencies": {
"minimist": {
"version": "0.0.10",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
"dev": true
},
@ -5965,7 +5981,7 @@
},
"safe-regex": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true,
"requires": {
@ -7107,7 +7123,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@ -7135,7 +7151,7 @@
},
"globby": {
"version": "5.0.0",
"resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
"resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
"integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
"dev": true,
"requires": {
@ -7205,7 +7221,7 @@
},
"external-editor": {
"version": "2.2.0",
"resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
"integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
"dev": true,
"requires": {

View File

@ -78,6 +78,7 @@
},
"devDependencies": {
"chai": "~4.2.0",
"clipboardy": "^2.1.0",
"eslint": "~5.8.0",
"eslint-config-airbnb": "~17.1.0",
"eslint-config-airbnb-base": "~13.1.0",

View File

@ -1,16 +1,18 @@
const chai = require('chai');
const clipboardy = require('clipboardy');
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 message = 'Hello';
const loginWithoutAudio = function () {
const loginWithoutAudio = function (username) {
// login
LandingPage.open();
browser.setValue(LandingPage.usernameInputSelector, 'user');
browser.setValue(LandingPage.usernameInputSelector, username);
LandingPage.joinWithEnterKey();
// close audio modal
@ -26,18 +28,20 @@ describe('Chat', () => {
it('should be able to send a message',
() => {
loginWithoutAudio();
const username = 'chatUser1';
loginWithoutAudio(username);
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
ChatPage.sendPublicChatMessage(message);
});
it('should be able to save chat',
() => {
loginWithoutAudio();
const username = 'chatUser2';
loginWithoutAudio(username);
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
ChatPage.sendPublicChatMessage(message);
browser.waitForExist(ChatPage.chatDropdownTriggerSelector, WAIT_TIME);
ChatPage.triggerChatDropdown();
@ -48,24 +52,28 @@ describe('Chat', () => {
it('should be able to copy chat',
() => {
loginWithoutAudio();
const username = 'chatUser3';
loginWithoutAudio(username);
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
ChatPage.sendPublicChatMessage(message);
browser.waitForExist(ChatPage.chatDropdownTriggerSelector, WAIT_TIME);
ChatPage.triggerChatDropdown();
browser.waitForExist(ChatPage.copyChatButtonSelector, WAIT_TIME);
ChatPage.copyChat();
const copiedChat = clipboardy.readSync();
chai.expect(copiedChat).to.include(`${username} : ${message}`);
});
it('should be able to clear chat',
() => {
loginWithoutAudio();
const username = 'chatUser4';
loginWithoutAudio(username);
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
ChatPage.sendPublicChatMessage('Hello');
ChatPage.sendPublicChatMessage(message);
browser.waitForExist(ChatPage.chatDropdownTriggerSelector, WAIT_TIME);
ChatPage.triggerChatDropdown();

View File

@ -0,0 +1,38 @@
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 checkFullscreen = () => document.fullscreen;
const loginWithoutAudio = function (username) {
// login
LandingPage.open();
browser.setValue(LandingPage.usernameInputSelector, username);
LandingPage.joinWithEnterKey();
// close audio modal
browser.waitForExist(ModalPage.modalCloseSelector, WAIT_TIME);
ModalPage.closeAudioModal();
};
describe('Presentation', () => {
beforeEach(() => {
Utils.configureViewport();
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
});
it('should be able to enter fullscreen',
() => {
const username = 'presentationUser1';
loginWithoutAudio(username);
browser.waitForExist(ChatPage.publicChatSelector, WAIT_TIME);
browser.waitForExist('[data-test="presentationFullscreenButton"]', WAIT_TIME);
$('[data-test="presentationFullscreenButton"]').click();
browser.pause(2000);
console.log(browser.execute(checkFullscreen));
});
});