How to use takeScreenshot method in Webdriverio

Best JavaScript code snippet using webdriverio-monorepo

CalendarVisual.spec.js

Source:CalendarVisual.spec.js Github

copy

Full Screen

...14 function singleDaySelection(){15 // initial loading16 it("should load test page", function () {17 _initCalendar("1");18 expect(takeScreenshot(oCal)).toLookAs("000_initial_Rendering"); // January 2015 rendered, 2 selected, no focus19 });20 it("should select a date by click", function () {21 _pressDate(sCalId, "20150120"); // 20 selected an focused (2 unselected)22 expect(takeScreenshot(oCal)).toLookAs("001_press_date");23 });24 it("should select a date in other month by click to other month", function () {25 _pressDate(sCalId, "20141230"); // month says on January 2015, 20. January focused and 30. December selected26 expect(takeScreenshot(oCal)).toLookAs("002_press_date_other_month");27 });28 it("should show the previous month by click on prev-button", function () {29 _initCalendar("1");30 _pressPrev(sCalId); // December 2014 shown, 31 focus31 expect(takeScreenshot(oCal)).toLookAs("003_press_previous");32 });33 it("should show the next month by click on next-button", function () {34 _initCalendar("1");35 _pressNext(sCalId); // February 2015 shown, 1 focus36 expect(takeScreenshot(oCal)).toLookAs("004_press_next");37 });38 it("should handle the month picker", function () {39 _initCalendar("1");40 _pressMonthPicker(sCalId); // month picker opened, January selected and focused41 expect(takeScreenshot(oCal)).toLookAs("005_MonthPicker");42 _pressPrev(sCalId); // year changed to 201443 expect(takeScreenshot(oCal)).toLookAs("006_MonthPicker_Previous");44 _pressMonth(sCalId, "1"); // month picker closed, February 2014 shown, 2 focused45 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios") {46 browser.actions().mouseMove(element(by.css("#B1"))).perform();47 expect(takeScreenshot(oCal)).toLookAs("007_MonthPicker_Select");48 }49 });50 it("should handle the year picker", function () {51 _initCalendar("1");52 _pressYearPicker(sCalId); // year Picker shown, 2015 selected and focused53 expect(takeScreenshot(oCal)).toLookAs("008_YearPicker");54 _pressPrev(sCalId); // years changed to 1985-2004, 1995 focused55 expect(takeScreenshot(oCal)).toLookAs("009_YearPicker_Previous");56 _pressYear(sCalId, "1990"); // year picker closed, January 1990 shown, 2 focused57 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios") {58 browser.actions().mouseMove(element(by.css("#B1"))).perform();59 expect(takeScreenshot(oCal)).toLookAs("010_YearPicker_Select");60 }61 });62 keyboardTest();63 }64 function keyboardTest(){65 it("should handle keyboard navigation", function () {66 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios" && browser.testrunner.runtime.browserName != "safari") {67 // only on desktop and not in Safari (sendKeys needs an Element in Safari, so test makes no sense there)68 _initCalendar("1");69 browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform(); // focus on 970 expect(takeScreenshot(oCal)).toLookAs("011_keyboard_Arrow_Down");71 browser.actions().sendKeys(protractor.Key.ARROW_RIGHT).perform(); // focus on 1072 expect(takeScreenshot(oCal)).toLookAs("012_keyboard_Arrow_Right");73 browser.actions().sendKeys(protractor.Key.ARROW_UP).perform(); // focus on 374 expect(takeScreenshot(oCal)).toLookAs("013_keyboard_Arrow_Up");75 browser.actions().sendKeys(protractor.Key.ARROW_LEFT).perform(); // focus on 276 expect(takeScreenshot(oCal)).toLookAs("014_keyboard_Arrow_Left");77 browser.actions().sendKeys(protractor.Key.ARROW_LEFT).perform(); // focus on 178 browser.actions().sendKeys(protractor.Key.ENTER).perform(); // 1 selected79 expect(takeScreenshot(oCal)).toLookAs("015_keyboard_Enter");80 browser.actions().sendKeys(protractor.Key.ARROW_LEFT).perform(); // switch to December, focus on 3181 expect(takeScreenshot(oCal)).toLookAs("016_keyboard_Arrow_Left_other_Month");82 browser.actions().sendKeys(protractor.Key.SPACE).perform(); // 31 selected83 expect(takeScreenshot(oCal)).toLookAs("017_keyboard_Space");84 browser.actions().sendKeys(protractor.Key.PAGE_UP).perform(); // switch to November, focus on 3085 expect(takeScreenshot(oCal)).toLookAs("018_keyboard_PAGE_Up");86 browser.actions().sendKeys(protractor.Key.PAGE_DOWN).perform(); // switch to December, focus on 3087 expect(takeScreenshot(oCal)).toLookAs("019_keyboard_PABE_Down");88 browser.actions().sendKeys(protractor.Key.TAB).perform(); // focus on month89 expect(takeScreenshot(oCal)).toLookAs("020_keyboard_Tab1");90 browser.actions().sendKeys(protractor.Key.TAB).perform(); // focus on year91 expect(takeScreenshot(oCal)).toLookAs("021_keyboard_Tab2");92 browser.actions().sendKeys(protractor.Key.TAB).perform(); // focus leaves calendar93 expect(takeScreenshot(oCal)).toLookAs("022_keyboard_Tab3");94 var sShiftTab = protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.TAB);95 browser.actions().sendKeys(sShiftTab).perform(); // focus on year96 expect(takeScreenshot(oCal)).toLookAs("023_keyboard_Shift_Tab1");97 if (browser.testrunner.runtime.browserName != "ie") {98 browser.actions().sendKeys(sShiftTab).perform(); // focus on month99 expect(takeScreenshot(oCal)).toLookAs("024_keyboard_Shift_Tab2");100 browser.actions().sendKeys(sShiftTab).perform(); // focus on 30101 expect(takeScreenshot(oCal)).toLookAs("025_keyboard_Shift_Tab3");102 } else {103 // shift+Tab don't work in selenium on IE on year and month button - So try to get to the December 30104 element(by.id("__page0-title")).click();105 browser.actions().sendKeys(protractor.Key.TAB).perform();106 }107 }108 }, iDefaultTimeout);109 it("should handle keyboard navigation for MonthPicker", function () {110 // MonthPicker111 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios" && browser.testrunner.runtime.browserName != "safari") {112 // only on desktop and not in Safari (sendKeys needs an Element in Safari, so test makes no sense there)113 browser.actions().sendKeys(protractor.Key.TAB).perform();114 browser.actions().sendKeys(protractor.Key.SPACE).perform(); // month picker open, focus on December115 expect(takeScreenshot(oCal)).toLookAs("026_keyboard_Month_Space");116 browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform(); // focus on March 2015117 expect(takeScreenshot(oCal)).toLookAs("027_keyboard_MonthPicker_Arrow_Down");118 browser.actions().sendKeys(protractor.Key.ARROW_RIGHT).perform(); // focus on April 2015119 expect(takeScreenshot(oCal)).toLookAs("028_keyboard_MonthPicker_Arrow_Right");120 browser.actions().sendKeys(protractor.Key.SPACE).perform(); // Month Picker closed, April displayed, focus on 30121 expect(takeScreenshot(oCal)).toLookAs("029_keyboard_MonthPicker_Space");122 browser.actions().sendKeys(protractor.Key.TAB).perform();123 browser.actions().sendKeys(protractor.Key.ENTER).perform(); // month picker open, focus on April124 expect(takeScreenshot(oCal)).toLookAs("030_keyboard_MonthPicker_Enter");125 browser.actions().sendKeys(protractor.Key.ARROW_UP).perform(); // focus on January126 expect(takeScreenshot(oCal)).toLookAs("031_keyboard_MonthPicker_Arrow_UP");127 browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); // Month Picker closed, January displayed, focus on 30128 expect(takeScreenshot(oCal)).toLookAs("032_keyboard_MonthPicker_Escape");129 }130 }, iDefaultTimeout);131 it("should handle keyboard navigation for YearPicker", function () {132 // YearPicker133 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios" && browser.testrunner.runtime.browserName != "safari") {134 // only on desktop and not in Safari (sendKeys needs an Element in Safari, so test makes no sense there)135 browser.actions().sendKeys(protractor.Key.TAB).perform();136 browser.actions().sendKeys(protractor.Key.TAB).perform();137 browser.actions().sendKeys(protractor.Key.SPACE).perform(); // year Picker open, focus on 2015138 expect(takeScreenshot(oCal)).toLookAs("033_keyboard_Year_Space");139 browser.actions().sendKeys(protractor.Key.ARROW_UP).perform(); // focus on 2011140 expect(takeScreenshot(oCal)).toLookAs("034_keyboard_YearPicker_Arrow_UP");141 browser.actions().sendKeys(protractor.Key.ARROW_LEFT).perform(); // focus on 2010142 expect(takeScreenshot(oCal)).toLookAs("035_keyboard_YearPicker_Arrow_Left");143 browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform(); // focus on 2014144 expect(takeScreenshot(oCal)).toLookAs("036_keyboard_YearPicker_Arrow_Down");145 browser.actions().sendKeys(protractor.Key.PAGE_UP).perform(); // years changed, focus on 1994146 expect(takeScreenshot(oCal)).toLookAs("037_keyboard_YearPicker_Page_UP");147 browser.actions().sendKeys(protractor.Key.ARROW_RIGHT).perform(); // focus on 1995148 expect(takeScreenshot(oCal)).toLookAs("038_keyboard_YearPicker_Arrow_Right");149 browser.actions().sendKeys(protractor.Key.SPACE).perform(); // Year Picker closed, January 1995 displayed, focus on 30150 expect(takeScreenshot(oCal)).toLookAs("039_keyboard_YearPicker_Space");151 browser.actions().sendKeys(protractor.Key.TAB).perform();152 browser.actions().sendKeys(protractor.Key.TAB).perform();153 browser.actions().sendKeys(protractor.Key.ENTER).perform(); // year Picker open, focus on 1995 (selected)154 expect(takeScreenshot(oCal)).toLookAs("040_keyboard_Year_ENTER");155 browser.actions().sendKeys(protractor.Key.PAGE_DOWN).perform(); // years changed, focus on 2015156 expect(takeScreenshot(oCal)).toLookAs("041_keyboard_YearPicker_Page_DOWN");157 browser.actions().sendKeys(protractor.Key.ARROW_RIGHT).perform();158 browser.actions().sendKeys(protractor.Key.ARROW_RIGHT).perform(); // focus on 2017159 expect(takeScreenshot(oCal)).toLookAs("042_keyboard_YearPicker_Arrow_Right2");160 browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform();161 browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform(); // years changed, focus on 2025162 expect(takeScreenshot(oCal)).toLookAs("043_keyboard_YearPicker_Arrow_Down2");163 browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); // Year Picker closed, January 1995 displayed, focus on 30164 expect(takeScreenshot(oCal)).toLookAs("044_keyboard_YearPicker_Escape");165 _initCalendar("1");166 }167 });168 it("YearRangePicker looks OK", function() {169 _pressYearPicker(sCalId); // click the year button to open YearPicker170 _pressYearPicker(sCalId); // click the year button again to open YearRangePicker171 expect(takeScreenshot(oCal)).toLookAs("045_year_range_picker_displayed");172 });173 }174 function twoTypes(){175 it("should show calendar with two types", function () {176 _initCalendar("4");177 expect(takeScreenshot(oCal)).toLookAs("050_two_types");178 });179 }180 function widthSet(){181 it("should show calendar with a width set", function () {182 _initCalendar("5");183 expect(takeScreenshot(oCal)).toLookAs("060_width_set");184 });185 }186 function intervalSelection(){187 it("should test interval selection", function () {188 _initCalendar("2");189 expect(takeScreenshot(oCal)).toLookAs("070_interval_selection_initial");190 _pressDate(sCalId, "20150120"); // old interval unselected, 20 selected and focused191 expect(takeScreenshot(oCal)).toLookAs("071_select_interval_start");192 _pressDate(sCalId, "20150122"); // 20-22 selected, 22 focused193 expect(takeScreenshot(oCal)).toLookAs("072_select_interval_end");194 _initCalendar("2");195 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios") {196 var sStartDateId = sCalId + "--Month0-" + "20150120";197 var sEndDateId = sCalId + "--Month0-" + "20150130";198 browser.actions().dragAndDrop(element(by.id(sStartDateId)), element(by.id(sEndDateId))).perform(); // old interval unselected, 20-30 selected, 30 focused199 expect(takeScreenshot(oCal)).toLookAs("073_select_interval_move");200 }201 });202 }203 function multiDaySelection(){204 it("should test multiple day selection", function () {205 _initCalendar("3");206 expect(takeScreenshot(oCal)).toLookAs("080_multiple_day_selection_initilal");207 _pressDate(sCalId, "20150120"); // 2 and 20 selected, 20 focused208 expect(takeScreenshot(oCal)).toLookAs("081_multiple_day_selection_press_date1");209 _pressDate(sCalId, "20150122"); // 2, 20, 22 selected, 22 focused210 expect(takeScreenshot(oCal)).toLookAs("082_multiple_day_selection_press_date2");211 _pressDate(sCalId, "20150120"); // 2 and 22 selected, 20 focused212 expect(takeScreenshot(oCal)).toLookAs("083_multiple_day_selection_press_date3");213 });214 }215 function multiMonthSelection(){216 it("should test multiple month display", function () {217 // we have multiple months displayed only on desktop, so skip the tests for mobile218 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios") {219 _initCalendar("6");220 expect(takeScreenshot(oCal)).toLookAs("090_multiple_month_initilal");221 _pressPrev(sCalId); // month switched to December 2014, 31 focused222 expect(takeScreenshot(oCal)).toLookAs("091_multiple_month_press_previous");223 _initCalendar("6");224 _pressNext(sCalId); // month switched to February 2015, 1 focused225 expect(takeScreenshot(oCal)).toLookAs("092_multiple_month_press_next");226 _initCalendar("6");227 _pressMonthPicker(sCalId); // month picker opened, January selected and focused228 expect(takeScreenshot(oCal)).toLookAs("093_multiple_month_MonthPicker");229 _pressMonth(sCalId, "1"); // month picker closed, February 28 focused230 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios") {231 browser.actions().mouseMove(element(by.css("#B1"))).perform();232 expect(takeScreenshot(oCal)).toLookAs("094_multiple_month_MonthPicker_Select");233 }234 _initCalendar("6");235 _pressYearPicker(sCalId); // year Picker shown, 2015 selected and focused236 expect(takeScreenshot(oCal)).toLookAs("095_multiple_month_YearPicker");237 _pressYear(sCalId, "2014"); // year picker closed, January-April 2014 shown, January 31 focused238 browser.actions().mouseMove(element(by.css("#B1"))).perform();239 expect(takeScreenshot(oCal)).toLookAs("096_multiple_month_YearPicker_Select");240 }241 }, iDefaultTimeout);242 it("should test multiple month display keyboard handling", function () {243 if (browser.testrunner.runtime.platformName != "android" && browser.testrunner.runtime.platformName != "ios" && browser.testrunner.runtime.browserName != "safari") {244 // only on desktop and not in Safari (sendKeys needs an Element in Safari, so test makes no sense there)245 _initCalendar("6");246 browser.actions().sendKeys(protractor.Key.ARROW_RIGHT).perform(); // focus on February 1247 expect(takeScreenshot(oCal)).toLookAs("097_multiple_month_keyboard_Arrow_Right");248 browser.actions().sendKeys(protractor.Key.ARROW_UP).perform(); // focus on January 25249 expect(takeScreenshot(oCal)).toLookAs("098_multiple_month_keyboard_Arrow_UP");250 browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform(); // focus on February 1251 expect(takeScreenshot(oCal)).toLookAs("099_multiple_month_keyboard_Arrow_Down");252 browser.actions().sendKeys(protractor.Key.ARROW_LEFT).perform(); // focus on January 31253 expect(takeScreenshot(oCal)).toLookAs("100_multiple_month_keyboard_Arrow_Left");254 browser.actions().sendKeys(protractor.Key.PAGE_UP).perform(); // switch to December-March, focus on December 31255 expect(takeScreenshot(oCal)).toLookAs("101_multiple_month_keyboard_Page_Up1");256 browser.actions().sendKeys(protractor.Key.PAGE_UP).perform(); // focus on November-February 30257 expect(takeScreenshot(oCal)).toLookAs("102_multiple_month_keyboard_Page_Up2");258 browser.actions().sendKeys(protractor.Key.PAGE_DOWN).perform(); // focus on December-March 30259 expect(takeScreenshot(oCal)).toLookAs("103_multiple_month_keyboard_Page_Down1");260 browser.actions().sendKeys(protractor.Key.PAGE_DOWN).perform(); // switch to January-April, focus on January 30261 expect(takeScreenshot(oCal)).toLookAs("103_multiple_month_keyboard_Page_Down2");262 }263 });264 it("sap.ui.unified.calendar.Header looks OK when chinese language is set and calendar has two months", function() {265 _initCalendar("7");266 expect(takeScreenshot(oCal)).toLookAs("104_month_displayed");267 _pressYearPicker(sCalId); // click the year button to open YearPicker268 expect(takeScreenshot(oCal)).toLookAs("105_year_picker_displayed");269 });270 it("sap.ui.unified.calendar.Header should test two months header button", function() {271 _initCalendar("8");272 expect(takeScreenshot(oCal)).toLookAs("106_month_displayed");273 _pressNext(sCalId); // Month switched to February - March274 expect(takeScreenshot(oCal)).toLookAs("107_february_march_displayed");275 _pressPrev(sCalId); // Month switch to January - February276 expect(takeScreenshot(oCal)).toLookAs("108_january_february_displayed");277 _pressMonthPicker(sCalId); //right month picker open, focus on January278 expect(takeScreenshot(oCal)).toLookAs("109_month_picker_displayed_focus_january");279 browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform();280 browser.actions().sendKeys(protractor.Key.ENTER).perform(); // Show month is April and May281 expect(takeScreenshot(oCal)).toLookAs("110_month_displayed_apr_may");282 _pressMonthPickerSecondHeader(sCalId); //left month picker open, focus on May283 expect(takeScreenshot(oCal)).toLookAs("111_month_picker_displayed_focus_may");284 browser.actions().sendKeys(protractor.Key.ARROW_UP).perform();285 browser.actions().sendKeys(protractor.Key.ARROW_LEFT).perform();286 browser.actions().sendKeys(protractor.Key.ENTER).perform(); // Show month December prev. year and January287 expect(takeScreenshot(oCal)).toLookAs("112_month_displayed_dec_jan");288 _pressPrev(sCalId); // Month switch to Nov. - Dec.289 expect(takeScreenshot(oCal)).toLookAs("113_november_december_displayed");290 _pressNext(sCalId); // Month swich to Dec. - Jan next year291 expect(takeScreenshot(oCal)).toLookAs("114_december_january_displayed");292 _pressNext(sCalId); // Month switch to Jan - Dec293 expect(takeScreenshot(oCal)).toLookAs("115_january_december_displayed");294 });295 }296 function _initCalendar(sVersion) {297 // initialize via Button function298 element(by.id("B" + sVersion)).click();299 oCal = element(by.id(sCalId));300 }301 function _pressDate(sCalendarId, sNewDate) {302 var sDateId = sCalendarId + "--Month0-" + sNewDate;303 element(by.id(sDateId)).click();304 }305 function _pressPrev(sCalendarId) {306 element(by.id(sCalendarId + "--Head-prev")).click();307 }...

Full Screen

Full Screen

CheckBox.spec.js

Source:CheckBox.spec.js Github

copy

Full Screen

1/*global describe,it,element,by,takeScreenshot,expect*/2describe("sap.m.CheckBox", function() {3 "use strict";4 it('should load test page',function(){5 expect(takeScreenshot()).toLookAs('initial');6 });7 // verify checkBox is checked and editable8 it('should click on the checked and editable checkbox', function() {9 expect(takeScreenshot(element(by.id('cb_selected_enabled')))).toLookAs('cb_selected_enabled_before_click');10 element(by.id('cb_selected_enabled')).click();11 expect(takeScreenshot(element(by.id('cb_selected_enabled')))).toLookAs('cb_selected_enabled_after_click');12 });13 // verify checkBox is disabled and not editable14 it('should click on the disabled checkbox', function() {15 expect(takeScreenshot(element(by.id('cb_selected_disabled')))).toLookAs('cb_selected_disabled');16 element(by.id('cb_selected_disabled')).click();17 expect(takeScreenshot(element(by.id('cb_selected_disabled')))).toLookAs('cb_selected_disabled');18 });19 // verify checkBox is enabled and editable20 it('should click on the enabled and deselected checkbox', function() {21 expect(takeScreenshot(element(by.id('cb_deselected_enabled')))).toLookAs('cb_deselected_enabled_before_click');22 element(by.id('cb_deselected_enabled')).click();23 expect(takeScreenshot(element(by.id('cb_deselected_enabled')))).toLookAs('cb_deselected_enabled_after_click');24 });25 // verify checkBox is disabled and deselected26 it('should click on the disabled and deselected checkbox', function() {27 expect(takeScreenshot(element(by.id('cb_disabled_deselected')))).toLookAs('disabled_deselected');28 element(by.id('cb_disabled_deselected')).click();29 expect(takeScreenshot(element(by.id('cb_disabled_deselected')))).toLookAs('disabled_deselected');30 });31 // verify checkbox'es label size32 it('should check the label size in the checkbox', function() {33 expect(takeScreenshot(element(by.id('cb_with_label_size-label')))).toLookAs('checkbox_label');34 });35 // verify checkBox is not editable36 it('should click on the not editable checkbox', function() {37 expect(takeScreenshot(element(by.id('cb_not_editable')))).toLookAs('not_editable_before_click');38 element(by.id('cb_not_editable')).click();39 expect(takeScreenshot(element(by.id('cb_not_editable')))).toLookAs('not_editable_after_click');40 });41 // verify checkBox is display only42 it('should click on the display only checkbox', function() {43 expect(takeScreenshot(element(by.id('cb_display_only')))).toLookAs('cb_display_only');44 expect(takeScreenshot(element(by.id('cb_display_only_checked')))).toLookAs('cb_display_only_checked');45 });46 // verify warning checkBox is not selected and editable47 it('should click on the editable warning checkbox', function() {48 expect(takeScreenshot(element(by.id('cb_warning_deselected')))).toLookAs('warning_editable_before_click');49 element(by.id('cb_warning_deselected')).click();50 expect(takeScreenshot(element(by.id('cb_warning_deselected')))).toLookAs('warning_editable_after_click');51 });52 // verify warning checkBox is selected and editable53 it('should click on the editable selected warning checkbox', function() {54 expect(takeScreenshot(element(by.id('cb_warning_selected')))).toLookAs('warning_selected_editable_before_click');55 element(by.id('cb_warning_selected')).click();56 expect(takeScreenshot(element(by.id('cb_warning_selected')))).toLookAs('warning_selected_editable_after_click');57 });58 // verify warning checkBox is selected and not editable59 it('should click on the not editable selected warning checkbox', function() {60 expect(takeScreenshot(element(by.id('cb_warning_selected_disabled')))).toLookAs('warning_selected_disabled_before');61 element(by.id('cb_warning_selected_disabled')).click();62 expect(takeScreenshot(element(by.id('cb_warning_selected_disabled')))).toLookAs('warning_selected_disabled_after');63 });64 // verify error checkBox is not selected and editable65 it('should click on the editable error checkbox', function() {66 expect(takeScreenshot(element(by.id('cb_error_deselected')))).toLookAs('error_editable_before_click');67 element(by.id('cb_error_deselected')).click();68 expect(takeScreenshot(element(by.id('cb_error_deselected')))).toLookAs('error_editable_after_click');69 });70 // verify error checkBox is selected and editable71 it('should click on the editable selected error checkbox', function() {72 expect(takeScreenshot(element(by.id('cb_error_selected')))).toLookAs('error_selected_editable_before_click');73 element(by.id('cb_error_selected')).click();74 expect(takeScreenshot(element(by.id('cb_error_selected')))).toLookAs('error_selected_editable_after_click');75 });76 // verify error checkBox is selected and not editable77 it('should click on the not editable selected error checkbox', function() {78 expect(takeScreenshot(element(by.id('cb_error_selected_disabled')))).toLookAs('error_selected_disabled_after');79 element(by.id('cb_error_selected_disabled')).click();80 expect(takeScreenshot(element(by.id('cb_error_selected_disabled')))).toLookAs('error_selected_disabled_before');81 });82 // verify the checkBox enabled/disabled the checkBox in the toolbar83 it('should disable the checkbox in the toolbar', function() {84 expect(takeScreenshot(element(by.id('cb_in_toolbar')))).toLookAs('enabled_in_toolbar');85 element(by.id('cb_enable_disable_toolbar')).click();86 expect(takeScreenshot(element(by.id('cb_in_toolbar')))).toLookAs('disabled_in_toolbar');87 });88 // verify focused checkBox in a simple form has visible focus outline89 it('should click on the checkbox in the simple form', function() {90 element(by.id('cb_in_a_form')).click();91 expect(takeScreenshot(element(by.id('sf_with_checkbox')))).toLookAs('focused_in_simple_form');92 });...

Full Screen

Full Screen

quality_assurance.js

Source:quality_assurance.js Github

copy

Full Screen

...3import { createUserRole } from '../testcafe/helpers/roles'4import fetchSandbox from '../testcafe/helpers/sandboxes'5fixture('Quality Assurance,').page(ROOT_PATH)6test('captures d’écran de toutes les pages du site', async () => {7 await takeScreenshot('connexion')8 await takeScreenshot('mot-de-passe-perdu')9 await takeScreenshot('inscription')10 await takeScreenshot('inscription/confirmation')11 const { user } = await fetchSandbox(12 'pro_03_offerers',13 'get_existing_pro_validated_user_with_validated_offerer_validated_user_offerer'14 )15 await t.useRole(createUserRole(user))16 await takeScreenshot('404')17 await t18 .navigateTo('/accueil')19 .takeScreenshot(optionsOfScreenshot('accueil'))20 .click(Selector('button').withText('Fred Leopold'))21 .takeScreenshot(optionsOfScreenshot('menu'))22 const token = Selector('label').withText('Contremarque')23 await t24 .navigateTo('/guichet')25 .typeText(token, 'FAAKEE', { replace: true })26 .takeScreenshot(optionsOfScreenshot('guichet-FAAKEE'))27 await t28 .navigateTo('/guichet')29 .typeText(token, '100004', { replace: true })30 .takeScreenshot(optionsOfScreenshot('guichet'))31 await t32 .navigateTo('/offres')33 .click(Selector('input[type="checkbox"]'))34 .click(Selector('.field-date-end .period-filter-input'))35 .takeScreenshot(optionsOfScreenshot('offres'))36 .typeText(Selector('label').withText('Nom de l’offre ou ISBN'), 'search without result')37 .click(Selector('button').withText('Lancer la recherche'))38 .takeScreenshot(optionsOfScreenshot('offres-search-without-result'))39 await t40 .navigateTo('/offres')41 .click(Selector('table a'))42 .takeScreenshot(optionsOfScreenshot('offre-edition'))43 .click(Selector('.of-placeholder'))44 .click(Selector('.tna-toggle'))45 .takeScreenshot(optionsOfScreenshot('thumbnail-upload-from-computer'))46 .click(Selector('.thumbnail-dialog .bc-step:not(.active) a'))47 .takeScreenshot(optionsOfScreenshot('thumbnail-upload-from-url'))48 .typeText(49 Selector('.thumbnail-dialog .tnf-form input[name="url"]'),50 'https://pass.culture.fr/wp-content/uploads/2020/11/N_PASS_CULTURE_HD.png'51 )52 .click(Selector('.thumbnail-dialog .tnf-url-button'))53 .takeScreenshot(optionsOfScreenshot('thumbnail-credit'))54 .click(Selector('.thumbnail-dialog .tnd-actions .primary-button'))55 .takeScreenshot(optionsOfScreenshot('thumbnail-image-editor'))56 .click(Selector('.thumbnail-dialog .tnd-actions .primary-button'))57 .takeScreenshot(optionsOfScreenshot('thumbnail-preview'))58 .click(Selector('.thumbnail-dialog .tnd-actions .primary-button'))59 .click(Selector('a').withText('Stock et prix'))60 .takeScreenshot(optionsOfScreenshot('offre-stocks'))61 await t62 .navigateTo('/offres/creation')63 .click(Selector('select').withText('Choisir un type'))64 .click(Selector('select option').withText('Jeux - abonnements'))65 .typeText(Selector('label').withText("Titre de l'offre"), 'Un titre d’offre')66 .click(Selector('select').withText('Sélectionnez une structure'))67 .click(Selector('select option').withText('Club Dorothy'))68 .click(Selector('select').withText('Sélectionnez un lieu'))69 .click(Selector('select option').withText('Maison de la Brique'))70 .typeText(Selector('label').withText('URL d’accès à l’offre'), 'https://example.com')71 .click(Selector('input[name="noDisabilityCompliant"]'))72 .takeScreenshot(optionsOfScreenshot('offre-creation'))73 .click(Selector('button').withText('Enregistrer et passer aux stocks'))74 .click(Selector('button').withText('Ajouter un stock'))75 .takeScreenshot(optionsOfScreenshot('offre-stocks'))76 .click(Selector('button').withText('Enregistrer'))77 .takeScreenshot(optionsOfScreenshot('offre-confirmation'))78 await t79 .navigateTo('/reservations')80 .click(Selector('img[alt="Filtrer par statut"]'))81 .takeScreenshot(optionsOfScreenshot('reservations'))82 .typeText(Selector(`input[placeholder="Rechercher par nom d'offre"]`), 'search without result')83 .takeScreenshot(optionsOfScreenshot('reservations-search-without-result'))84 await t85 .navigateTo('/profil')86 .takeScreenshot(optionsOfScreenshot('profil'))87 .click(Selector('button').withText('Enregistrer'))88 .takeScreenshot(optionsOfScreenshot('profil-success-banner'))89 await t90 .navigateTo('/structures')91 .takeScreenshot(optionsOfScreenshot('structures'))92 .click(Selector('a').withText('Club Dorothy'))93 .takeScreenshot(optionsOfScreenshot('structure'))94 .click(Selector('a').withText('+ Ajouter un lieu'))95 .takeScreenshot(optionsOfScreenshot('lieu-creation'))96 .click(Selector('button').withText('Annuler'))97 .click(Selector('a').withText('Maison de la Brique'))98 .takeScreenshot(optionsOfScreenshot('lieu'))99 .click(Selector('a').withText('Modifier le lieu'))100 .takeScreenshot(optionsOfScreenshot('lieu-edition'))101 await takeScreenshot('structures?mots-cles=search-without-result')102 await takeScreenshot('structures/creation')103 await takeScreenshot('styleguide')104 await takeScreenshot('remboursements')105 // TODO: Pourquoi vois-je du JS ?106 await takeScreenshot('remboursements/detail')107})108const takeScreenshot = async path => {109 await t.navigateTo(`/${path}`).takeScreenshot(optionsOfScreenshot(path))110}111const optionsOfScreenshot = path => ({112 path: `branch/${path.replace(/(\/|\?|=)/g, '-')}.png`,113 fullPage: true,...

Full Screen

Full Screen

TakeScreenshots.js

Source:TakeScreenshots.js Github

copy

Full Screen

...16 browser.init();17 browser.waitForElementVisible("body");18 //----- Login page -----19 pageId = "loginPage";20 takeScreenshot(browser, i++, `${pageId}`);21 browser.lskLogin();22 //----- Invoice index page -----23 pageId = "invoiceIndexPage";24 takeScreenshot(browser, i++, `${pageId}`);25 browser.lskClick(`#${pageId}MenuActivator`);26 browser.lskClick(`#${pageId}AddInvoiceMenuItem`);27 takeScreenshot(browser, i++, `${pageId}AddInvoiceDialog`);28 browser.lskClick(`#${pageId}AddInvoiceDialogCancelButton`);29 browser.lskClick(`#${pageId}Table tbody tr td:nth-child(9) .mdi-delete`);30 takeScreenshot(browser, i++, `${pageId}DeleteInvoiceDialog`);31 browser.lskClick(`#${pageId}DeleteInvoiceDialogCancelButton`);32 browser.lskClick(`#${pageId}Table tbody tr td:nth-child(9) .mdi-monitor`);33 //----- Invoice show page -----34 pageId = "invoiceShowPage";35 takeScreenshot(browser, i++, `${pageId}`);36 browser.lskClick(`#${pageId}MenuActivator`);37 browser.lskClick(`#${pageId}EditInvoiceMenuItem`);38 takeScreenshot(browser, i++, `${pageId}EditInvoiceDialog`);39 browser.lskClick(`#${pageId}EditInvoiceDialogCancelButton`);40 browser.lskClick(`#${pageId}MenuActivator`);41 browser.lskClick(`#${pageId}EditInvoiceCustomerMenuItem`);42 takeScreenshot(browser, i++, `${pageId}EditInvoiceCustomerDialog`);43 browser.lskClick(`#${pageId}EditInvoiceCustomerDialogCancelButton`);44 browser.lskClick(`#${pageId}MenuActivator`);45 browser.lskClick(`#${pageId}EditInvoiceBillerMenuItem`);46 takeScreenshot(browser, i++, `${pageId}EditInvoiceBillerDialog`);47 browser.lskClick(`#${pageId}EditInvoiceBillerDialogCancelButton`);48 browser.lskClick(`#${pageId}InvoiceLineMenuActivator`);49 browser.lskClick(`#${pageId}AddInvoiceLineMenuItem`);50 takeScreenshot(browser, i++, `${pageId}AddInvoiceLineDialog`);51 browser.lskClick(`#${pageId}AddInvoiceLineDialogCancelButton`);52 browser.lskClick(`#${pageId}InvoiceLineTable tbody tr td:nth-child(7) .mdi-delete`);53 takeScreenshot(browser, i++, `${pageId}DeleteInvoiceLineDialog`);54 browser.lskClick(`#${pageId}DeleteInvoiceLineDialogCancelButton`);55 browser.lskClick(`#${pageId}InvoiceLineTable tbody tr td:nth-child(7) .mdi-pencil`);56 takeScreenshot(browser, i++, `${pageId}EditInvoiceLineDialog`);57 browser.lskClick(`#${pageId}EditInvoiceLineDialogCancelButton`);58 browser.lskClick(`#customerTab`);59 //----- Customer index page -----60 pageId = "customerIndexPage";61 browser.lskClick(`#${pageId}Title`);62 takeScreenshot(browser, i++, `${pageId}`);63 browser.lskClick(`#${pageId}MenuActivator`);64 browser.lskClick(`#${pageId}AddCustomerMenuItem`);65 takeScreenshot(browser, i++, `${pageId}AddCustomerDialog`);66 browser.lskClick(`#${pageId}AddCustomerDialogCancelButton`);67 browser.lskClick(`#${pageId}Table tbody tr td:nth-child(5) .mdi-delete`);68 takeScreenshot(browser, i++, `${pageId}DeleteCustomerDialog`);69 browser.lskClick(`#${pageId}DeleteCustomerDialogCancelButton`);70 browser.lskClick(`#${pageId}Table tbody tr td:nth-child(5) .mdi-monitor`);71 //----- Customer show page -----72 pageId = "customerShowPage";73 takeScreenshot(browser, i++, `${pageId}`);74 browser.lskClick(`#${pageId}MenuActivator`);75 browser.lskClick(`#${pageId}EditCustomerMenuItem`);76 takeScreenshot(browser, i++, `${pageId}EditCustomerDialog`);77 browser.lskClick(`#${pageId}EditCustomerDialogCancelButton`);78 browser.lskClick(`#billerTab`);79 //----- Biller index page -----80 pageId = "billerIndexPage";81 browser.lskClick(`#${pageId}Title`);82 takeScreenshot(browser, i++, `${pageId}`);83 browser.lskClick(`#${pageId}MenuActivator`);84 browser.lskClick(`#${pageId}AddBillerMenuItem`);85 takeScreenshot(browser, i++, `${pageId}AddBillerDialog`);86 browser.lskClick(`#${pageId}AddBillerDialogCancelButton`);87 browser.lskClick(`#${pageId}Table tbody tr td:nth-child(7) .mdi-delete`);88 takeScreenshot(browser, i++, `${pageId}DeleteBillerDialog`);89 browser.lskClick(`#${pageId}DeleteBillerDialogCancelButton`);90 browser.lskClick(`#${pageId}Table tbody tr td:nth-child(7) .mdi-monitor`);91 //----- Biller show page -----92 pageId = "billerShowPage";93 takeScreenshot(browser, i++, `${pageId}`);94 browser.lskClick(`#${pageId}MenuActivator`);95 browser.lskClick(`#${pageId}EditBillerMenuItem`);96 takeScreenshot(browser, i++, `${pageId}EditBillerDialog`);97 browser.end();98 },...

Full Screen

Full Screen

test-admin-navigate-sections.js

Source:test-admin-navigate-sections.js Github

copy

Full Screen

1describe("verify navigation of admin sections", function() {2 it("should should navigate through admin sections", async function() {3 await browser.gl.utils.login_admin();4 await element.all(by.cssContainingText("a", "Home")).first().click();5 await browser.gl.utils.takeScreenshot("admin/home.png");6 await element.all(by.cssContainingText("a", "Changelog")).first().click();7 await browser.gl.utils.takeScreenshot("admin/changelog.png");8 await element.all(by.cssContainingText("a", "License")).first().click();9 await browser.gl.utils.takeScreenshot("admin/license.png");10 await element.all(by.cssContainingText("a", "Site settings")).first().click();11 await element.all(by.cssContainingText("a", "Main configuration")).first().click();12 await browser.gl.utils.takeScreenshot("admin/site_settings_main_configuration.png");13 await browser.gl.utils.takeScreenshot("admin/site_settings_logo_detail.png", element(by.id("Content")));14 await element.all(by.cssContainingText("a", "Theme customization")).first().click();15 await browser.gl.utils.takeScreenshot("admin/site_settings_theme_customization.png");16 await element.all(by.cssContainingText("a", "Files")).first().click();17 await browser.gl.utils.takeScreenshot("admin/site_settings_files.png");18 await element.all(by.cssContainingText("a", "Languages")).first().click();19 await browser.gl.utils.takeScreenshot("admin/site_settings_languages.png");20 await browser.gl.utils.takeScreenshot("admin/site_settings_languages_detail.png", element(by.id("Content")));21 await element.all(by.cssContainingText("a", "Text customization")).first().click();22 await browser.gl.utils.takeScreenshot("admin/site_settings_text_customization.png");23 await element.all(by.cssContainingText("a", "Users")).first().click();24 await browser.gl.utils.takeScreenshot("admin/users.png");25 await element.all(by.cssContainingText("a", "Questionnaires")).first().click();26 await browser.gl.utils.takeScreenshot("admin/questionnaires.png");27 await element.all(by.cssContainingText("a", "Question templates")).first().click();28 await browser.gl.utils.takeScreenshot("admin/question_templates.png");29 await element.all(by.cssContainingText("a", "Contexts")).first().click();30 await browser.gl.utils.takeScreenshot("admin/contexts.png");31 await element.all(by.cssContainingText("a", "Case management")).first().click();32 await browser.gl.utils.takeScreenshot("admin/report_statuses.png");33 await element.all(by.cssContainingText("a", "Notification settings")).first().click();34 await element.all(by.cssContainingText("a", "Main configuration")).first().click();35 await browser.gl.utils.takeScreenshot("admin/notification_settings.png");36 await browser.gl.utils.takeScreenshot("admin/notification_settings_detail.png", element(by.id("Content")));37 await element.all(by.cssContainingText("a", "Notification templates")).first().click();38 await browser.gl.utils.takeScreenshot("admin/notification_templates.png");39 await element.all(by.cssContainingText("a", "Network settings")).first().click();40 await element.all(by.cssContainingText("a", "Tor")).first().click();41 await browser.gl.utils.takeScreenshot("admin/tor.png");42 await element.all(by.cssContainingText("a", "HTTPS")).first().click();43 await browser.gl.utils.takeScreenshot("admin/https.png");44 await element.all(by.cssContainingText("a", "Access control")).first().click();45 await browser.gl.utils.takeScreenshot("admin/access_control.png");46 await element.all(by.cssContainingText("a", "URL redirects")).first().click();47 await browser.gl.utils.takeScreenshot("admin/url_redirects.png");48 await element.all(by.cssContainingText("a", "Sites management")).first().click();49 await browser.gl.utils.takeScreenshot("admin/sites_management_sites.png");50 await element(by.cssContainingText("a", "Options")).click();51 await browser.gl.utils.takeScreenshot("admin/sites_management_options.png");52 await element.all(by.cssContainingText("a", "Advanced settings")).first().click();53 await element.all(by.cssContainingText("a", "Main configuration")).first().click();54 await browser.gl.utils.takeScreenshot("admin/advanced_settings.png");55 await element.all(by.cssContainingText("a", "Anomaly detection thresholds")).first().click();56 await browser.gl.utils.takeScreenshot("admin/anomaly_thresholds.png");57 await element.all(by.cssContainingText("a", "Audit log")).first().click();58 await browser.gl.utils.takeScreenshot("admin/audit_log.png");59 await element.all(by.cssContainingText("a", "Users")).get(1).click();60 await browser.gl.utils.takeScreenshot("admin/audit_log_users.png");61 await element.all(by.cssContainingText("a", "Reports")).first().click();62 await browser.gl.utils.takeScreenshot("admin/audit_log_reports.png");63 await element.all(by.cssContainingText("a", "Scheduled jobs")).first().click();64 await browser.gl.utils.takeScreenshot("admin/audit_log_scheduled_jobs.png");65 });...

Full Screen

Full Screen

page.spec.js

Source:page.spec.js Github

copy

Full Screen

...27 const pageTitle = faker.random.word();28 const pageContent = faker.lorem.lines(1);29 let counter = 0;30 const slug = "PageCreated";31 async function takeScreenshot(slug) {32 await page.screenshot({33 path: `${pathImages}/${slug}${counter++}.jpg`,34 });35 }36 await pagePageObject.createPage(page, slug, takeScreenshot);37 await pagePageObject.addContent(38 page,39 pageTitle,40 pageContent,41 slug,42 takeScreenshot43 );44 await pagePageObject.publishPage(page, slug, takeScreenshot);45 await expect(page).toMatch("Published");46 await page.click('a[href="#/pages/"]');47 await new Promise((r) => setTimeout(r, 1000));48 await page.click(".gh-notification-close");49 await expect(page).toMatch(pageTitle);50 });51 it("Create Page and schedule it successfully", async () => {52 const pageTitle = faker.random.word();53 const pageContent = faker.lorem.lines(1);54 let counter = 0;55 const slug = "PageScheduled";56 async function takeScreenshot(slug) {57 await page.screenshot({58 path: `${pathImages}/${slug}${counter++}.jpg`,59 });60 }61 await pagePageObject.createPage(page, slug, takeScreenshot);62 await pagePageObject.addContent(63 page,64 pageTitle,65 pageContent,66 slug,67 takeScreenshot68 );69 await pagePageObject.schedulePage(page, slug, takeScreenshot);70 await expect(page).toMatch("Scheduled");71 await page.click('a[href="#/pages/"]');72 await new Promise((r) => setTimeout(r, 1000));73 await page.click(".gh-notification-close");74 await expect(page).toMatch(pageTitle);75 });76 it("Create draft Page", async () => {77 const pageTitle = faker.random.word();78 const pageContent = faker.lorem.lines(1);79 let counter = 0;80 const slug = "PageDraft";81 async function takeScreenshot(slug) {82 await page.screenshot({83 path: `${pathImages}/${slug}${counter++}.jpg`,84 });85 }86 await pagePageObject.createPage(page, slug, takeScreenshot);87 await pagePageObject.addContent(88 page,89 pageTitle,90 pageContent,91 slug,92 takeScreenshot93 );94 await page.click('a[href="#/pages/"]');95 await new Promise((r) => setTimeout(r, 1000));96 await expect(page).toMatch(pageTitle);97 });98 it("Create Page, try to edit the first page but discard changes", async () => {99 const pageTitle = faker.random.word();100 const pageContent = faker.lorem.lines(1);101 const pageTitleEdit = faker.random.word();102 let counter = 0;103 const slug = "PageDiscardChanges";104 async function takeScreenshot(slug) {105 await page.screenshot({106 path: `${pathImages}/${slug}${counter++}.jpg`,107 });108 }109 await pagePageObject.createPage(page, slug, takeScreenshot);110 await pagePageObject.addContent(111 page,112 pageTitle,113 pageContent,114 slug,115 takeScreenshot116 );117 await pagePageObject.publishPage(page, slug, takeScreenshot);118 await expect(page).toMatch("Published");...

Full Screen

Full Screen

takeScreenshot.spec.js

Source:takeScreenshot.spec.js Github

copy

Full Screen

...10});11it("returns a buffer containing the result of 'takeScreenshot' on the Appium Service", async () => {12 const screenshot = "dGVzdA==";13 jest.spyOn(appiumService, "takeScreenshot").mockResolvedValue(screenshot);14 const result = await device.takeScreenshot();15 expect(result).toBeInstanceOf(Buffer);16 expect(result.toString("base64")).toEqual(screenshot);17 expect(appiumService.takeScreenshot).toHaveBeenCalledTimes(1);18});19it("stores the screenshot on disk if a 'filePath' is configured", async () => {20 const filePath = "some/path";21 jest.spyOn(appiumService, "takeScreenshot").mockResolvedValue("dGVzdA==");22 jest.spyOn(fs, "writeFile").mockImplementation((path, data, cb) => cb());23 const buffer = await device.takeScreenshot({ filePath });24 expect(fs.writeFile).toHaveBeenCalledWith(filePath, buffer, expect.any(Function));25});26it("throws an ActionError for Appium request errors", async () => {27 const error = new AppiumError("Request error.", 3);28 jest.spyOn(appiumService, "takeScreenshot").mockRejectedValue(error);29 expect.assertions(3);30 try {31 await device.takeScreenshot();32 } catch (err) {33 expect(err).toBeInstanceOf(ActionError);34 expect(err).toHaveProperty("message", "Failed to take screenshot.");35 }36 expect(appiumService.takeScreenshot).toHaveBeenCalledTimes(1);37});38it("throws an ActionError if it is unable to store on disk when a 'filePath' is configured", async () => {39 const error = new Error("File system error.");40 jest.spyOn(appiumService, "takeScreenshot").mockResolvedValue("dGVzdA==");41 jest.spyOn(fs, "writeFile").mockImplementation((path, data, cb) => cb(error));42 expect.assertions(4);43 try {44 await device.takeScreenshot({ filePath: "some/path" });45 } catch (err) {46 expect(err).toBeInstanceOf(ActionError);47 expect(err).toHaveProperty("message", "Failed to store screenshot on disk.");48 }49 expect(appiumService.takeScreenshot).toHaveBeenCalledTimes(1);50 expect(fs.writeFile).toHaveBeenCalledTimes(1);51});52it("propagates other types of errors", async () => {53 const error = new Error("Something went wrong.");54 jest.spyOn(appiumService, "takeScreenshot").mockRejectedValue(error);55 expect.assertions(3);56 try {57 await device.takeScreenshot();58 } catch (err) {59 expect(err).toBeInstanceOf(error.constructor);60 expect(err).toHaveProperty("message", error.message);61 }62 expect(appiumService.takeScreenshot).toHaveBeenCalledTimes(1);...

Full Screen

Full Screen

takeScreenshotChain.test.js

Source:takeScreenshotChain.test.js Github

copy

Full Screen

...30 assert.deepStrictEqual(toJSON(), {type: 'takeScreenshot'});31 });32 describe('testing takeScreenshot with different arguments', () => {33 it('should handle not empty string or undefined', () => {34 assert.doesNotThrow(() => takeScreenshot('raw'));35 assert.doesNotThrow(() => takeScreenshot('base64'));36 });37 it('should throw error when passing invalid arguments', () => {38 function isSuitestErrorInvalidInput(err) {39 return err instanceof SuitestError &&40 err.code === SuitestError.INVALID_INPUT &&41 err.message.includes('Invalid input provided for .takeScreenshot function');42 }43 assert.throws(() => takeScreenshot(''), isSuitestErrorInvalidInput);44 assert.throws(() => takeScreenshot('any/path/image.png'), isSuitestErrorInvalidInput);45 assert.throws(() => takeScreenshot(null), isSuitestErrorInvalidInput);46 assert.throws(() => takeScreenshot([]), isSuitestErrorInvalidInput);47 assert.throws(() => takeScreenshot(() => void 0), isSuitestErrorInvalidInput);48 assert.throws(() => takeScreenshot(111), isSuitestErrorInvalidInput);49 assert.throws(() => takeScreenshot(Symbol('any')), isSuitestErrorInvalidInput);50 });51 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('webdriver.io page', () => {2 it('should have the right title', () => {3 const title = browser.getTitle();4 expect(title).toBe('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');5 browser.takeScreenshot();6 });7});8describe('webdriver.io page', () => {9 it('should have the right title', () => {10 const title = browser.getTitle();11 expect(title).toBe('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');12 browser.takeElementScreenshot(elem);13 });14});15describe('webdriver.io page', () => {16 it('should have the right title', () => {17 const title = browser.getTitle();18 expect(title).toBe('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');19 browser.takeElementScreenshot(elem, { /* options */ });20 });21});22describe('webdriver.io page', () => {23 it('should have the right title', () => {24 const title = browser.getTitle();25 expect(title).toBe('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');26 browser.takeElementScreenshot(elem, { /* options */ }, (err, screenshot) => {27 });28 });29});30describe('webdriver.io page', () => {31 it('should have the right

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('webdriver.io page', () => {2 it('should have the right title', () => {3 const title = browser.getTitle();4 expect(title).to.equal('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');5 browser.takeScreenshot();6 });7});8exports.config = {9 afterTest: function (test) {10 if (test.error !== undefined) {11 browser.takeScreenshot();12 }13 }14}15exports.config = {16 afterTest: function (test) {17 if (test.error !== undefined) {18 browser.takeScreenshot();19 }20 }21}22exports.config = {23 afterTest: function (test) {24 if (test.error !== undefined) {25 browser.takeScreenshot();26 }27 }28}29exports.config = {30 afterTest: function (test) {31 if (test.error !== undefined) {32 browser.takeScreenshot();33 }34 }35}36exports.config = {37 afterTest: function (test) {38 if (test.error !== undefined) {39 browser.takeScreenshot();40 }41 }42}43exports.config = {44 afterTest: function (test) {45 if (test.error !== undefined) {46 browser.takeScreenshot();47 }48 }49}50exports.config = {51 afterTest: function (test) {52 if (test.error !== undefined) {53 browser.takeScreenshot();54 }55 }56}57exports.config = {

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('webdriver.io page', () => {2 it('should have the right title', () => {3 const title = browser.getTitle()4 expect(title).to.equal('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js')5 browser.takeScreenshot()6 })7})

Full Screen

Using AI Code Generation

copy

Full Screen

1describe("Take a screenshot", function() {2 it("should take a screenshot", function() {3 browser.takeScreenshot();4 });5});6describe("Take a screenshot", function() {7 it("should take a screenshot", function() {8 browser.takeElementScreenshot(".homeHero");9 });10});11describe("Take a screenshot", function() {12 it("should take a screenshot", function() {13 browser.takeElementScreenshot(".homeHero", { /* options */ });14 });15});16describe("Take a screenshot", function() {17 it("should take a screenshot", function() {18 browser.takeElementScreenshot(".homeHero", { /* options */ }, function(err, screenshot) {19 });20 });21});22describe("Take a screenshot", function() {23 it("should take a screenshot", function() {24 browser.takeElementScreenshot(".homeHero", { /* options */ }, function(err, screenshot) {25 });26 });27});28describe("Take a screenshot", function() {29 it("should take a screenshot", function() {30 browser.saveScreenshot("myScreenshot.png");31 });32});33describe("Take a screenshot", function() {34 it("should take a screenshot", function() {35 browser.saveScreenshot("myScreenshot.png", function(err, screenshot) {36 });37 });38});39describe("Take a screenshot", function() {40 it("should take a screenshot", function() {

Full Screen

WebdriverIO Tutorial

Wondering what could be a next-gen browser and mobile test automation framework that is also simple and concise? Yes, that’s right, it's WebdriverIO. Since the setup is very easy to follow compared to Selenium testing configuration, you can configure the features manually thereby being the center of attraction for automation testing. Therefore the testers adopt WedriverIO to fulfill their needs of browser testing.

Learn to run automation testing with WebdriverIO tutorial. Go from a beginner to a professional automation test expert with LambdaTest WebdriverIO tutorial.

Chapters

  1. Running Your First Automation Script - Learn the steps involved to execute your first Test Automation Script using WebdriverIO since the setup is very easy to follow and the features can be configured manually.

  2. Selenium Automation With WebdriverIO - Read more about automation testing with WebdriverIO and how it supports both browsers and mobile devices.

  3. Browser Commands For Selenium Testing - Understand more about the barriers faced while working on your Selenium Automation Scripts in WebdriverIO, the ‘browser’ object and how to use them?

  4. Handling Alerts & Overlay In Selenium - Learn different types of alerts faced during automation, how to handle these alerts and pops and also overlay modal in WebdriverIO.

  5. How To Use Selenium Locators? - Understand how Webdriver uses selenium locators in a most unique way since having to choose web elements very carefully for script execution is very important to get stable test results.

  6. Deep Selectors In Selenium WebdriverIO - The most popular automation testing framework that is extensively adopted by all the testers at a global level is WebdriverIO. Learn how you can use Deep Selectors in Selenium WebdriverIO.

  7. Handling Dropdown In Selenium - Learn more about handling dropdowns and how it's important while performing automated browser testing.

  8. Automated Monkey Testing with Selenium & WebdriverIO - Understand how you can leverage the amazing quality of WebdriverIO along with selenium framework to automate monkey testing of your website or web applications.

  9. JavaScript Testing with Selenium and WebdriverIO - Speed up your Javascript testing with Selenium and WebdriverIO.

  10. Cross Browser Testing With WebdriverIO - Learn more with this step-by-step tutorial about WebdriverIO framework and how cross-browser testing is done with WebdriverIO.

Run Webdriverio 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