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

feat(webdriverio): Add webdriverio end to end test framework. #11016

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9857ad9
feat(webdriverio-tests): Create setup for webdriverio.
Jan 28, 2022
4fa46c8
feat(webdriverio-tests): Create setup for webdriverio.
Jan 31, 2022
c45b50d
webdriverio wip
Feb 16, 2022
537df4f
feat(webdriverio): Add webdriverio end to end test framework.
Feb 24, 2022
7183f9a
feat(webdriverio): Add webdriverio end to end test framework.
Feb 24, 2022
aee5bea
feat(webdriverio): Add webdriverio end to end test framework.
Feb 24, 2022
07a3413
feat(webdriverio): Add webdriverio end to end test framework.
Feb 24, 2022
2c8067d
feat(webdriverio): Add webdriverio end to end test framework.
Feb 24, 2022
2bac41e
feat(webdriverio): Add webdriverio end to end test framework.
Feb 25, 2022
654431d
feat(webdriverio): Add webdriverio end to end test framework.
Mar 1, 2022
47d2494
feat(webdriverio): Add webdriverio end to end test framework.
Mar 3, 2022
56ba3a4
feat(webdriverio): Add webdriverio end to end test framework.
Mar 3, 2022
6bd9bab
feat(webdriverio): Add webdriverio end to end test framework.
Mar 7, 2022
5c15a4f
feat(webdriverio): Add webdriverio end to end test framework.
Mar 8, 2022
0398937
feat(webdriverio): Add webdriverio end to end test framework.
Mar 10, 2022
18baa8e
feat(webdriverio): Add webdriverio end to end test framework.
Mar 10, 2022
d9fb63c
feat(webdriverio): Add webdriverio end to end test framework.
Mar 10, 2022
c9ece1e
feat(webdriverio): Add webdriverio end to end test framework.
Mar 15, 2022
5888e73
feat(webdriverio): Add webdriverio end to end test framework.
Mar 15, 2022
05a17c4
feat(webdriverio): Add webdriverio end to end test framework.
Mar 15, 2022
a3171c5
feat(webdriverio): Add webdriverio end to end test framework.
Mar 15, 2022
f4e7790
feat(webdriverio): Add webdriverio end to end test framework.
Mar 15, 2022
676e94b
feat(webdriverio): Add webdriverio end to end test framework.
Mar 16, 2022
72eba04
feat(webdriverio): Add webdriverio end to end test framework.
Mar 16, 2022
28842ee
feat(webdriverio): Add webdriverio end to end test framework.
Mar 16, 2022
888e8a4
feat(webdriverio): Add webdriverio end to end test framework.
Mar 17, 2022
2e455cf
feat(webdriverio): Add webdriverio end to end test framework.
Mar 17, 2022
58dc9ea
feat(webdriverio): Add webdriverio end to end test framework.
Mar 17, 2022
dd14979
feat(webdriverio): Add ability to specify a browser for each particip…
Mar 17, 2022
8a40d06
feat(webdriverio): Add ability to specify a browser for each particip…
Mar 18, 2022
0f85eb5
feat(webdriverio): Remove the concept of moderator browser.
Mar 18, 2022
206c8d1
feat(webdriverio): Add grid configuration.
Mar 18, 2022
62b8692
feat(webdriverio): Change max instances value to 16.
Mar 18, 2022
c4d4843
feat(webdriverio): Add conditional services based on grid availability.
Mar 18, 2022
1ac319d
feat(webdriverio): Add some comments on defined constants.
Mar 18, 2022
f9b4066
feat(webdriverio): Remove .env file.
Mar 18, 2022
a747ac0
feat(webdriverio): Simplify grid url env variable and add env variabl…
Mar 18, 2022
34cff7e
feat(webdriverio): Add console logs as attachment to tests reports.
Mar 18, 2022
e14bb1b
feat(webdriverio): Make sure that grid port parameter is always a num…
Mar 21, 2022
e70f29d
feat(webdriverio): Fix typo on grid url.
Mar 22, 2022
e1e2776
feat(webdriverio): Fix typo on hostname parameter.
Mar 23, 2022
f10151e
feat(webdriverio): Get page objects for each specific browser.
Mar 29, 2022
41bacde
feat(webdriverio): Comment the beforeHook code block.
Mar 29, 2022
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
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ react/features/stream-effects/virtual-background/vendor/*
load-test/*
react/features/facial-recognition/resources/*

# Test results and reports
allure-report/*
allure-results/*

# ESLint will by default ignore its own configuration file. However, there does
# not seem to be a reason why we will want to risk being inconsistent with our
# remaining JavaScript source code.
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.*.tmp
deploy-local.sh
libs/
allure-report/
allure-results/
all.css
*css.map
.remote-sync.json
Expand Down
13,048 changes: 8,734 additions & 4,314 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@tensorflow/tfjs-core": "3.13.0",
"@vladmandic/face-api": "1.6.4",
"@xmldom/xmldom": "0.7.5",
"allure-commandline": "2.17.2",
"amplitude-js": "8.2.1",
"base64-js": "1.3.1",
"bc-css-flags": "3.0.0",
Expand Down Expand Up @@ -134,7 +135,7 @@
"util": "0.12.1",
"uuid": "8.3.2",
"wasm-check": "2.0.1",
"windows-iana": "^3.1.0",
"windows-iana": "3.1.0",
"zxcvbn": "4.4.2"
},
"devDependencies": {
Expand All @@ -146,8 +147,16 @@
"@babel/preset-react": "7.16.0",
"@babel/runtime": "7.16.0",
"@jitsi/eslint-config": "4.0.0",
"@wdio/allure-reporter": "7.16.14",
"@wdio/cli": "7.16.15",
"@wdio/junit-reporter": "7.16.15",
"@wdio/local-runner": "7.16.13",
"@wdio/mocha-framework": "7.16.13",
"@wdio/selenium-standalone-service": "7.16.14",
"@wdio/spec-reporter": "7.16.13",
"babel-loader": "8.2.3",
"babel-plugin-optional-require": "0.3.1",
"chromedriver": "97.0.2",
"circular-dependency-plugin": "5.2.0",
"clean-css-cli": "4.3.0",
"css-loader": "3.6.0",
Expand Down Expand Up @@ -185,6 +194,8 @@
"lint-fix": "eslint --max-warnings 0 --fix .",
"postinstall": "patch-package && jetify",
"validate": "npm ls",
"start": "make dev"
"start": "make dev",
"e2e-tests": "wdio run wdio.conf.js",
"e2e-test-reports": "npx wdio run ./wdio.conf.js && allure generate allure-results/ --clean"
}
}
13 changes: 13 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# WebdriverIO Test Automation Framework

## Steps to run tests locally:
* Run <strong>npm install</strong> command
* Start de app locally with <i>make dev</i> command
* Running all tests: <strong>npx wdio run ./wdio.conf.js</strong>
* Running specific test: <strong>npx wdio run ./wdio.conf.js --spec testName.js</strong>
* Running tests will generate the <i>allure-results</i> folder

## Steps to generate allure reports:
* Check if the <i>allure-results</i> was generated
* In order to generate the <i>allure-reports</i>, run the following command: allure generate allure-results/ && allure open
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a script in package.json to do this please. Maybe some e2ee-test-reports

* If the allure-report has already been generated, there will be a conflict; in order to avoid this, the <strong>--clean</strong> flag needs to be used and the following command would be required: allure generate allure-results/ --clean && allure open
20 changes: 20 additions & 0 deletions test/helpers/browserCapabilities.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {
CHROME_BROWSER,
CHROME_PROPERTIES,
FIREFOX_PROPERTIES,
PARTICIPANT1_BROWSER
} from './constants';

/**
* Function that creates browser capabilities.
*
* @returns {Object}
*/
export default function createBrowserCapabilities() {

if (PARTICIPANT1_BROWSER === CHROME_BROWSER) {
return CHROME_PROPERTIES;
}

return FIREFOX_PROPERTIES;
}
84 changes: 84 additions & 0 deletions test/helpers/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* eslint-disable no-undef */

