How to use driver.takeScreenshot method in Appium

Best JavaScript code snippet using appium

edge.test.js

Source:edge.test.js Github

copy

Full Screen

...45 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));46 await driver.wait(webdriver.until.elementIsEnabled(playBtn));47 assert.equal(await playBtn.getText(), 'play');48 setTimeout(async () => {49 const ssBuffer = await driver.takeScreenshot();50 await utils.utils.saveScreenshot(`${output}/${testFileName}-001`, ssBuffer)51 done();52 }, timeout);53 });54 it(`[${testFileName}-002] Plays decoded and filtered audio using default filter from firebase`, async () => {55 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));56 await driver.wait(webdriver.until.elementIsEnabled(playBtn)).click();57 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));58 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));59 const ssBuffer = await driver.takeScreenshot();60 await utils.saveScreenshot(`${output}/${testFileName}-002-001`, ssBuffer);61 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));62 const ssBuffer2 = await driver.takeScreenshot();63 await utils.saveScreenshot(`${output}/${testFileName}-002-002`, ssBuffer2);64 assert.equal(await playBtn.getText(), 'pause');65 });66 it(`[${testFileName}-003] changes filter from Extended -> Diaphragm -> Midrange -> Bell -> Heart filters `, async (done) => {67 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));68 const ready = await driver.wait(webdriver.until.elementIsEnabled(playBtn));69 //fucking kill me with this settimeout hell70 setTimeout(async () => {71 if (ready) {72 const ssBuffer = await driver.takeScreenshot();73 await utils.saveScreenshot(`${output}/${testFileName}-003-001`, ssBuffer);74 const select = await driver.findElement(webdriver.By.id('filter-select'))75 await select.click();76 //before77 assert.equal(await select.getAttribute('value'), 'F0');78 const options = await driver.findElements(webdriver.By.tagName('option'));79 //changing to diaphragm filter80 await options[1].click();81 assert.equal(await select.getAttribute('value'), 'F5');82 setTimeout(async () => {83 const ssBuffer2 = await driver.takeScreenshot();84 await utils.saveScreenshot(`${output}/${testFileName}-003-002`, ssBuffer2);85 setTimeout(async () => {86 //changing to midrange filter87 await select.click();88 await options[2].click();89 assert.equal(await select.getAttribute('value'), 'F6');90 setTimeout(async () => {91 const ssBuffer3 = await driver.takeScreenshot();92 await utils.saveScreenshot(`${output}/${testFileName}-003-003`, ssBuffer3);93 setTimeout(async () => {94 //changing to bell filter95 await select.click();96 await options[3].click();97 assert.equal(await select.getAttribute('value'), 'F7');98 setTimeout(async () => {99 const ssBuffer4 = await driver.takeScreenshot();100 await utils.saveScreenshot(`${output}/${testFileName}-003-004`, ssBuffer4);101 setTimeout(async () => {102 //changing to bell filter103 await select.click();104 await options[4].click();105 assert.equal(await select.getAttribute('value'), 'F8');106 setTimeout(async () => {107 const ssBuffer5 = await driver.takeScreenshot();108 await utils.saveScreenshot(`${output}/${testFileName}-003-005`, ssBuffer5);109 done();110 }, timeout)111 }, timeout);112 }, timeout)113 }, timeout);114 }, timeout);115 }, timeout);116 }, timeout);117 }118 }, timeout);119 });120 it(`[${testFileName}-004] Change to [Diaphragm Filter] and play`, async (done) => {121 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));122 await driver.wait(webdriver.until.elementIsEnabled(playBtn));123 setTimeout(async () => {124 const ssBuffer = await driver.takeScreenshot();125 await utils.saveScreenshot(`${output}/${testFileName}-004-001`, ssBuffer);126 setTimeout(async () => {127 const select = await driver.findElement(webdriver.By.id('filter-select'))128 await select.click();129 //before130 assert.equal(await select.getAttribute('value'), 'F0');131 const options = await driver.findElements(webdriver.By.tagName('option'));132 //changing to diaphragm filter133 await options[1].click();134 assert.equal(await select.getAttribute('value'), 'F5');135 setTimeout(async () => {136 await playBtn.click();137 assert.equal(await playBtn.getText(), 'pause');138 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));139 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));140 const ssBuffer2 = await driver.takeScreenshot();141 await utils.saveScreenshot(`${output}/${testFileName}-004-002`, ssBuffer2);142 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));143 const ssBuffer3 = await driver.takeScreenshot();144 await utils.saveScreenshot(`${output}/${testFileName}-004-003`, ssBuffer3);145 done();146 }, timeout)147 }, timeout)148 }, timeout)149 });150 it(`[${testFileName}-005] Change to [Midrange Filter] and play`, async (done) => {151 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));152 await driver.wait(webdriver.until.elementIsEnabled(playBtn));153 setTimeout(async () => {154 const ssBuffer = await driver.takeScreenshot();155 await utils.saveScreenshot(`${output}/${testFileName}-005-001`, ssBuffer);156 setTimeout(async () => {157 const select = await driver.findElement(webdriver.By.id('filter-select'))158 await select.click();159 //before160 assert.equal(await select.getAttribute('value'), 'F0');161 const options = await driver.findElements(webdriver.By.tagName('option'));162 //changing to midrange filter163 await options[2].click();164 assert.equal(await select.getAttribute('value'), 'F6');165 setTimeout(async () => {166 await playBtn.click();167 assert.equal(await playBtn.getText(), 'pause');168 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));169 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));170 const ssBuffer2 = await driver.takeScreenshot();171 await utils.saveScreenshot(`${output}/${testFileName}-005-002`, ssBuffer2);172 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));173 const ssBuffer3 = await driver.takeScreenshot();174 await utils.saveScreenshot(`${output}/${testFileName}-005-003`, ssBuffer3);175 done();176 }, timeout)177 }, timeout)178 }, timeout)179 });180 it(`[${testFileName}-006] Change to [Bell Filter] and play`, async (done) => {181 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));182 await driver.wait(webdriver.until.elementIsEnabled(playBtn));183 setTimeout(async () => {184 const ssBuffer = await driver.takeScreenshot();185 await utils.saveScreenshot(`${output}/${testFileName}-006-001`, ssBuffer);186 setTimeout(async () => {187 const select = await driver.findElement(webdriver.By.id('filter-select'))188 await select.click();189 //before190 assert.equal(await select.getAttribute('value'), 'F0');191 const options = await driver.findElements(webdriver.By.tagName('option'));192 //changing to bell filter193 await options[3].click();194 assert.equal(await select.getAttribute('value'), 'F7');195 setTimeout(async () => {196 await playBtn.click();197 assert.equal(await playBtn.getText(), 'pause');198 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));199 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));200 const ssBuffer2 = await driver.takeScreenshot();201 await utils.saveScreenshot(`${output}/${testFileName}-006-002`, ssBuffer2);202 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));203 const ssBuffer3 = await driver.takeScreenshot();204 await utils.saveScreenshot(`${output}/${testFileName}-006-003`, ssBuffer3);205 done();206 }, timeout)207 }, timeout)208 }, timeout)209 });210 it(`[${testFileName}-007] Change to [Heart Filter] and play`, async (done) => {211 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));212 await driver.wait(webdriver.until.elementIsEnabled(playBtn));213 setTimeout(async () => {214 const ssBuffer = await driver.takeScreenshot();215 await utils.saveScreenshot(`${output}/${testFileName}-007-001`, ssBuffer);216 setTimeout(async () => {217 const select = await driver.findElement(webdriver.By.id('filter-select'))218 await select.click();219 //before220 assert.equal(await select.getAttribute('value'), 'F0');221 const options = await driver.findElements(webdriver.By.tagName('option'));222 //changing to heart filter223 await options[4].click();224 assert.equal(await select.getAttribute('value'), 'F8');225 setTimeout(async () => {226 await playBtn.click();227 assert.equal(await playBtn.getText(), 'pause');228 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));229 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));230 const ssBuffer2 = await driver.takeScreenshot();231 await utils.saveScreenshot(`${output}/${testFileName}-007-002`, ssBuffer2);232 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));233 const ssBuffer3 = await driver.takeScreenshot();234 await utils.saveScreenshot(`${output}/${testFileName}-007-003`, ssBuffer3);235 done();236 }, timeout)237 }, timeout)238 }, timeout)239 });240 it(`[${testFileName}-008] adjusts gain from 1 to 3 with step of 0.5 and play`, async (done) => {241 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));242 const btnenabled = await driver.wait(webdriver.until.elementIsEnabled(playBtn));243 if (btnenabled) {244 setTimeout(async () => {245 const gainInput = await driver.findElement(webdriver.By.id('gain-input'));246 const ssBuffer = await driver.takeScreenshot();247 await utils.saveScreenshot(`${output}/${testFileName}-008-001`, ssBuffer);248 for (let i = 0; i < 4; i++) {249 gainInput.sendKeys(webdriver.Key.ARROW_RIGHT);250 }251 await playBtn.click();252 setTimeout(async () => {253 const ssBuffer2 = await driver.takeScreenshot();254 await utils.saveScreenshot(`${output}/${testFileName}-008-002`, ssBuffer2);255 done();256 }, timeout)257 }, timeout)258 }259 });260 it(`[${testFileName}-009] Plays, pauses and resumes decoded and filtered audio using default filter from firebase`, async (done) => {261 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));262 setTimeout(async () => {263 //play264 await driver.wait(webdriver.until.elementIsEnabled(playBtn)).click();265 assert.equal(await playBtn.getText(), 'pause');266 const ssBuffer = await driver.takeScreenshot();267 await utils.saveScreenshot(`${output}/${testFileName}-009-001`, ssBuffer);268 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));269 //pause270 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));271 await playBtn.click();272 assert.equal(await playBtn.getText(), 'resume')273 const ssBuffer2 = await driver.takeScreenshot();274 await utils.saveScreenshot(`${output}/${testFileName}-009-002`, ssBuffer2);275 //resume276 await playBtn.click();277 assert.equal(await playBtn.getText(), 'pause')278 const ssBuffer3 = await driver.takeScreenshot();279 await utils.saveScreenshot(`${output}/${testFileName}-009-003`, ssBuffer3);280 done();281 }, timeout);282 });283 it(`[${testFileName}-010] zoom 50px`, async (done) => {284 setTimeout(async () => {285 const ssBuffer = await driver.takeScreenshot();286 await utils.saveScreenshot(`${output}/${testFileName}-010-001`, ssBuffer);287 setTimeout(async () => {288 const zoomBtn50 = await driver.findElement(webdriver.By.id('zoom-btn-50')).click();289 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));290 assert.equal(await zoomTxt.getText(), '50');291 setTimeout(async () => {292 const ssBuffer = await driver.takeScreenshot();293 await utils.saveScreenshot(`${output}/${testFileName}-010-002`, ssBuffer);294 done();295 }, timeout)296 }, timeout);297 }, timeout);298 });299 it(`[${testFileName}-011] zoom 80px`, async (done) => {300 setTimeout(async () => {301 const ssBuffer = await driver.takeScreenshot();302 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);303 setTimeout(async () => {304 const zoomBtn50 = await driver.findElement(webdriver.By.id('zoom-btn-80')).click();305 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));306 assert.equal(await zoomTxt.getText(), '80');307 setTimeout(async () => {308 const ssBuffer = await driver.takeScreenshot();309 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);310 done();311 }, 4000)312 }, timeout);313 }, timeout);314 });315 it(`[${testFileName}-011] zoom 80px and plays`, async (done) => {316 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));317 setTimeout(async () => {318 const ssBuffer = await driver.takeScreenshot();319 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);320 setTimeout(async () => {321 await driver.findElement(webdriver.By.id('zoom-btn-80')).click();322 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));323 assert.equal(await zoomTxt.getText(), '80');324 await playBtn.click();325 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));326 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));327 const ssBuffer = await driver.takeScreenshot();328 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);329 done();330 }, timeout);331 }, timeout);332 });333 it(`[${testFileName}-012] clicks on canvas to test fast forward to 10th seconds and plays`, async (done) => {334 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));335 setTimeout(async () => {336 const ssBuffer = await driver.takeScreenshot();337 await utils.saveScreenshot(`${output}/${testFileName}-012-001`, ssBuffer);338 setTimeout(async () => {339 const actions = driver.actions({bridge: true});340 await actions.move({x: 340, y: 500, origin: webdriver.Origin.POINTER}).press().release(); //10th seconds341 await actions.perform();342 const ssBuffer2 = await driver.takeScreenshot();343 await utils.saveScreenshot(`${output}/${testFileName}-012-002`, ssBuffer2);344 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));345 await playBtn.click();346 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));347 assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);348 const ssBuffer3 = await driver.takeScreenshot();349 await utils.saveScreenshot(`${output}/${testFileName}-012-003`, ssBuffer3);350 done();351 }, timeout);352 }, timeout);353 });354 it(`[${testFileName}-013] Change to [Heart Filter], fast forward 10th seconds and play`, async (done) => {355 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));356 await driver.wait(webdriver.until.elementIsEnabled(playBtn));357 setTimeout(async () => {358 const ssBuffer = await driver.takeScreenshot();359 await utils.saveScreenshot(`${output}/${testFileName}-013-001`, ssBuffer);360 setTimeout(async () => {361 const select = await driver.findElement(webdriver.By.id('filter-select'))362 await select.click();363 //before364 assert.equal(await select.getAttribute('value'), 'F0');365 const options = await driver.findElements(webdriver.By.tagName('option'));366 //changing to heart filter367 await options[4].click();368 assert.equal(await select.getAttribute('value'), 'F8');369 setTimeout(async () => {370 const actions = driver.actions({bridge: true});371 await actions.move({x: 340, y: 500, origin: webdriver.Origin.POINTER}).press().release(); //10th seconds372 await actions.perform();373 const ssBuffer2 = await driver.takeScreenshot();374 await utils.saveScreenshot(`${output}/${testFileName}-013-002`, ssBuffer2);375 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));376 await playBtn.click();377 assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);378 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));379 const ssBuffer3 = await driver.takeScreenshot();380 await utils.saveScreenshot(`${output}/${testFileName}-013-003`, ssBuffer3);381 done();382 }, timeout)383 }, timeout)384 }, timeout)385 });386 it(`[${testFileName}-014] resize window to 500px and audioplayer re-renders waveform and plugins`, async (done) => {387 setTimeout(async () => {388 const ssBuffer = await driver.takeScreenshot();389 await utils.saveScreenshot(`${output}/${testFileName}-014-001`, ssBuffer);390 await driver.manage().window().setRect({width: 500, height: 1000, x: 0, y: 0});391 setTimeout(async () => {392 const ssBuffer2 = await driver.takeScreenshot();393 await utils.saveScreenshot(`${output}/${testFileName}-014-002`, ssBuffer2);394 done();395 }, timeout);396 }, timeout);397 });398 it(`[${testFileName}-015] resize window to less than 300px and audioplayer will not re-renders waveform and plugins`, async (done) => {399 setTimeout(async () => {400 const ssBuffer = await driver.takeScreenshot();401 await utils.saveScreenshot(`${output}/${testFileName}-015-001`, ssBuffer);402 await driver.manage().window().setRect({width: 250, height: 1000, x: 0, y: 0});403 setTimeout(async () => {404 const ssBuffer2 = await driver.takeScreenshot();405 await utils.saveScreenshot(`${output}/${testFileName}-015-002`, ssBuffer2);406 done();407 }, timeout);408 }, timeout);409 });...

