summaryrefslogtreecommitdiff
path: root/src/attendConference.js
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-11-11 00:47:40 +0300
committereug-vs <eug-vs@keemail.me>2020-11-11 00:47:40 +0300
commita52bf99bbf2d394685f92aa13b5bff438ff8ef0a (patch)
tree929c5c4117527fe007421d308cab5d1c3047b34a /src/attendConference.js
parent937dff7628820b54e7963f283618e639340e67ee (diff)
downloadbsu-fantom-a52bf99bbf2d394685f92aa13b5bff438ff8ef0a.tar.gz
refactor: move attendConference() to separate file
Diffstat (limited to 'src/attendConference.js')
-rw-r--r--src/attendConference.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/attendConference.js b/src/attendConference.js
new file mode 100644
index 0000000..b7f744f
--- /dev/null
+++ b/src/attendConference.js
@@ -0,0 +1,21 @@
+const clickElementByXPath = (page, xPath) => page
+ .waitForXPath(xPath)
+ .then(item => item.click());
+
+const attendConference = async page => {
+ // Join as "Listen only"
+ await clickElementByXPath(page, '//span[contains(text(),"Listen only")]');
+ console.log('Joined the conference');
+
+ // Wait 5 seconds
+ await page.waitForTimeout(5000);
+ console.log('Time to leave!')
+
+ // Leave audio and close the tab
+ await clickElementByXPath(page, '//button[contains(@aria-label,"Leave audio")]');
+ await page.waitForTimeout(1500);
+ await page.close();
+ console.log('Left the conference');
+};
+
+module.exports = attendConference;