// Define base url.
export const BASE_URL = process.env.BASE_URL || 'https://alpha.jitsi.net';

// Define available browsers.
export const FIREFOX_BROWSER = 'firefox';
export const CHROME_BROWSER = 'chrome';

// Define browser for each participant.
export const PARTICIPANT1_BROWSER = process.env.PARTICIPANT1_BROWSER || CHROME_BROWSER;
export const PARTICIPANT2_BROWSER = process.env.PARTICIPANT2_BROWSER || CHROME_BROWSER;
export const PARTICIPANT3_BROWSER = process.env.PARTICIPANT3_BROWSER || CHROME_BROWSER;

// Define default config.
export const DEFAULT_CONFIG
= 'config.requireDisplayName=false'
+ '&config.debug=true'
+ '&config.testing.testMode=true'
+ '&config.disableAEC=true'
+ '&config.disableNS=true'
+ '&config.enableTalkWhileMuted=false'
+ '&config.callStatsID=false'
+ '&config.alwaysVisibleToolbar=true'
+ '&config.p2p.enabled=false'
+ '&config.p2p.useStunTurn=false'
+ '&config.pcStatsInterval=1500'
+ '&config.prejoinConfig.enabled=false'
+ '&config.gatherStats=true'
+ '&config.disable1On1Mode=true'
+ '&config.analytics.disabled=true'
+ '&interfaceConfig.SHOW_CHROME_EXTENSION_BANNER=false'
+ '&interfaceConfig.DISABLE_FOCUS_INDICATOR=true';