Full Screen

Full Screen

firefox.test.js

Source:firefox.test.js Github

copy

Full Screen

...29 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));30 await driver.wait(webdriver.until.elementIsEnabled(playBtn));31 assert.equal(await playBtn.getText(), 'play');32 setTimeout(async () => {33 const ssBuffer = await driver.takeScreenshot();34 await utils.utils.saveScreenshot(`${output}/${testFileName}-001`, ssBuffer)35 done();36 }, timeout);37 });38 it(`[${testFileName}-002] Plays decoded and filtered audio using default filter from firebase`, async () => {39 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));40 await driver.wait(webdriver.until.elementIsEnabled(playBtn)).click();41 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));42 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));43 const ssBuffer = await driver.takeScreenshot();44 await utils.saveScreenshot(`${output}/${testFileName}-002-001`, ssBuffer);45 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));46 const ssBuffer2 = await driver.takeScreenshot();47 await utils.saveScreenshot(`${output}/${testFileName}-002-002`, ssBuffer2);48 assert.equal(await playBtn.getText(), 'pause');49 });50 it(`[${testFileName}-003] changes filter from Extended -> Diaphragm -> Midrange -> Bell -> Heart filters `, async (done) => {51 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));52 const ready = await driver.wait(webdriver.until.elementIsEnabled(playBtn));53 //fucking kill me with this settimeout hell54 setTimeout(async () => {55 if (ready) {56 const ssBuffer = await driver.takeScreenshot();57 await utils.saveScreenshot(`${output}/${testFileName}-003-001`, ssBuffer);58 const select = await driver.findElement(webdriver.By.id('filter-select'))59 await select.click();60 //before61 assert.equal(await select.getAttribute('value'), 'F0');62 const options = await driver.findElements(webdriver.By.tagName('option'));63 //changing to diaphragm filter64 await options[1].click();65 assert.equal(await select.getAttribute('value'), 'F5');66 setTimeout(async () => {67 const ssBuffer2 = await driver.takeScreenshot();68 await utils.saveScreenshot(`${output}/${testFileName}-003-002`, ssBuffer2);69 setTimeout(async () => {70 //changing to midrange filter71 await select.click();72 await options[2].click();73 assert.equal(await select.getAttribute('value'), 'F6');74 setTimeout(async () => {75 const ssBuffer3 = await driver.takeScreenshot();76 await utils.saveScreenshot(`${output}/${testFileName}-003-003`, ssBuffer3);77 setTimeout(async () => {78 //changing to bell filter79 await select.click();80 await options[3].click();81 assert.equal(await select.getAttribute('value'), 'F7');82 setTimeout(async () => {83 const ssBuffer4 = await driver.takeScreenshot();84 await utils.saveScreenshot(`${output}/${testFileName}-003-004`, ssBuffer4);85 setTimeout(async () => {86 //changing to bell filter87 await select.click();88 await options[4].click();89 assert.equal(await select.getAttribute('value'), 'F8');90 setTimeout(async () => {91 const ssBuffer5 = await driver.takeScreenshot();92 await utils.saveScreenshot(`${output}/${testFileName}-003-005`, ssBuffer5);93 done();94 }, timeout)95 }, timeout);96 }, timeout)97 }, timeout);98 }, timeout);99 }, timeout);100 }, timeout);101 }102 }, timeout);103 });104 it(`[${testFileName}-004] Change to [Diaphragm Filter] and play`, async (done) => {105 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));106 await driver.wait(webdriver.until.elementIsEnabled(playBtn));107 setTimeout(async () => {108 const ssBuffer = await driver.takeScreenshot();109 await utils.saveScreenshot(`${output}/${testFileName}-004-001`, ssBuffer);110 setTimeout(async () => {111 const select = await driver.findElement(webdriver.By.id('filter-select'))112 await select.click();113 //before114 assert.equal(await select.getAttribute('value'), 'F0');115 const options = await driver.findElements(webdriver.By.tagName('option'));116 //changing to diaphragm filter117 await options[1].click();118 assert.equal(await select.getAttribute('value'), 'F5');119 setTimeout(async () => {120 await playBtn.click();121 assert.equal(await playBtn.getText(), 'pause');122 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));123 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));124 const ssBuffer2 = await driver.takeScreenshot();125 await utils.saveScreenshot(`${output}/${testFileName}-004-002`, ssBuffer2);126 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));127 const ssBuffer3 = await driver.takeScreenshot();128 await utils.saveScreenshot(`${output}/${testFileName}-004-003`, ssBuffer3);129 done();130 }, timeout)131 }, timeout)132 }, timeout)133 });134 it(`[${testFileName}-005] Change to [Midrange Filter] and play`, async (done) => {135 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));136 await driver.wait(webdriver.until.elementIsEnabled(playBtn));137 setTimeout(async () => {138 const ssBuffer = await driver.takeScreenshot();139 await utils.saveScreenshot(`${output}/${testFileName}-005-001`, ssBuffer);140 setTimeout(async () => {141 const select = await driver.findElement(webdriver.By.id('filter-select'))142 await select.click();143 //before144 assert.equal(await select.getAttribute('value'), 'F0');145 const options = await driver.findElements(webdriver.By.tagName('option'));146 //changing to midrange filter147 await options[2].click();148 assert.equal(await select.getAttribute('value'), 'F6');149 setTimeout(async () => {150 await playBtn.click();151 assert.equal(await playBtn.getText(), 'pause');152 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));153 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));154 const ssBuffer2 = await driver.takeScreenshot();155 await utils.saveScreenshot(`${output}/${testFileName}-005-002`, ssBuffer2);156 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));157 const ssBuffer3 = await driver.takeScreenshot();158 await utils.saveScreenshot(`${output}/${testFileName}-005-003`, ssBuffer3);159 done();160 }, timeout)161 }, timeout)162 }, timeout)163 });164 it(`[${testFileName}-006] Change to [Bell Filter] and play`, async (done) => {165 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));166 await driver.wait(webdriver.until.elementIsEnabled(playBtn));167 setTimeout(async () => {168 const ssBuffer = await driver.takeScreenshot();169 await utils.saveScreenshot(`${output}/${testFileName}-006-001`, ssBuffer);170 setTimeout(async () => {171 const select = await driver.findElement(webdriver.By.id('filter-select'))172 await select.click();173 //before174 assert.equal(await select.getAttribute('value'), 'F0');175 const options = await driver.findElements(webdriver.By.tagName('option'));176 //changing to bell filter177 await options[3].click();178 assert.equal(await select.getAttribute('value'), 'F7');179 setTimeout(async () => {180 await playBtn.click();181 assert.equal(await playBtn.getText(), 'pause');182 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));183 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));184 const ssBuffer2 = await driver.takeScreenshot();185 await utils.saveScreenshot(`${output}/${testFileName}-006-002`, ssBuffer2);186 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));187 const ssBuffer3 = await driver.takeScreenshot();188 await utils.saveScreenshot(`${output}/${testFileName}-006-003`, ssBuffer3);189 done();190 }, timeout)191 }, timeout)192 }, timeout)193 });194 it(`[${testFileName}-007] Change to [Heart Filter] and play`, async (done) => {195 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));196 await driver.wait(webdriver.until.elementIsEnabled(playBtn));197 setTimeout(async () => {198 const ssBuffer = await driver.takeScreenshot();199 await utils.saveScreenshot(`${output}/${testFileName}-007-001`, ssBuffer);200 setTimeout(async () => {201 const select = await driver.findElement(webdriver.By.id('filter-select'))202 await select.click();203 //before204 assert.equal(await select.getAttribute('value'), 'F0');205 const options = await driver.findElements(webdriver.By.tagName('option'));206 //changing to heart filter207 await options[4].click();208 assert.equal(await select.getAttribute('value'), 'F8');209 setTimeout(async () => {210 await playBtn.click();211 assert.equal(await playBtn.getText(), 'pause');212 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));213 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));214 const ssBuffer2 = await driver.takeScreenshot();215 await utils.saveScreenshot(`${output}/${testFileName}-007-002`, ssBuffer2);216 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));217 const ssBuffer3 = await driver.takeScreenshot();218 await utils.saveScreenshot(`${output}/${testFileName}-007-003`, ssBuffer3);219 done();220 }, timeout)221 }, timeout)222 }, timeout)223 });224 it(`[${testFileName}-008] adjusts gain from 1 to 3 with step of 0.5 and play`, async (done) => {225 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));226 const btnenabled = await driver.wait(webdriver.until.elementIsEnabled(playBtn));227 if (btnenabled) {228 setTimeout(async () => {229 const gainInput = await driver.findElement(webdriver.By.id('gain-input'));230 const ssBuffer = await driver.takeScreenshot();231 await utils.saveScreenshot(`${output}/${testFileName}-008-001`, ssBuffer);232 for (let i = 0; i < 4; i++) {233 gainInput.sendKeys(webdriver.Key.ARROW_RIGHT);234 }235 await playBtn.click();236 setTimeout(async () => {237 const ssBuffer2 = await driver.takeScreenshot();238 await utils.saveScreenshot(`${output}/${testFileName}-008-002`, ssBuffer2);239 done();240 }, timeout)241 }, timeout)242 }243 });244 it(`[${testFileName}-009] Plays, pauses and resumes decoded and filtered audio using default filter from firebase`, async (done) => {245 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));246 setTimeout(async () => {247 //play248 await driver.wait(webdriver.until.elementIsEnabled(playBtn)).click();249 assert.equal(await playBtn.getText(), 'pause');250 const ssBuffer = await driver.takeScreenshot();251 await utils.saveScreenshot(`${output}/${testFileName}-009-001`, ssBuffer);252 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));253 //pause254 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));255 await playBtn.click();256 assert.equal(await playBtn.getText(), 'resume')257 const ssBuffer2 = await driver.takeScreenshot();258 await utils.saveScreenshot(`${output}/${testFileName}-009-002`, ssBuffer2);259 //resume260 await playBtn.click();261 assert.equal(await playBtn.getText(), 'pause')262 const ssBuffer3 = await driver.takeScreenshot();263 await utils.saveScreenshot(`${output}/${testFileName}-009-003`, ssBuffer3);264 done();265 }, timeout);266 });267 it(`[${testFileName}-010] zoom 50px`, async (done) => {268 setTimeout(async () => {269 const ssBuffer = await driver.takeScreenshot();270 await utils.saveScreenshot(`${output}/${testFileName}-010-001`, ssBuffer);271 setTimeout(async () => {272 const zoomBtn50 = await driver.findElement(webdriver.By.id('zoom-btn-50')).click();273 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));274 assert.equal(await zoomTxt.getText(), '50');275 setTimeout(async () => {276 const ssBuffer = await driver.takeScreenshot();277 await utils.saveScreenshot(`${output}/${testFileName}-010-002`, ssBuffer);278 done();279 }, timeout)280 }, timeout);281 }, timeout);282 });283 it(`[${testFileName}-011] zoom 80px`, async (done) => {284 setTimeout(async () => {285 const ssBuffer = await driver.takeScreenshot();286 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);287 setTimeout(async () => {288 const zoomBtn50 = await driver.findElement(webdriver.By.id('zoom-btn-80')).click();289 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));290 assert.equal(await zoomTxt.getText(), '80');291 setTimeout(async () => {292 const ssBuffer = await driver.takeScreenshot();293 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);294 done();295 }, 4000)296 }, timeout);297 }, timeout);298 });299 it(`[${testFileName}-011] zoom 80px and plays`, async (done) => {300 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));301 setTimeout(async () => {302 const ssBuffer = await driver.takeScreenshot();303 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);304 setTimeout(async () => {305 await driver.findElement(webdriver.By.id('zoom-btn-80')).click();306 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));307 assert.equal(await zoomTxt.getText(), '80');308 await playBtn.click();309 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));310 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));311 const ssBuffer = await driver.takeScreenshot();312 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);313 done();314 }, timeout);315 }, timeout);316 });317 it(`[${testFileName}-012] clicks on canvas to test fast forward to 10th seconds and plays`, async (done) => {318 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));319 setTimeout(async () => {320 const ssBuffer = await driver.takeScreenshot();321 await utils.saveScreenshot(`${output}/${testFileName}-012-001`, ssBuffer);322 setTimeout(async () => {323 const actions = driver.actions({bridge: true});324 await actions.move({x: 340, y: 500, origin: webdriver.Origin.POINTER}).press().release(); //10th seconds325 await actions.perform();326 const ssBuffer2 = await driver.takeScreenshot();327 await utils.saveScreenshot(`${output}/${testFileName}-012-002`, ssBuffer2);328 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));329 await playBtn.click();330 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));331 assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);332 const ssBuffer3 = await driver.takeScreenshot();333 await utils.saveScreenshot(`${output}/${testFileName}-012-003`, ssBuffer3);334 done();335 }, timeout);336 }, timeout);337 });338 it(`[${testFileName}-013] Change to [Heart Filter], fast forward 10th seconds and play`, async (done) => {339 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));340 await driver.wait(webdriver.until.elementIsEnabled(playBtn));341 setTimeout(async () => {342 const ssBuffer = await driver.takeScreenshot();343 await utils.saveScreenshot(`${output}/${testFileName}-013-001`, ssBuffer);344 setTimeout(async () => {345 const select = await driver.findElement(webdriver.By.id('filter-select'))346 await select.click();347 //before348 assert.equal(await select.getAttribute('value'), 'F0');349 const options = await driver.findElements(webdriver.By.tagName('option'));350 //changing to heart filter351 await options[4].click();352 assert.equal(await select.getAttribute('value'), 'F8');353 setTimeout(async () => {354 const actions = driver.actions({bridge: true});355 await actions.move({x: 340, y: 500, origin: webdriver.Origin.POINTER}).press().release(); //10th seconds356 await actions.perform();357 const ssBuffer2 = await driver.takeScreenshot();358 await utils.saveScreenshot(`${output}/${testFileName}-013-002`, ssBuffer2);359 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));360 await playBtn.click();361 assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);362 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));363 const ssBuffer3 = await driver.takeScreenshot();364 await utils.saveScreenshot(`${output}/${testFileName}-013-003`, ssBuffer3);365 done();366 }, timeout)367 }, timeout)368 }, timeout)369 });370 it(`[${testFileName}-014] resize window to 500px and audioplayer re-renders waveform and plugins`, async (done) => {371 setTimeout(async () => {372 const ssBuffer = await driver.takeScreenshot();373 await utils.saveScreenshot(`${output}/${testFileName}-014-001`, ssBuffer);374 await driver.manage().window().setRect({width: 500, height: 1000, x: 0, y: 0});375 setTimeout(async () => {376 const ssBuffer2 = await driver.takeScreenshot();377 await utils.saveScreenshot(`${output}/${testFileName}-014-002`, ssBuffer2);378 done();379 }, timeout);380 }, timeout);381 });382 it(`[${testFileName}-015] resize window to less than 300px and audioplayer will not re-renders waveform and plugins`, async (done) => {383 setTimeout(async () => {384 const ssBuffer = await driver.takeScreenshot();385 await utils.saveScreenshot(`${output}/${testFileName}-015-001`, ssBuffer);386 await driver.manage().window().setRect({width: 250, height: 1000, x: 0, y: 0});387 setTimeout(async () => {388 const ssBuffer2 = await driver.takeScreenshot();389 await utils.saveScreenshot(`${output}/${testFileName}-015-002`, ssBuffer2);390 done();391 }, timeout);392 }, timeout);393 });...