// Define participants names.
export const FIRST_PARTICIPANT = 'First participant';
export const SECOND_PARTICIPANT = 'Second participant';
export const THIRD_PARTICIPANT = 'Third participant';

export const ENTER_KEY = '\uE007';

// Define chrome properties.
export const CHROME_PROPERTIES = {
maxInstances: 4,
browserName: CHROME_BROWSER,
acceptInsecureCerts: true,
'goog:chromeOptions': {
args: [
'use-fake-device-for-media-stream',
'use-fake-ui-for-media-stream',
'disable-plugins',
'mute-audio',
'disable-infobars',
'autoplay-policy=no-user-gesture-required',
'auto-select-desktop-capture-source=Your Entire screen'
]
}
};

// Define firefox properties.
export const FIREFOX_PROPERTIES = {
maxInstances: 4,
browserName: FIREFOX_BROWSER,
acceptInsecureCerts: true,
'moz:firefoxOptions': {
'prefs': {
'media.navigator.streams.fake': true,
'media.navigator.permission.disabled': true,
'media.peerconnection.ice.tcp': true,
'intl.accept_languages': 'en',
'media.autoplay.default': 0
}
}
};

// Define remote selenium grid url.
export const GRID_URL = process.env.GRID_URL ? new URL(process.env.GRID_URL) : null;

// Define services properties based on grid availability.
export const SERVICES = GRID_URL ? [] : [ 'selenium-standalone' ];

// Define max instances.

export const MAX_INSANCES = process.env.MAX_INSANCES || 1;
27 changes: 27 additions & 0 deletions test/helpers/createBrowserSession.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {
PARTICIPANT1_BROWSER,
PARTICIPANT2_BROWSER,
PARTICIPANT3_BROWSER,
FIRST_PARTICIPANT,
SECOND_PARTICIPANT,
THIRD_PARTICIPANT
} from './constants';
import createSession from './createSession';

/**
* Function that creates a browser session.
*
* @returns {void}
*/
export default function createBrowserSession(participant) {
switch (participant) {
case FIRST_PARTICIPANT:
return createSession(PARTICIPANT1_BROWSER);
case SECOND_PARTICIPANT:
return createSession(PARTICIPANT2_BROWSER);
case THIRD_PARTICIPANT:
return createSession(PARTICIPANT3_BROWSER);
default:
return;
}
}
10 changes: 10 additions & 0 deletions test/helpers/createMeetingRoom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable no-undef */

/**
* Create meeting room function.
*
* @returns {void}
*/
export default function createMeetingRoom(meetingUrl) {
browser.url(meetingUrl);
}
13 changes: 13 additions & 0 deletions test/helpers/createMeetingUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { v4 as uuidv4 } from 'uuid';

import { BASE_URL, DEFAULT_CONFIG } from './constants';

/**
* Function that creates a meeting url.
*
* @returns {void}
*/
export default function createMeetingUrl() {
// eslint-disable-next-line prefer-template
return `${BASE_URL}/${'WdioMeeting-' + uuidv4()}?${DEFAULT_CONFIG}`;
}
55 changes: 55 additions & 0 deletions test/helpers/createSession.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { remote } from 'webdriverio';

import {
CHROME_BROWSER,
FIREFOX_BROWSER
} from './constants';

/**
* Function that creates a session.
*
* @returns {void}
*/
export default function createSession(participantBrowser) {

switch (participantBrowser) {
case CHROME_BROWSER:
return remote({
path: '/wd/hub',
capabilities: {
browserName: CHROME_BROWSER,
acceptInsecureCerts: true,
'goog:chromeOptions': {
args: [
'use-fake-device-for-media-stream',
'use-fake-ui-for-media-stream',
'disable-plugins',
'mute-audio',
'disable-infobars',
'autoplay-policy=no-user-gesture-required',
'auto-select-desktop-capture-source=Your Entire screen'
]
}
}
});
case FIREFOX_BROWSER:
return remote({
path: '/wd/hub',
capabilities: {
browserName: FIREFOX_BROWSER,
acceptInsecureCerts: true,
'moz:firefoxOptions': {
'prefs': {
'media.navigator.streams.fake': true,
'media.navigator.permission.disabled': true,
'media.peerconnection.ice.tcp': true,
'intl.accept_languages': 'en',
'media.autoplay.default': 0
}
}
}
});
default:
return;
}
}
14 changes: 14 additions & 0 deletions test/helpers/isParticipantModerator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-disable no-undef */

/**
* Function that checks if the participant is moderator.
*
* @returns {void}
*/
export default async function isParticipantModerator() {
// eslint-disable-next-line arrow-body-style
await browser.execute(() => {
return window.APP.store.getState()['features/base/participants'].local.role
=== 'moderator';
});
}
23 changes: 23 additions & 0 deletions test/helpers/openParticipantsPane.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const ParticipantsPane = require('../page-objects/ParticipantsPane');
const Toolbox = require('../page-objects/Toolbox');

/**
* Open participants pane function.
*
* @returns {void}
*/
export default async function openParticipantsPane(userBrowser) {
const getToolbox = await new Toolbox(userBrowser);
const getToolboxView = await getToolbox.ToolboxView;

await expect(getToolboxView).toBeDisplayed();
const participantsButton = await getToolbox.ParticipantsPaneButton;

await expect(participantsButton).toBeDisplayed();
await participantsButton.click();

const participantsPanePageObject = await new ParticipantsPane(userBrowser);
const participantsPane = await participantsPanePageObject.ParticipantsPaneView;

await expect(participantsPane).toBeDisplayed();
}
27 changes: 27 additions & 0 deletions test/page-objects/ParticipantsPane.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-disable no-undef */

/**
* Define participants pane elements.
*/
class ParticipantsPane {

/**
* Initializes a new user browser instance.
*
* @param {Object} userBrowser - The read-only properties with which the new
* instance is to be initialized.
*/
constructor(userBrowser) {
this.userBrowser = userBrowser;
}

/**
* Participants pane element.
*
* @returns {HTMLElement}
*/
get ParticipantsPaneView() {
return this.userBrowser.$('.participants_pane');
}
}
module.exports = ParticipantsPane;
Loading