Full Screen

Full Screen

safari.test.js

Source:safari.test.js Github

copy

Full Screen

...24 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));25 await driver.wait(webdriver.until.elementIsEnabled(playBtn));26 assert.equal(await playBtn.getText(), 'play');27 setTimeout(async () => {28 const ssBuffer = await driver.takeScreenshot();29 await utils.saveScreenshot(`${output}/${testFileName}-001`, ssBuffer)30 done();31 }, timeout);32 });33 it(`[${testFileName}-002] Plays decoded and filtered audio using default filter from firebase`, async (done) => {34 setTimeout(async () => {35 // const playBtn = await driver.findElement(webdriver.By.id('play-btn'));36 const playBtn = await driver.executeScript("document.getElementById('play-btn').click()");37 // await driver.wait(webdriver.until.elementIsEnabled(playBtn)).click();38 console.log('here?')39 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));40 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));41 const ssBuffer = await driver.takeScreenshot();42 await utils.saveScreenshot(`${output}/${testFileName}-002-001`, ssBuffer);43 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));44 const ssBuffer2 = await driver.takeScreenshot();45 await utils.saveScreenshot(`${output}/${testFileName}-002-002`, ssBuffer2);46 assert.equal(await playBtn.getText(), 'pause');47 done();48 }, timeout)49 });50 it(`[${testFileName}-003] changes filter from Extended -> Diaphragm -> Midrange -> Bell -> Heart filters `, async (done) => {51 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));52 const ready = await driver.wait(webdriver.until.elementIsEnabled(playBtn));53 //fucking kill me with this settimeout hell54 setTimeout(async () => {55 if (ready) {56 const ssBuffer = await driver.takeScreenshot();57 await utils.saveScreenshot(`${output}/${testFileName}-003-001`, ssBuffer);58 const select = await driver.findElement(webdriver.By.id('filter-select'))59 await select.click();60 //before61 assert.equal(await select.getAttribute('value'), 'F0');62 const options = await driver.findElements(webdriver.By.tagName('option'));63 //changing to diaphragm filter64 await options[1].click();65 assert.equal(await select.getAttribute('value'), 'F5');66 setTimeout(async () => {67 const ssBuffer2 = await driver.takeScreenshot();68 await utils.saveScreenshot(`${output}/${testFileName}-003-002`, ssBuffer2);69 setTimeout(async () => {70 //changing to midrange filter71 await select.click();72 await options[2].click();73 assert.equal(await select.getAttribute('value'), 'F6');74 setTimeout(async () => {75 const ssBuffer3 = await driver.takeScreenshot();76 await utils.saveScreenshot(`${output}/${testFileName}-003-003`, ssBuffer3);77 setTimeout(async () => {78 //changing to bell filter79 await select.click();80 await options[3].click();81 assert.equal(await select.getAttribute('value'), 'F7');82 setTimeout(async () => {83 const ssBuffer4 = await driver.takeScreenshot();84 await utils.saveScreenshot(`${output}/${testFileName}-003-004`, ssBuffer4);85 setTimeout(async () => {86 //changing to bell filter87 await select.click();88 await options[4].click();89 assert.equal(await select.getAttribute('value'), 'F8');90 setTimeout(async () => {91 const ssBuffer5 = await driver.takeScreenshot();92 await utils.saveScreenshot(`${output}/${testFileName}-003-005`, ssBuffer5);93 done();94 }, timeout)95 }, timeout);96 }, timeout)97 }, timeout);98 }, timeout);99 }, timeout);100 }, timeout);101 }102 }, timeout);103 });104 it(`[${testFileName}-004] Change to [Diaphragm Filter] and play`, async (done) => {105 setTimeout(async () => {106 const ssBuffer = await driver.takeScreenshot();107 await utils.saveScreenshot(`${output}/${testFileName}-004-001`, ssBuffer);108 setTimeout(async () => {109 const select = await driver.findElement(webdriver.By.id('filter-select'))110 await select.click();111 //before112 assert.equal(await select.getAttribute('value'), 'F0');113 const options = await driver.findElements(webdriver.By.tagName('option'));114 //changing to diaphragm filter115 await options[1].click();116 assert.equal(await select.getAttribute('value'), 'F5');117 setTimeout(async () => {118 await driver.executeScript("document.getElementById('play-btn').click()");119 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));120 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));121 const ssBuffer2 = await driver.takeScreenshot();122 await utils.saveScreenshot(`${output}/${testFileName}-004-002`, ssBuffer2);123 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));124 const ssBuffer3 = await driver.takeScreenshot();125 await utils.saveScreenshot(`${output}/${testFileName}-004-003`, ssBuffer3);126 done();127 }, timeout)128 }, timeout)129 }, timeout)130 });131 it(`[${testFileName}-005] Change to [Midrange Filter] and play`, async (done) => {132 setTimeout(async () => {133 const ssBuffer = await driver.takeScreenshot();134 await utils.saveScreenshot(`${output}/${testFileName}-005-001`, ssBuffer);135 setTimeout(async () => {136 const select = await driver.findElement(webdriver.By.id('filter-select'))137 await select.click();138 //before139 assert.equal(await select.getAttribute('value'), 'F0');140 const options = await driver.findElements(webdriver.By.tagName('option'));141 //changing to midrange filter142 await options[2].click();143 assert.equal(await select.getAttribute('value'), 'F6');144 setTimeout(async () => {145 await driver.executeScript("document.getElementById('play-btn').click()");146 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));147 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));148 const ssBuffer2 = await driver.takeScreenshot();149 await utils.saveScreenshot(`${output}/${testFileName}-005-002`, ssBuffer2);150 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));151 const ssBuffer3 = await driver.takeScreenshot();152 await utils.saveScreenshot(`${output}/${testFileName}-005-003`, ssBuffer3);153 done();154 }, timeout)155 }, timeout)156 }, timeout)157 });158 it(`[${testFileName}-006] Change to [Bell Filter] and play`, async (done) => {159 setTimeout(async () => {160 const ssBuffer = await driver.takeScreenshot();161 await utils.saveScreenshot(`${output}/${testFileName}-006-001`, ssBuffer);162 setTimeout(async () => {163 const select = await driver.findElement(webdriver.By.id('filter-select'))164 await select.click();165 //before166 assert.equal(await select.getAttribute('value'), 'F0');167 const options = await driver.findElements(webdriver.By.tagName('option'));168 //changing to bell filter169 await options[3].click();170 assert.equal(await select.getAttribute('value'), 'F7');171 setTimeout(async () => {172 await driver.executeScript("document.getElementById('play-btn').click()");173 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));174 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));175 const ssBuffer2 = await driver.takeScreenshot();176 await utils.saveScreenshot(`${output}/${testFileName}-006-002`, ssBuffer2);177 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));178 const ssBuffer3 = await driver.takeScreenshot();179 await utils.saveScreenshot(`${output}/${testFileName}-006-003`, ssBuffer3);180 done();181 }, timeout)182 }, timeout)183 }, timeout)184 });185 it(`[${testFileName}-007] Change to [Heart Filter] and play`, async (done) => {186 setTimeout(async () => {187 const ssBuffer = await driver.takeScreenshot();188 await utils.saveScreenshot(`${output}/${testFileName}-007-001`, ssBuffer);189 setTimeout(async () => {190 const select = await driver.findElement(webdriver.By.id('filter-select'))191 await select.click();192 //before193 assert.equal(await select.getAttribute('value'), 'F0');194 const options = await driver.findElements(webdriver.By.tagName('option'));195 //changing to heart filter196 await options[4].click();197 assert.equal(await select.getAttribute('value'), 'F8');198 setTimeout(async () => {199 await driver.executeScript("document.getElementById('play-btn').click()");200 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));201 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));202 const ssBuffer2 = await driver.takeScreenshot();203 await utils.saveScreenshot(`${output}/${testFileName}-007-002`, ssBuffer2);204 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));205 const ssBuffer3 = await driver.takeScreenshot();206 await utils.saveScreenshot(`${output}/${testFileName}-007-003`, ssBuffer3);207 done();208 }, timeout)209 }, timeout)210 }, timeout)211 });212 it(`[${testFileName}-008] adjusts gain from 1 to 3 with step of 0.5 and play`, async (done) => {213 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));214 const btnenabled = await driver.wait(webdriver.until.elementIsEnabled(playBtn));215 if (btnenabled) {216 setTimeout(async () => {217 const gainInput = await driver.findElement(webdriver.By.id('gain-input'));218 const ssBuffer = await driver.takeScreenshot();219 await utils.saveScreenshot(`${output}/${testFileName}-008-001`, ssBuffer);220 for (let i = 0; i < 4; i++) {221 gainInput.sendKeys(webdriver.Key.ARROW_RIGHT);222 }223 await playBtn.click();224 setTimeout(async () => {225 const ssBuffer2 = await driver.takeScreenshot();226 await utils.saveScreenshot(`${output}/${testFileName}-008-002`, ssBuffer2);227 done();228 }, timeout)229 }, timeout)230 }231 });232 it(`[${testFileName}-009] Plays, pauses and resumes decoded and filtered audio using default filter from firebase`, async (done) => {233 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));234 setTimeout(async () => {235 //play236 await driver.executeScript("document.getElementById('play-btn').click()");237 assert.equal(await playBtn.getText(), 'pause');238 const ssBuffer = await driver.takeScreenshot();239 await utils.saveScreenshot(`${output}/${testFileName}-009-001`, ssBuffer);240 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));241 //pause242 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));243 await driver.executeScript("document.getElementById('play-btn').click()");244 assert.equal(await playBtn.getText(), 'resume')245 const ssBuffer2 = await driver.takeScreenshot();246 await utils.saveScreenshot(`${output}/${testFileName}-009-002`, ssBuffer2);247 //resume248 await driver.executeScript("document.getElementById('play-btn').click()");249 assert.equal(await playBtn.getText(), 'pause')250 const ssBuffer3 = await driver.takeScreenshot();251 await utils.saveScreenshot(`${output}/${testFileName}-009-003`, ssBuffer3);252 done();253 }, timeout);254 });255 it(`[${testFileName}-010] zoom 50px`, async (done) => {256 setTimeout(async () => {257 const ssBuffer = await driver.takeScreenshot();258 await utils.saveScreenshot(`${output}/${testFileName}-010-001`, ssBuffer);259 setTimeout(async () => {260 await driver.executeScript("document.getElementById('zoom-btn-50').click()");261 // const zoomBtn50 = await driver.findElement(webdriver.By.id('zoom-btn-50')).click();262 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));263 assert.equal(await zoomTxt.getText(), '50');264 setTimeout(async () => {265 const ssBuffer = await driver.takeScreenshot();266 await utils.saveScreenshot(`${output}/${testFileName}-010-002`, ssBuffer);267 done();268 }, timeout)269 }, timeout);270 }, timeout);271 });272 it(`[${testFileName}-011] zoom 80px`, async (done) => {273 setTimeout(async () => {274 const ssBuffer = await driver.takeScreenshot();275 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);276 setTimeout(async () => {277 await driver.executeScript("document.getElementById('zoom-btn-80').click()");278 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));279 assert.equal(await zoomTxt.getText(), '80');280 setTimeout(async () => {281 const ssBuffer = await driver.takeScreenshot();282 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);283 done();284 }, 4000)285 }, timeout);286 }, timeout);287 });288 it(`[${testFileName}-011] zoom 80px and plays`, async (done) => {289 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));290 setTimeout(async () => {291 const ssBuffer = await driver.takeScreenshot();292 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);293 setTimeout(async () => {294 await driver.executeScript("document.getElementById('zoom-btn-80').click()");295 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));296 assert.equal(await zoomTxt.getText(), '80');297 await driver.executeScript("document.getElementById('play-btn').click()");298 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));299 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));300 const ssBuffer = await driver.takeScreenshot();301 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);302 done();303 }, timeout);304 }, timeout);305 });306 it(`[${testFileName}-012] clicks on canvas to test fast forward to 10th seconds and plays`, async (done) => {307 // const playBtn = await driver.findElement(webdriver.By.id('play-btn'));308 // await driver.manage().window().setRect({width:1280, height: 1080});309 // await driver.manage().window().maximize()310 setTimeout(async () => {311 const ssBuffer = await driver.takeScreenshot();312 await utils.saveScreenshot(`${output}/${testFileName}-012-001`, ssBuffer);313 setTimeout(async () => {314 const actions = driver.actions({bridge:true});315 await actions.move({x: 340, y: 500}).press().release(); //10th seconds316 await actions.perform();317 const ssBuffer2 = await driver.takeScreenshot();318 await utils.saveScreenshot(`${output}/${testFileName}-012-002`, ssBuffer2);319 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));320 await driver.executeScript("document.getElementById('play-btn').click()");321 // assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);322 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));323 const ssBuffer3 = await driver.takeScreenshot();324 await utils.saveScreenshot(`${output}/${testFileName}-012-003`, ssBuffer3);325 done();326 }, timeout);327 }, timeout);328 });329 it(`[${testFileName}-013] Change to [Heart Filter], fast forward 10th seconds and play`, async (done) => {330 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));331 await driver.wait(webdriver.until.elementIsEnabled(playBtn));332 setTimeout(async () => {333 const ssBuffer = await driver.takeScreenshot();334 await utils.saveScreenshot(`${output}/${testFileName}-013-001`, ssBuffer);335 setTimeout(async () => {336 const select = await driver.findElement(webdriver.By.id('filter-select'))337 await select.click();338 //before339 assert.equal(await select.getAttribute('value'), 'F0');340 const options = await driver.findElements(webdriver.By.tagName('option'));341 //changing to heart filter342 await options[4].click();343 assert.equal(await select.getAttribute('value'), 'F8');344 setTimeout(async () => {345 const actions = driver.actions({bridge: true});346 await actions.move({x: 340, y: 500, origin: webdriver.Origin.POINTER}).press().release(); //10th seconds347 await actions.perform();348 const ssBuffer2 = await driver.takeScreenshot();349 await utils.saveScreenshot(`${output}/${testFileName}-013-002`, ssBuffer2);350 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));351 await playBtn.click();352 assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);353 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));354 const ssBuffer3 = await driver.takeScreenshot();355 await utils.saveScreenshot(`${output}/${testFileName}-013-003`, ssBuffer3);356 done();357 }, timeout)358 }, timeout)359 }, timeout)360 });361 it(`[${testFileName}-014] resize window to 500px and audioplayer re-renders waveform and plugins`, async (done) => {362 setTimeout(async () => {363 const ssBuffer = await driver.takeScreenshot();364 await utils.saveScreenshot(`${output}/${testFileName}-014-001`, ssBuffer);365 await driver.manage().window().setRect({width: 500, height: 1000, x: 0, y: 0});366 setTimeout(async () => {367 const ssBuffer2 = await driver.takeScreenshot();368 await utils.saveScreenshot(`${output}/${testFileName}-014-002`, ssBuffer2);369 done();370 }, timeout);371 }, timeout);372 });373 it(`[${testFileName}-015] resize window to less than 300px and audioplayer will not re-renders waveform and plugins`, async (done) => {374 setTimeout(async () => {375 const ssBuffer = await driver.takeScreenshot();376 await utils.saveScreenshot(`${output}/${testFileName}-015-001`, ssBuffer);377 await driver.manage().window().setRect({width: 250, height: 1000, x: 0, y: 0});378 setTimeout(async () => {379 const ssBuffer2 = await driver.takeScreenshot();380 await utils.saveScreenshot(`${output}/${testFileName}-015-002`, ssBuffer2);381 done();382 }, timeout);383 }, timeout);384 });...

Full Screen

Full Screen

chrome.test.js

Source:chrome.test.js Github

copy

Full Screen

...20 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));21 await driver.wait(webdriver.until.elementIsEnabled(playBtn));22 assert.equal(await playBtn.getText(), 'play');23 setTimeout(async () => {24 const ssBuffer = await driver.takeScreenshot();25 await utils.saveScreenshot(`${output}/${testFileName}-001`, ssBuffer)26 done();27 }, timeout);28 });29 it(`[${testFileName}-002] Plays decoded and filtered audio using default filter from firebase`, async () => {30 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));31 await driver.wait(webdriver.until.elementIsEnabled(playBtn)).click();32 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));33 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));34 const ssBuffer = await driver.takeScreenshot();35 await utils.saveScreenshot(`${output}/${testFileName}-002-001`, ssBuffer);36 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));37 const ssBuffer2 = await driver.takeScreenshot();38 await utils.saveScreenshot(`${output}/${testFileName}-002-002`, ssBuffer2);39 assert.equal(await playBtn.getText(), 'pause');40 });41 it(`[${testFileName}-003] changes filter from Extended -> Diaphragm -> Midrange -> Bell -> Heart filters `, async (done) => {42 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));43 const ready = await driver.wait(webdriver.until.elementIsEnabled(playBtn));44 //fucking kill me with this settimeout hell45 setTimeout(async () => {46 if (ready) {47 const ssBuffer = await driver.takeScreenshot();48 await utils.saveScreenshot(`${output}/${testFileName}-003-001`, ssBuffer);49 const select = await driver.findElement(webdriver.By.id('filter-select'))50 await select.click();51 //before52 assert.equal(await select.getAttribute('value'), 'F0');53 const options = await driver.findElements(webdriver.By.tagName('option'));54 //changing to diaphragm filter55 await options[1].click();56 assert.equal(await select.getAttribute('value'), 'F5');57 setTimeout(async () => {58 const ssBuffer2 = await driver.takeScreenshot();59 await utils.saveScreenshot(`${output}/${testFileName}-003-002`, ssBuffer2);60 setTimeout(async () => {61 //changing to midrange filter62 await select.click();63 await options[2].click();64 assert.equal(await select.getAttribute('value'), 'F6');65 setTimeout(async () => {66 const ssBuffer3 = await driver.takeScreenshot();67 await utils.saveScreenshot(`${output}/${testFileName}-003-003`, ssBuffer3);68 setTimeout(async () => {69 //changing to bell filter70 await select.click();71 await options[3].click();72 assert.equal(await select.getAttribute('value'), 'F7');73 setTimeout(async () => {74 const ssBuffer4 = await driver.takeScreenshot();75 await utils.saveScreenshot(`${output}/${testFileName}-003-004`, ssBuffer4);76 setTimeout(async () => {77 //changing to bell filter78 await select.click();79 await options[4].click();80 assert.equal(await select.getAttribute('value'), 'F8');81 setTimeout(async () => {82 const ssBuffer5 = await driver.takeScreenshot();83 await utils.saveScreenshot(`${output}/${testFileName}-003-005`, ssBuffer5);84 done();85 }, timeout)86 }, timeout);87 }, timeout)88 }, timeout);89 }, timeout);90 }, timeout);91 }, timeout);92 }93 }, timeout);94 });95 it(`[${testFileName}-004] Change to [Diaphragm Filter] and play`, async (done) => {96 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));97 await driver.wait(webdriver.until.elementIsEnabled(playBtn));98 setTimeout(async () => {99 const ssBuffer = await driver.takeScreenshot();100 await utils.saveScreenshot(`${output}/${testFileName}-004-001`, ssBuffer);101 setTimeout(async () => {102 const select = await driver.findElement(webdriver.By.id('filter-select'))103 await select.click();104 //before105 assert.equal(await select.getAttribute('value'), 'F0');106 const options = await driver.findElements(webdriver.By.tagName('option'));107 //changing to diaphragm filter108 await options[1].click();109 assert.equal(await select.getAttribute('value'), 'F5');110 setTimeout(async () => {111 await playBtn.click();112 assert.equal(await playBtn.getText(), 'pause');113 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));114 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));115 const ssBuffer2 = await driver.takeScreenshot();116 await utils.saveScreenshot(`${output}/${testFileName}-004-002`, ssBuffer2);117 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));118 const ssBuffer3 = await driver.takeScreenshot();119 await utils.saveScreenshot(`${output}/${testFileName}-004-003`, ssBuffer3);120 done();121 }, timeout)122 }, timeout)123 }, timeout)124 });125 it(`[${testFileName}-005] Change to [Midrange Filter] and play`, async (done) => {126 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));127 await driver.wait(webdriver.until.elementIsEnabled(playBtn));128 setTimeout(async () => {129 const ssBuffer = await driver.takeScreenshot();130 await utils.saveScreenshot(`${output}/${testFileName}-005-001`, ssBuffer);131 setTimeout(async () => {132 const select = await driver.findElement(webdriver.By.id('filter-select'))133 await select.click();134 //before135 assert.equal(await select.getAttribute('value'), 'F0');136 const options = await driver.findElements(webdriver.By.tagName('option'));137 //changing to midrange filter138 await options[2].click();139 assert.equal(await select.getAttribute('value'), 'F6');140 setTimeout(async () => {141 await playBtn.click();142 assert.equal(await playBtn.getText(), 'pause');143 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));144 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));145 const ssBuffer2 = await driver.takeScreenshot();146 await utils.saveScreenshot(`${output}/${testFileName}-005-002`, ssBuffer2);147 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));148 const ssBuffer3 = await driver.takeScreenshot();149 await utils.saveScreenshot(`${output}/${testFileName}-005-003`, ssBuffer3);150 done();151 }, timeout)152 }, timeout)153 }, timeout)154 });155 it(`[${testFileName}-006] Change to [Bell Filter] and play`, async (done) => {156 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));157 await driver.wait(webdriver.until.elementIsEnabled(playBtn));158 setTimeout(async () => {159 const ssBuffer = await driver.takeScreenshot();160 await utils.saveScreenshot(`${output}/${testFileName}-006-001`, ssBuffer);161 setTimeout(async () => {162 const select = await driver.findElement(webdriver.By.id('filter-select'))163 await select.click();164 //before165 assert.equal(await select.getAttribute('value'), 'F0');166 const options = await driver.findElements(webdriver.By.tagName('option'));167 //changing to bell filter168 await options[3].click();169 assert.equal(await select.getAttribute('value'), 'F7');170 setTimeout(async () => {171 await playBtn.click();172 assert.equal(await playBtn.getText(), 'pause');173 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));174 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));175 const ssBuffer2 = await driver.takeScreenshot();176 await utils.saveScreenshot(`${output}/${testFileName}-006-002`, ssBuffer2);177 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));178 const ssBuffer3 = await driver.takeScreenshot();179 await utils.saveScreenshot(`${output}/${testFileName}-006-003`, ssBuffer3);180 done();181 }, timeout)182 }, timeout)183 }, timeout)184 });185 it(`[${testFileName}-007] Change to [Heart Filter] and play`, async (done) => {186 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));187 await driver.wait(webdriver.until.elementIsEnabled(playBtn));188 setTimeout(async () => {189 const ssBuffer = await driver.takeScreenshot();190 await utils.saveScreenshot(`${output}/${testFileName}-007-001`, ssBuffer);191 setTimeout(async () => {192 const select = await driver.findElement(webdriver.By.id('filter-select'))193 await select.click();194 //before195 assert.equal(await select.getAttribute('value'), 'F0');196 const options = await driver.findElements(webdriver.By.tagName('option'));197 //changing to heart filter198 await options[4].click();199 assert.equal(await select.getAttribute('value'), 'F8');200 setTimeout(async () => {201 await playBtn.click();202 assert.equal(await playBtn.getText(), 'pause');203 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));204 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));205 const ssBuffer2 = await driver.takeScreenshot();206 await utils.saveScreenshot(`${output}/${testFileName}-007-002`, ssBuffer2);207 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));208 const ssBuffer3 = await driver.takeScreenshot();209 await utils.saveScreenshot(`${output}/${testFileName}-007-003`, ssBuffer3);210 done();211 }, timeout)212 }, timeout)213 }, timeout)214 });215 it(`[${testFileName}-008] adjusts gain from 1 to 3 with step of 0.5 and play`, async (done) => {216 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));217 const btnenabled = await driver.wait(webdriver.until.elementIsEnabled(playBtn));218 if (btnenabled) {219 setTimeout(async () => {220 const gainInput = await driver.findElement(webdriver.By.id('gain-input'));221 const ssBuffer = await driver.takeScreenshot();222 await utils.saveScreenshot(`${output}/${testFileName}-008-001`, ssBuffer);223 for (let i = 0; i < 4; i++) {224 gainInput.sendKeys(webdriver.Key.ARROW_RIGHT);225 }226 await playBtn.click();227 setTimeout(async () => {228 const ssBuffer2 = await driver.takeScreenshot();229 await utils.saveScreenshot(`${output}/${testFileName}-008-002`, ssBuffer2);230 done();231 }, timeout)232 }, timeout)233 }234 });235 it(`[${testFileName}-009] Plays, pauses and resumes decoded and filtered audio using default filter from firebase`, async (done) => {236 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));237 setTimeout(async () => {238 //play239 await driver.wait(webdriver.until.elementIsEnabled(playBtn)).click();240 assert.equal(await playBtn.getText(), 'pause');241 const ssBuffer = await driver.takeScreenshot();242 await utils.saveScreenshot(`${output}/${testFileName}-009-001`, ssBuffer);243 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));244 //pause245 await driver.wait(webdriver.until.elementTextContains(txtTime, '5.'));246 await playBtn.click();247 assert.equal(await playBtn.getText(), 'resume')248 const ssBuffer2 = await driver.takeScreenshot();249 await utils.saveScreenshot(`${output}/${testFileName}-009-002`, ssBuffer2);250 //resume251 await playBtn.click();252 assert.equal(await playBtn.getText(), 'pause')253 const ssBuffer3 = await driver.takeScreenshot();254 await utils.saveScreenshot(`${output}/${testFileName}-009-003`, ssBuffer3);255 done();256 }, timeout);257 });258 it(`[${testFileName}-010] zoom 50px`, async (done) => {259 setTimeout(async () => {260 const ssBuffer = await driver.takeScreenshot();261 await utils.saveScreenshot(`${output}/${testFileName}-010-001`, ssBuffer);262 setTimeout(async () => {263 const zoomBtn50 = await driver.findElement(webdriver.By.id('zoom-btn-50')).click();264 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));265 assert.equal(await zoomTxt.getText(), '50');266 setTimeout(async () => {267 const ssBuffer = await driver.takeScreenshot();268 await utils.saveScreenshot(`${output}/${testFileName}-010-002`, ssBuffer);269 done();270 }, timeout)271 }, timeout);272 }, timeout);273 });274 it(`[${testFileName}-011] zoom 80px`, async (done) => {275 setTimeout(async () => {276 const ssBuffer = await driver.takeScreenshot();277 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);278 setTimeout(async () => {279 const zoomBtn50 = await driver.findElement(webdriver.By.id('zoom-btn-80')).click();280 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));281 assert.equal(await zoomTxt.getText(), '80');282 setTimeout(async () => {283 const ssBuffer = await driver.takeScreenshot();284 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);285 done();286 }, 4000)287 }, timeout);288 }, timeout);289 });290 it(`[${testFileName}-011] zoom 80px and plays`, async (done) => {291 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));292 setTimeout(async () => {293 const ssBuffer = await driver.takeScreenshot();294 await utils.saveScreenshot(`${output}/${testFileName}-011-001`, ssBuffer);295 setTimeout(async () => {296 await driver.findElement(webdriver.By.id('zoom-btn-80')).click();297 const zoomTxt = await driver.findElement(webdriver.By.id('zoom-txt'));298 assert.equal(await zoomTxt.getText(), '80');299 await playBtn.click();300 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));301 await driver.wait(webdriver.until.elementTextContains(txtTime, '19.'));302 const ssBuffer = await driver.takeScreenshot();303 await utils.saveScreenshot(`${output}/${testFileName}-011-002`, ssBuffer);304 done();305 }, timeout);306 }, timeout);307 });308 it(`[${testFileName}-012] clicks on canvas to test fast forward to 10th seconds and plays`, async (done) => {309 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));310 setTimeout(async () => {311 const ssBuffer = await driver.takeScreenshot();312 await utils.saveScreenshot(`${output}/${testFileName}-012-001`, ssBuffer);313 setTimeout(async () => {314 const actions = driver.actions({bridge: true});315 await actions.move({x: 340, y: 500, origin: webdriver.Origin.POINTER}).press().release(); //10th seconds316 await actions.perform();317 const ssBuffer2 = await driver.takeScreenshot();318 await utils.saveScreenshot(`${output}/${testFileName}-012-002`, ssBuffer2);319 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));320 await playBtn.click();321 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));322 assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);323 const ssBuffer3 = await driver.takeScreenshot();324 await utils.saveScreenshot(`${output}/${testFileName}-012-003`, ssBuffer3);325 done();326 }, timeout);327 }, timeout);328 });329 it(`[${testFileName}-013] Change to [Heart Filter], fast forward 10th seconds and play`, async (done) => {330 const playBtn = await driver.findElement(webdriver.By.id('play-btn'));331 await driver.wait(webdriver.until.elementIsEnabled(playBtn));332 setTimeout(async () => {333 const ssBuffer = await driver.takeScreenshot();334 await utils.saveScreenshot(`${output}/${testFileName}-013-001`, ssBuffer);335 setTimeout(async () => {336 const select = await driver.findElement(webdriver.By.id('filter-select'))337 await select.click();338 //before339 assert.equal(await select.getAttribute('value'), 'F0');340 const options = await driver.findElements(webdriver.By.tagName('option'));341 //changing to heart filter342 await options[4].click();343 assert.equal(await select.getAttribute('value'), 'F8');344 setTimeout(async () => {345 const actions = driver.actions({bridge: true});346 await actions.move({x: 340, y: 500, origin: webdriver.Origin.POINTER}).press().release(); //10th seconds347 await actions.perform();348 const ssBuffer2 = await driver.takeScreenshot();349 await utils.saveScreenshot(`${output}/${testFileName}-013-002`, ssBuffer2);350 const txtTime = await driver.findElement(webdriver.By.id('time-txt'));351 await playBtn.click();352 assert.isAtLeast(parseFloat(await txtTime.getText()), 10.0);353 await driver.wait(webdriver.until.elementTextContains(txtTime, '15.'));354 const ssBuffer3 = await driver.takeScreenshot();355 await utils.saveScreenshot(`${output}/${testFileName}-013-003`, ssBuffer3);356 done();357 }, timeout)358 }, timeout)359 }, timeout)360 });361 it(`[${testFileName}-014] resize window to 500px and audioplayer re-renders waveform and plugins`, async (done) => {362 setTimeout(async () => {363 const ssBuffer = await driver.takeScreenshot();364 await utils.saveScreenshot(`${output}/${testFileName}-014-001`, ssBuffer);365 await driver.manage().window().setRect({width: 500, height: 1000, x: 0, y: 0});366 setTimeout(async () => {367 const ssBuffer2 = await driver.takeScreenshot();368 await utils.saveScreenshot(`${output}/${testFileName}-014-002`, ssBuffer2);369 done();370 }, timeout);371 }, timeout);372 });373 it(`[${testFileName}-015] resize window to less than 300px and audioplayer will not re-renders waveform and plugins`, async (done) => {374 setTimeout(async () => {375 const ssBuffer = await driver.takeScreenshot();376 await utils.saveScreenshot(`${output}/${testFileName}-015-001`, ssBuffer);377 await driver.manage().window().setRect({width: 250, height: 1000, x: 0, y: 0});378 setTimeout(async () => {379 const ssBuffer2 = await driver.takeScreenshot();380 await utils.saveScreenshot(`${output}/${testFileName}-015-002`, ssBuffer2);381 done();382 }, timeout);383 }, timeout);384 });...

Full Screen

Full Screen

carousel.js

Source:carousel.js Github

copy

Full Screen

...12 await driver.wait(uiConnected(), timeouts.directLine);13 await pageObjects.sendMessageViaSendBox('carousel', { waitForSend: true });14 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);15 await driver.wait(allImagesLoaded(), timeouts.fetchImage);16 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);17 const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]'));18 await rightFlipper.click();19 await rightFlipper.click();20 await rightFlipper.click();21 await rightFlipper.click();22 // Wait for carousel animation to finish23 await driver.sleep(timeouts.ui);24 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);25 });26 test('4 attachments and message', async () => {27 const { driver, pageObjects } = await setupWebDriver();28 await driver.wait(uiConnected(), timeouts.directLine);29 await pageObjects.sendMessageViaSendBox('layout carousel', { waitForSend: true });30 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);31 await driver.wait(allImagesLoaded(), timeouts.fetchImage);32 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);33 const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]'));34 await rightFlipper.click();35 await rightFlipper.click();36 await rightFlipper.click();37 await rightFlipper.click();38 // Wait for carousel animation to finish39 await driver.sleep(timeouts.ui);40 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);41 });42 test('2 attachments', async () => {43 const { driver, pageObjects } = await setupWebDriver();44 await driver.wait(uiConnected(), timeouts.directLine);45 await pageObjects.sendMessageViaSendBox('layout double', { waitForSend: true });46 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);47 await driver.wait(allImagesLoaded(), timeouts.fetchImage);48 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);49 });50 test('2 attachments with wide screen', async () => {51 const { driver, pageObjects } = await setupWebDriver({ width: 640 });52 await driver.wait(uiConnected(), timeouts.directLine);53 await pageObjects.sendMessageViaSendBox('layout double', { waitForSend: true });54 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);55 await driver.wait(allImagesLoaded(), timeouts.fetchImage);56 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);57 });58 test('1 attachment', async () => {59 const { driver, pageObjects } = await setupWebDriver();60 await driver.wait(uiConnected(), timeouts.directLine);61 await pageObjects.sendMessageViaSendBox('layout single carousel', { waitForSend: true });62 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);63 await driver.wait(allImagesLoaded(), timeouts.fetchImage);64 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);65 });66 test('1 attachment with wide screen', async () => {67 const { driver, pageObjects } = await setupWebDriver({ width: 640 });68 await driver.wait(uiConnected(), timeouts.directLine);69 await pageObjects.sendMessageViaSendBox('layout single carousel', { waitForSend: true });70 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);71 await driver.wait(allImagesLoaded(), timeouts.fetchImage);72 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);73 });74});75describe('carousel with avatar initials', () => {76 const WEB_CHAT_PROPS = { styleOptions: { botAvatarInitials: 'BF', userAvatarInitials: 'WC' } };77 test('4 attachments and no message', async () => {78 const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });79 await driver.wait(uiConnected(), timeouts.directLine);80 await pageObjects.sendMessageViaSendBox('carousel', { waitForSend: true });81 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);82 await driver.wait(allImagesLoaded(), timeouts.fetchImage);83 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);84 const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]'));85 await rightFlipper.click();86 await rightFlipper.click();87 await rightFlipper.click();88 await rightFlipper.click();89 // Wait for carousel animation to finish90 await driver.sleep(timeouts.ui);91 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);92 });93 test('4 attachments and message', async () => {94 const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });95 await driver.wait(uiConnected(), timeouts.directLine);96 await pageObjects.sendMessageViaSendBox('layout carousel', { waitForSend: true });97 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);98 await driver.wait(allImagesLoaded(), timeouts.fetchImage);99 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);100 const rightFlipper = await driver.findElement(By.css('button[aria-label="Right"]'));101 await rightFlipper.click();102 await rightFlipper.click();103 await rightFlipper.click();104 await rightFlipper.click();105 // Wait for carousel animation to finish106 await driver.sleep(timeouts.ui);107 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);108 });109 test('2 attachments', async () => {110 const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });111 await driver.wait(uiConnected(), timeouts.directLine);112 await pageObjects.sendMessageViaSendBox('layout double', { waitForSend: true });113 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);114 await driver.wait(allImagesLoaded(), timeouts.fetchImage);115 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);116 });117 test('2 attachments with wide screen', async () => {118 const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS, width: 640 });119 await driver.wait(uiConnected(), timeouts.directLine);120 await pageObjects.sendMessageViaSendBox('layout double', { waitForSend: true });121 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);122 await driver.wait(allImagesLoaded(), timeouts.fetchImage);123 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);124 });125 test('1 attachment', async () => {126 const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS });127 await driver.wait(uiConnected(), timeouts.directLine);128 await pageObjects.sendMessageViaSendBox('layout single carousel', { waitForSend: true });129 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);130 await driver.wait(allImagesLoaded(), timeouts.fetchImage);131 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);132 });133 test('1 attachment with wide screen', async () => {134 const { driver, pageObjects } = await setupWebDriver({ props: WEB_CHAT_PROPS, width: 640 });135 await driver.wait(uiConnected(), timeouts.directLine);136 await pageObjects.sendMessageViaSendBox('layout single carousel', { waitForSend: true });137 await driver.wait(minNumActivitiesShown(2), timeouts.directLine);138 await driver.wait(allImagesLoaded(), timeouts.fetchImage);139 expect(await driver.takeScreenshot()).toMatchImageSnapshot(imageSnapshotOptions);140 });...

Full Screen

Full Screen

actionStepDef.js

Source:actionStepDef.js Github

copy

Full Screen

...12 try {13 const authors = await this.state.driver.findElements(By.xpath(xpaths["Authors references"]));14 for (const author of authors) {15 await author.click();16 const buffer = await this.state.driver.takeScreenshot();17 this.attach(buffer, 'image/png');18 }19 } catch (e) {20 console.log("Authors :" + e);21 }22}23export async function clickOn(element) {24 const result = await this.state.driver.findElement(By.xpath(xpaths[element]));25 await result.click();26 const buffer = await this.state.driver.takeScreenshot();27 this.attach(buffer, 'image/png');28}29Given(/^user navigates to "([^"]*)" page$/, {timeout: 50 * 1000}, async function (pageName) {30 try {31 if (pageName === "Home") {32 await this.state.driver.get(config.url)33 } else {34 await this.state.driver.get(`${config.url}/${pageName}`);35 }36 const buffer = await this.state.driver.takeScreenshot();37 this.attach(buffer, 'image/png');38 } catch (e) {39 console.log(e);40 }41});42//When section43When(/^list of articles is displayed$/, {timeout: 15 * 1000}, async function () {44 const result = await this.state.driver.findElements(By.xpath(xpaths["List of articles"]));45 this.data.listOfAticles = result.map((_, index) => index + 1);46 expect(result.length).not.equal(0);47 const buffer = await this.state.driver.takeScreenshot();48 this.attach(buffer, 'image/png');49});50When(/^user is on the Home page$/, async function () {51 const title = await this.state.driver.getTitle()52 expect(title).to.equal("Hive Articles");53 return title;54});55When(/^user clicks on "([^"]*)" from the list$/, {timeout: 30 * 1000}, async function (article) {56 try {57 const articleElement = await this.state.driver.findElement(By.xpath(xpaths[article]))58 const articleName = (await articleElement.getText());59 console.log("articleName: " + articleName);60 this.data.currentArticle.name = articleName;61 await articleElement.click();62 const buffer = await this.state.driver.takeScreenshot();63 this.attach(buffer, 'image/png');64 } catch (e) {65 console.log(e);66 }67});68When(/^user navigates to "([^"]*)"$/, {timeout: 30 * 1000}, async function (articleNumber) {69 await this.state.driver.get(`${config.url}articles/${articleNumber}`);70 const buffer = await this.state.driver.takeScreenshot();71 this.attach(buffer, 'image/png');72});73When(/^user navigates to subject "([^"]*)"$/, async function (subjectNumber) {74 await this.state.driver.get(`${config.url}subjects/${subjectNumber}`);75 const buffer = await this.state.driver.takeScreenshot();76 this.attach(buffer, 'image/png');77});78When(/^user clicks on 'Linked volume' of the random article$/, async function () {79 try {80 const volumeElement = await this.state.driver.findElement(By.xpath(xpaths["Random issue link"]));81 const volumeName = (await volumeElement.getText());82 console.log("volumeName: " + volumeName);83 this.data.currentVolume.name = volumeName;84 console.log("datastore: " + JSON.stringify(this.data, null, '\t'));85 await volumeElement.click();86 const buffer = await this.state.driver.takeScreenshot();87 this.attach(buffer, 'image/png');88 } catch (e) {89 console.log(e);90 }91});92When(/^user selects "([^"]*)"$/, {timeout: 15 * 1000}, async function (extraRef) {93 const elemMap = xpaths.downloadButtons94 expect(elemMap[extraRef]).to.be.a('string');95 const result = await this.state.driver.findElement(By.xpath(elemMap[extraRef]));96 await result.click();97});98When(/^user clicks on "([^"]*)" subject$/, async function (subject) {99 try {100 const result = await this.state.driver.findElement(By.linkText(subject));101 await result.click();102 const buffer = await this.state.driver.takeScreenshot();103 this.attach(buffer, 'image/png');104 } catch (e) {105 console.log(e);106 }107});108When(/^user searches for "([^"]*)"$/, async function (keys) {109 const result = await this.state.driver.findElement(By.xpath(xpaths["Search input"]))110 result.sendKeys(keys);111 const submit = await this.state.driver.findElement(By.xpath(xpaths["Search submit"]))112 await submit.click();113 const buffer = await this.state.driver.takeScreenshot();114 this.attach(buffer, 'image/png');115});116When(/^user selects "([^"]*)" checkbox$/, async function (element) {117 const result = await this.state.driver.findElement(By.xpath(xpaths.researchCategories[element]));118 await result.click();119 const buffer = await this.state.driver.takeScreenshot();120 this.attach(buffer, 'image/png');121});122When(/^user logs in to Mendeley$/, {timeout: 101 * 1000}, async function () {123 const username = await this.state.driver.findElement(By.xpath(xpaths.mendeley["Email"]));124 const continueButton = await this.state.driver.findElement(By.xpath(xpaths.mendeley["Continue"]));125 await username.sendKeys(process.env.mendeley_username);126 await continueButton.click();127 const password = await this.state.driver.findElement(By.xpath(xpaths.mendeley["Password"]));128 const submit = await this.state.driver.findElement(By.xpath(xpaths.mendeley["Continue"]));129 await password.sendKeys(process.env.mendeley_password);130 await submit.click();131});132When(/^user clicks on "([^"]*)" (button|menu item)$/, {timeout: 50 * 1000}, async function (elementName, type) {133 const result = await this.state.driver.findElement(By.xpath(xpaths.mendeley[elementName]));134 await result.click();135});136When(/^user clicks on issue group "([^"]*)"$/, async function (groupName) {137 const element = await this.state.driver.findElement(By.xpath("//h2[contains (text(),'" + groupName + "')]"));138 await element.click();139 const buffer = await this.state.driver.takeScreenshot();140 this.attach(buffer, 'image/png');141});142When(/^user clicks on author name$/, {timeout: 30 * 1000}, clickOnAuthorName);...

Full Screen

Full Screen

xcloud.spec.js

Source:xcloud.spec.js Github

copy

Full Screen

1describe('xCloud', () => {2 it('should not experience long webdriver calls', () => {3 // browser.getLogs('logcat');4 driver.startRecordingScreen();5 driver.takeScreenshot();6 driver.takeScreenshot();7 driver.getPageSource();8 driver.takeScreenshot();9 driver.getPageSource();10 driver.takeScreenshot();11 driver.getPageSource();12 driver.takeScreenshot();13 driver.stopRecordingScreen();14 driver.getCurrentPackage();15 driver.getCurrentActivity();16 driver.getPageSource();17 // browser.getLogs('logcat');18 driver.startRecordingScreen();19 driver.takeScreenshot();20 driver.getPageSource();21 driver.takeScreenshot();22 driver.getPageSource();23 driver.takeScreenshot();24 driver.getPageSource();25 driver.takeScreenshot();26 driver.getPageSource();27 // browser.getLogs('logcat');28 // NO STOPPING!!!!29 driver.startRecordingScreen();30 driver.takeScreenshot();31 driver.takeScreenshot();32 driver.getPageSource();33 driver.takeScreenshot();34 driver.getPageSource();35 driver.takeScreenshot();36 driver.getPageSource();37 driver.takeScreenshot();38 driver.stopRecordingScreen();39 driver.takeScreenshot();40 driver.getPageSource();41 // browser.getLogs('logcat');42 driver.startRecordingScreen();43 for(let i=0; i < 100; i++) {44 driver.pressKeyCode(69);45 }46 driver.takeScreenshot();47 driver.getPageSource();48 driver.takeScreenshot();49 driver.getPageSource();50 driver.takeScreenshot();51 driver.getPageSource();52 driver.stopRecordingScreen();53 driver.takeScreenshot();54 driver.getPageSource();55 // browser.getLogs('logcat');56 driver.startRecordingScreen();57 for(let i=0; i < 100; i++) {58 driver.pressKeyCode(69);59 }60 driver.takeScreenshot();61 driver.getPageSource();62 driver.takeScreenshot();63 driver.getPageSource();64 driver.takeScreenshot();65 driver.getPageSource();66 driver.stopRecordingScreen();67 driver.takeScreenshot();68 driver.getPageSource();69 driver.takeScreenshot();70 driver.getPageSource();71 driver.takeScreenshot();72 driver.getPageSource();73 // browser.getLogs('logcat');74 driver.startRecordingScreen();75 driver.takeScreenshot();76 driver.getPageSource();77 driver.stopRecordingScreen();78 driver.takeScreenshot();79 driver.getPageSource();80 // browser.getLogs('logcat');81 driver.startRecordingScreen();82 driver.takeScreenshot();83 driver.getPageSource();84 driver.takeScreenshot();85 driver.getPageSource();86 driver.takeScreenshot();87 driver.getPageSource();88 driver.stopRecordingScreen();89 driver.takeScreenshot();90 driver.getPageSource();91 driver.takeScreenshot();92 driver.getPageSource();93 driver.takeScreenshot();94 driver.getPageSource();95 // browser.getLogs('logcat');96 driver.startRecordingScreen();97 driver.takeScreenshot();98 driver.getPageSource();99 driver.stopRecordingScreen();100 driver.takeScreenshot();101 driver.getPageSource();102 driver.takeScreenshot();103 driver.getPageSource();104 driver.takeScreenshot();105 driver.getPageSource();106 driver.takeScreenshot();107 driver.getPageSource();108 driver.takeScreenshot();109 driver.getPageSource();110 driver.takeScreenshot();111 driver.getPageSource();112 driver.takeScreenshot();113 driver.getPageSource();114 driver.takeScreenshot();115 driver.getPageSource();116 driver.takeScreenshot();117 driver.getPageSource();118 // VERY STRANGE, NOW THERE IS A STOP119 driver.stopRecordingScreen();120 driver.getPageSource();121 // browser.getLogs('logcat');122 driver.startRecordingScreen();123 driver.takeScreenshot();124 driver.getPageSource();125 driver.stopRecordingScreen();126 driver.getPageSource();127 // browser.getLogs('logcat');128 driver.startRecordingScreen();129 driver.takeScreenshot();130 driver.getPageSource();131 driver.stopRecordingScreen();132 driver.getPageSource();133 // browser.getLogs('logcat');134 driver.startRecordingScreen();135 for(let i=0; i < 100; i++) {136 driver.pressKeyCode(69);137 }138 driver.takeScreenshot();139 driver.getPageSource();140 driver.stopRecordingScreen();141 driver.getPageSource();142 // browser.getLogs('logcat');143 driver.startRecordingScreen();144 driver.takeScreenshot();145 driver.getPageSource();146 driver.stopRecordingScreen();147 driver.getPageSource();148 // browser.getLogs('logcat');149 driver.startRecordingScreen();150 driver.takeScreenshot();151 driver.getPageSource();152 driver.stopRecordingScreen();153 driver.getPageSource();154 // browser.getLogs('logcat');155 driver.startRecordingScreen();156 driver.takeScreenshot();157 driver.getPageSource();158 driver.stopRecordingScreen();159 driver.getPageSource();160 // browser.getLogs('logcat');161 driver.startRecordingScreen();162 for(let i=0; i < 100; i++) {163 driver.pressKeyCode(69);164 }165 driver.takeScreenshot();166 driver.getPageSource();167 driver.stopRecordingScreen();168 driver.getPageSource();169 driver.takeScreenshot();170 driver.getPageSource();171 driver.getPageSource();172 driver.takeScreenshot();173 driver.getPageSource();174 driver.getPageSource();175 driver.takeScreenshot();176 driver.getPageSource();177 driver.getPageSource();178 driver.takeScreenshot();179 driver.getPageSource();180 driver.getPageSource();181 // browser.getLogs('logcat');182 });...

Full Screen

Full Screen

aboutFeatureStepDefs.js

Source:aboutFeatureStepDefs.js Github

copy

Full Screen

1import {Given, Then, When} from 'cucumber';2import {By} from 'selenium-webdriver';3Given(/^Microsim site Home page was loaded$/, {timeout: 60 * 1000}, async function () {4 const buffer = await this.state.driver.takeScreenshot();5 this.attach(buffer, 'image/png');6 await this.microsim.homepage.navigate();7 const buffer2 = await this.state.driver.takeScreenshot();8 this.attach(buffer2, 'image/png');9});10When(/^user click About link$/, async function () {11 const buffer2 = await this.state.driver.takeScreenshot();12 this.attach(buffer2, 'image/png');13 await this.microsim.homepage.clickAboutLink();14 const buffer3 = await this.state.driver.takeScreenshot();15 this.attach(buffer3, 'image/png');16});17Then(/^the About page is loaded$/, async function () {18 const buffer2 = await this.state.driver.takeScreenshot();19 this.attach(buffer2, 'image/png');20 await this.microsim.homepage.waitForTitle();21 const buffer3 = await this.state.driver.takeScreenshot();22 this.attach(buffer3, 'image/png');...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var asserters = wd.asserters;3var serverConfig = {4};5var driver = wd.promiseChainRemote(serverConfig);6var desired = {7};8 .init(desired)9 .click()10 .click()11 .click()12 .takeScreenshot()13 .then(function (image, err) {14 require('fs').writeFile('screen.png', image, 'base64', function (err) {15 console.log(err);16 });17 })18 .quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.android()).build();3driver.takeScreenshot().then(function(img) {4 require('fs').writeFile('out.png', img, 'base64', function(err) {5 console.log(err);6 });7});8from appium import webdriver9from selenium.webdriver.common.by import By10from selenium.webdriver.support.ui import WebDriverWait11from selenium.webdriver.support import expected_conditions as EC12driver.get_screenshot_as_file('out.png')13driver.takeScreenshot()14driver.get_screenshot_as_file()15driver.getScreenshotAs(OutputType.FILE)16driver.getScreenshotAs(OutputType.BASE64)17driver.getScreenshotAs(OutputType.BYTES)18driver.getScreenshotAs(OutputType.FILE)19The driver.getScreenshotAs(OutputType.FILE) method is used to take a screenshot of the current page and save it to a temporary file. This method returns a File object which can be used to save the screenshot to a desired location. The following code shows how to take screenshot of the screen using driver.getScreenshotAs(OutputType.FILE) method:20File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);21FileUtils.copyFile(scrFile, new File("path/to/screenshot.png"));22driver.getScreenshotAs(OutputType.BASE64)23The driver.getScreenshotAs(OutputType.BASE64) method is used to take a screenshot of the current page and save it to a temporary file. This method returns a String object which can be used to save the screenshot to a desired location. The following code shows how to take screenshot of the screen using driver.getScreenshotAs(OutputType.BASE

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var By = webdriver.By;3var until = webdriver.until;4var driver = new webdriver.Builder()5 .forBrowser('chrome')6 .build();7driver.findElement(By.name('q')).sendKeys('webdriver');8driver.findElement(By.name('btnG')).click();9driver.wait(until.titleIs('webdriver - Google Search'), 1000);10driver.takeScreenshot().then(function(data){11 require('fs').writeFile('test.png', data, 'base64', function(err){12 console.log(err);13 });14});15driver.quit();16Appium provides a method called takeScreenshot() that takes a screenshot of the current screen and returns it as a base64-encoded PNG. The following code shows how to use this method to take a screenshot:

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var driver = wd.remote("localhost", 4723);4var desiredCaps = {5};6driver.init(desiredCaps, function(error) {7 driver.takeScreenshot(function(error, screenshot) {8 if (error) {9 console.log(error);10 } else {11 var fs = require('fs');12 var stream = fs.createWriteStream("ScreenShot.png");13 stream.write(new Buffer(screenshot, 'base64'));14 stream.end();15 }16 });17});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var driver = wd.remote("localhost", 4723);3driver.init({4}, function() {5 driver.takeScreenshot(function(err, screenshot) {6 require('fs').writeFile('screenshot.png', screenshot, 'base64', function(err) {7 console.log(err);8 });9 });10});11driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3.forBrowser('chrome')4.build();5driver.takeScreenshot().then(function(base64png) {6var decodedImage = new Buffer(base64png, 'base64').toString('binary');7require('fs').writeFile('out.png', decodedImage, 'binary', function(err) {8if (err) throw err9console.log('File saved.')10});11});12driver.quit();13Your name to display (optional):14Your name to display (optional):15Hi @Priyanka, try this: driver.findElement(By.id("com.android.calculator2:id/digit_1")).click(); driver.findElement(By.id("com.android.calculator2:id/digit_2")).click(); driver.findElement(By.id("com.android.calculator2:id/plus")).click(); driver.findElement(By.id("com.android.calculator2:id/digit_3")).click(); driver.findElement(By.id("com.android.calculator2:id/digit_4")).click(); driver.findElement(By.id("com.android.calculator2:id/equal")).click(); driver.findElement(By.id("com.android.calculator2:id/result")).getText().then(function(result){ console.log(re

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful