Best JavaScript code snippet using playwright-internal
designsystem.js
Source: designsystem.js
...89 static isHomekey(e) { return 36 === e.keyCode }90 static toggleBooleanAttribute(e, t) { "false" === $(e).attr(t) ? $(e).attr(t, "true") : $(e).attr(t, "false") }91 static getAriadescribedby() { return "aria-describedby" }92 static getAriaInvalid() { return "aria-invalid" }93 static getAriaPressed() { return "aria-pressed" }94 static getAriaExpanded() { return "aria-expanded" }95 static getAriaSelected() { return "aria-selected" }96 static getInvalidMessage() { return ".invalid-message" }97 static onSuperordinateElementChanged(e, t) { $(e).is(":checked") ? $(t).prop("disabled", !1) : ($(t).prop("disabled", !0), $(t).prop("checked", !1)) }98 static setupNonExpandableInformationBlock() {99 const e = ".accordioncontent";100 $(".informationmessageblock:visible").each((function() {101 const t = $(this),102 i = $(this).find(e).height();103 !t.hasClass("accordioncontentopen") && i <= 130 && (t.addClass("content-open"), t.find(e).removeClass("hide"), t.addClass("nonexpandable"), t.find(".expand-button").find(".informationmessageheading").unwrap().wrap('<div class="disabled-button subtitle" />'))104 }))105 }106 static trapTabKey(e, t, i) {107 if (9 === e.which) {108 const s = $(":focus");109 e.shiftKey ? s.get(0) === t.get(0) && (i.focus(), e.preventDefault()) : s.get(0) === i.get(0) && (t.focus(), e.preventDefault())110 }111 }112 static showLogoutWindow() { IdleChecker.showLogoutWindow(), $("#abouttobeloggedout").hide(), $("#sessiontimedout").show(), $("#sessiontimedout .continue").focus() }113 static openLightbox(e, i, s) {114 const n = "lightboxwrapper";115 let a;116 t.closeLightbox(), $("body").addClass("hasmodal"), a = "string" == typeof i ? $("<div>" + i + "</div>").insertAfter("footer") : i, a.wrap('<div class="modal_background" tabindex="-1"></div>').wrap('<div class="lightboxwrapper" aria-modal="true"></div>'), s.wrapperclass && $(n).addClass(s.wrapperclass), s.destroy && $(n).addClass("destroy"), s.persistentwindow || ($(document).on("click.closelightbox", (function() { t.closeLightbox(e) })), $(document).on("keydown.closelightbox", (function(i) { 27 === i.keyCode && $(".modal_background").length > 0 && t.closeLightbox(e) })))117 }118 static closeLightbox(e) {119 const t = $(".lightboxwrapper");120 $(document).off("click.closelightbox").off("keydown.closelightbox"), t.length > 0 && (t.hasClass("destroy") ? t.parent().remove() : t.children().unwrap().unwrap(), null != e && $(e).focus()), $("body").removeClass("hasmodal")121 }122 static scrollTo(e, t) { e.is(":visible") && $("html").animate({ scrollTop: e.offset().top - 82 }, t) }123}124class i {125 constructor(e) { this.element = e, this.initEvents() }126 initEvents() {127 t.setupNonExpandableInformationBlock(), $(this.element).on({128 click: function() {129 const e = $(this).closest(".accordion");130 e.toggleClass("expanded"), t.toggleBooleanAttribute($(this), "aria-expanded"), e.find(".accordioncontent").toggleClass("hide")131 }132 })133 }134}135class s {136 constructor(e) { this.element = e, this.closeevent = "click.popupclose", this.popup_keyboardevent = "keydown.popup", this.favouriteactive = "favourite-active", this.setup() }137 setup() {138 const e = this;139 $(this.element).on("click", ".info-toggle", (function() {140 const t = $(this),141 i = t.prev(".info-popup"),142 s = t.hasClass("favourite-toggle"),143 n = !t.hasClass("inactive");144 s && n ? (t.toggleClass(e.favouriteactive), e.togglefavouriteScreenreader(t)) : i.is(":visible") ? e.closePopup(t, i) : i && i.length && e.openPopup(t, i, { closeAll: !0 })145 })), $(this.element).on("click", ".close", (function() {146 const t = $(this).closest(".popup-component").find(".info-toggle"),147 i = t.prev(".info-popup");148 e.closePopup(t, i)149 }))150 }151 openPopup(e, i, s) {152 const n = this;153 s && s.closeAll && this.closeAllPopups(), i.show(), n.positionPopup(e, i), i.addClass("active"), i.is(":visible") && t.scrollIntoView(i), setTimeout((function() { i.find(".close").focus() }), 100), $("body").on(this.closeevent, (function(e) {154 if (n.isInsidePopup(e)) return !0;155 n.closeAllPopups()156 })), $(document).on(this.popup_keyboardevent, (function(s) { 27 === s.keyCode && n.isPopupOpen(i) && n.closePopup(e, i), 9 === s.keyCode && n.isTooltip(i) && n.isPopupOpen(i) && n.closePopup(e, i), n.isDialog(i) && t.trapTabKey(s, i.find(".close"), n.lastElementInPopup(i)) })), e.on("blur", (function(t) { n.isInsidePopup(t) || n.closePopup(e, i), e.off("blur") }))157 }158 closePopup(e, t) { $("body").off(this.closeevent), $(document).off(this.popup_keyboardevent), t.hide(), t.removeClass("active"), e.focus() }159 closeAllPopups() { $("body").off(this.closeevent), $(document).off(this.popup_keyboardevent), $(".info-popup").each((function(e, t) { $(t).hide(), $(t).removeClass("active") })) }160 togglefavouriteScreenreader(e) {161 const t = e.attr("id");162 e.hasClass(this.favouriteactive) ? e.attr("aria-labelledby", "remove-favourite-text-" + t) : e.attr("aria-labelledby", "save-favourite-text-" + t)163 }164 positionPopup(e, t) {165 const i = t.offset(),166 s = i.top,167 n = i.left,168 a = n + t.outerWidth(),169 o = { top: s, left: n },170 r = $(window).scrollLeft(),171 l = r + $(window).width();172 n < r && (o.left = r + 16), a > l && (o.left = l - t.outerWidth()), t.offset(o)173 }174 isInsidePopup(e) { return $(e.target).closest(".popup-component").find(".info-popup").length > 0 }175 isDialog(e) { return e.closest(".popup-component").hasClass("dialog") }176 isTooltip(e) { return e.closest(".popup-component").hasClass("tooltip") }177 isPopupOpen(e) { return e.length > 0 }178 lastElementInPopup(e) { return e.find("button:visible, a:visible, input:visible").last() }179}180class n {181 constructor(e) { this.element = e, this.$element = $(this.element), this.optionList = ".accordioncontent", this.expand_button = ".expand-button", this.options = ".option input", this.optionsChecked = ".option input:checked", this.accordion = ".accordion", this.triggerName = ".expand-button .selected-name", this.optionLast = ".option:last-child input", this.optionFirst = ".option:first-child input", this.optionsAllButFirst = ".option:not(:first-child) input", this.initEvents() }182 initEvents() {183 const e = this;184 $(this.element).ready((function() { e.updateSelectedOption(e.countryselectOptionFirst), e.updateTriggerName() })), $(this.element).on({ click: function() { n.focusSelectedOption() } }, this.expand_button), $(this.element).on({ keydown: function(i) { if (void 0 !== i) return !t.isEnterkey(i) && (t.isArrowdown(i) ? (e.nextListItem(this), !1) : t.isArrowup(i) ? (e.previousListItem(this), !1) : t.isEndkey(i) ? (e.$element.find(e.optionLast).focus(), !1) : t.isHomekey(i) ? (e.$element.find(e.optionFirst).focus(), !1) : t.isEsckey(i) || t.isTabkey(i) && e.isOptionListVisible() ? (e.closeOptionList(), e.focusTriggerElement(), !1) : void 0) }, click: function() { e.updateSelectedOption(this) } }, this.options), $(this.element).on({ keydown: function(i) { if (t.isArrowdown(i) || t.isEnterkey(i)) return e.openOptionList(), n.focusSelectedOption(), !1 } }, this.expand_button), $(document).on("click", (function(t) { if (e.isOptionListVisible() && e.isClickOutsideOptionList(t)) return e.closeOptionList(), e.focusTriggerElement(), !1 }))185 }186 updateSelectedOption(e) { this.isDefaultOption(e) && this.$element.find(this.optionsAllButFirst).prop("checked", !1), this.isOtherThanDefaultOptionSelected(e) ? this.$element.find(this.optionFirst).prop("checked", !1) : this.isSelectionEmpty() && this.$element.find(this.optionFirst).prop("checked", !0), this.updateTriggerName(e) }187 isDefaultOption(e) { return $(e).attr("id") === this.$element.find(this.optionFirst).attr("id") }188 isOtherThanDefaultOptionSelected(e) { return this.$element.find(this.optionsChecked).length > 1 && !this.isDefaultOption(e) }189 isSelectionEmpty() { return 0 === this.$element.find(this.optionsChecked).length }190 updateTriggerName() {191 const e = this.$element.find(this.optionsChecked).length,192 i = this.$element.find(this.optionsChecked).next("label").text();193 1 === e ? this.$element.find(this.triggerName).html(i) : this.$element.find(this.triggerName).html(i).html(e + " " + t.getMessage("multiselect_many_selected"))194 }195 static focusSelectedOption() { $(".multi-select .option input:checked").first().focus() }196 focusTriggerElement() { this.$element.find(this.expand_button).focus() }197 isOptionListVisible() { return this.$element.find(this.optionList).is(":visible") }198 isClickOutsideOptionList(e) { return !$(e.target).closest(this.$element.find(this.accordion)).length }199 closeOptionList() { this.$element.find(this.optionList).addClass("hide"), this.$element.find(this.expand_button).attr("aria-expanded", !1), this.$element.find(this.accordion).removeClass("expanded") }200 openOptionList() { this.$element.find(this.optionList).removeClass("hide"), this.$element.find(this.expand_button).attr("aria-expanded", !0), this.$element.find(this.accordion).addClass("expanded") }201 previousListItem(e) { $(e).closest("li").prev().find("input").focus() }202 nextListItem(e) { $(e).closest("li").next().find("input").focus() }203}204class a {205 constructor(e) { this.element = e, this.initEvents() }206 initEvents() {207 const e = this;208 $(this.element).on("change", (function() {209 if (e.checkIfDateIsValid())210 if (e.isNotStandardDatepicker()) {211 const t = e.calculateSimpleDatepickerValue();212 e.simpleDatepickerElements().value.val(t), $("#" + e.getIdBase() + "-standard").val(t)213 } else {214 const t = $("#" + e.getIdBase() + "-standard").val();215 $("#" + e.getIdBase()).val(t);216 const i = new Date(t);217 e.simpleDatepickerElements().year.val(i.getFullYear()), e.simpleDatepickerElements().month.val(e.getMonth(i)), e.simpleDatepickerElements().day.val(e.getDay(i))218 }219 }))220 }221 isNotStandardDatepicker() { return $(this.element).attr("id") !== this.getIdBase() + "-standard" }222 simpleDatepickerElements() { return { year: $("#" + this.getIdBase() + "-year"), month: $("#" + this.getIdBase() + "-month"), day: $("#" + this.getIdBase() + "-day"), value: $("#" + this.getIdBase()) } }223 calculateSimpleDatepickerValue() { const e = this.simpleDatepickerElements(); return e.year.val() && e.month.val() && e.day.val() ? e.year.val() + "-" + e.month.val() + "-" + e.day.val() : null }224 getMonth(e) { return ("0" + (e.getMonth() + 1)).slice(-2) }225 getIdBase() { return $(this.element).attr("id").split("-")[0] }226 getDay(e) { return ("0" + e.getDate()).slice(-2) }227 renderThisMessageValid(e) { $(t.getInvalidMessage(), this.getThisContext(e)).hide(), $(e).removeAttr(t.getAriadescribedby()), this.renderThisFieldValid(e) }228 renderThisMessageInvalid(e) {229 const i = $(e).attr("id");230 $(e).attr(t.getAriadescribedby(), "error-" + i), $(".helpertext", e).hide(), $(t.getInvalidMessage(), this.getThisContext(e)).show(), this.renderThisFieldInvalid(e)231 }232 renderThisFieldValid(e) { $(e).addClass("valid"), $(e).removeClass("invalid"), $(e).attr(t.getAriaInvalid(), "false") }233 renderThisFieldInvalid(e) { $(e).addClass("invalid"), $(e).removeClass("valid"), $(e).attr(t.getAriaInvalid(), "true") }234 getThisContext(e) { return $(e).parent() }235 checkIfDateIsValid() {236 const e = this.simpleDatepickerElements();237 if (e.year.val() && e.month.val() && e.day.val()) {238 if (!this.isDateValid(e.year.val(), e.month.val(), e.day.val())) return this.renderThisMessageInvalid("#" + this.getIdBase() + "-day"), $("#" + this.getIdBase()).val(this.calculateSimpleDatepickerValue()), !1;239 this.renderThisMessageValid("#" + this.getIdBase() + "-year"), this.renderThisMessageValid("#" + this.getIdBase() + "-month"), this.renderThisMessageValid("#" + this.getIdBase() + "-day")240 } else $("#" + this.getIdBase()).val("");241 return !0242 }243 isDateValid(e, t, i) { return t >= 1 && t < 13 && i > 0 && i <= this.daysInMonth(e, Number(t)) }244 daysInMonth(e, t) {245 switch (t) {246 case 2:247 return e % 4 == 0 && e % 100 || e % 400 == 0 ? 29 : 28;248 case 9:249 case 4:250 case 6:251 case 11:252 return 30;253 default:254 return 31255 }256 }257}258class o {259 constructor(e) { this.element = e, this.initEvents() }260 initEvents() { if ($(this.element).on({ change: function() { $(this).addClass("changed-show-error") } }), "countryid" === $(this.element).attr("id").toLowerCase()) { $(this.element).on({ change: function() { const e = $("#zipCode"); "SE" === $(this).children("option:selected").val() ? (e.prop("required", !0), e.siblings("label").find(".optionaltext").addClass("hide")) : (e.prop("required", !1), e.siblings("label").find(".optionaltext").removeClass("hide")) } }); const e = $("#zipCode"); "SE" === $(this.element).children("option:selected").val() && (e.prop("required", !0), e.siblings("label").find(".optionaltext").addClass("hide")) } }261}262class r {263 constructor(e) { this.element = e, this.disableDependentIfNeeded(), this.initEvents() }264 initEvents() {265 const e = this;266 $(this.element).on({ click: function() { e.disableDependentIfNeeded() } })267 }268 disableDependentIfNeeded() {269 const e = $(this.element).data("dependsonid");270 $(e).attr("disabled", $(this.element).is(":checked"))271 }272}273class l {274 constructor(e) { this.element = e }275 validateField(e) { return this._validate(this.getValue(), e) }276 validateFieldTrim(e) { return this._validate(this.getValueTrim(), e) }277 _validate(e, t) { return this.isInitiated() && (l.matchPattern(e, t) ? this.renderMessageValid() : this.renderMessageInvalid()), !1 }278 validateFieldMatch(e, t) { const i = t.val(); "" !== e && "" !== i && this.isValidated() && (e === i ? this.renderThisMessageValid(t) : this.renderThisMessageInvalid(t)) }279 renderMessageValid() {280 if ($(t.getInvalidMessage(), this.getContext()).hide(), $(this.element).removeAttr(t.getAriadescribedby()), 0 !== $(this.element).closest(".textfield").find(".validicon").length) {281 const e = $(this.element).attr("id");282 $(this.element).attr(t.getAriadescribedby(), "valid-" + e)283 }284 this.renderFieldValid()285 }286 renderMessageInvalid() {287 const e = $(this.element).attr("id");288 $(this.element).attr(t.getAriadescribedby(), "error-" + e), $(".helpertext", this.element).hide(), $(t.getInvalidMessage(), this.getContext()).show(), $(this.getEmailOccupiedSelector(), this.element).text(""), this.renderFieldInvalid()289 }290 renderThisMessageValid(e) { $(t.getInvalidMessage(), this.getThisContext(e)).hide(), $(e).removeAttr(t.getAriadescribedby()), this.renderThisFieldValid(e) }291 renderThisMessageInvalid(e) {292 const i = $(e).attr("id");293 $(e).attr(t.getAriadescribedby(), "error-" + i), $(".helpertext", e).hide(), $(t.getInvalidMessage(), this.getThisContext(e)).show(), $(this.getEmailOccupiedSelector(), e).text(""), this.renderThisFieldInvalid(e)294 }295 renderThisFieldValid(e) { $(e).addClass("valid"), $(e).removeClass("invalid"), $(e).attr(t.getAriaInvalid(), "false") }296 renderThisFieldInvalid(e) { $(e).addClass("invalid"), $(e).removeClass("valid"), $(e).attr(t.getAriaInvalid(), "true") }297 renderFieldValid() { $(this.element).addClass("valid"), $(this.element).removeClass("invalid"), $(this.element).attr(t.getAriaInvalid(), "false") }298 renderFieldInvalid() { $(this.element).addClass("invalid"), $(this.element).removeClass("valid"), $(this.element).attr(t.getAriaInvalid(), "true") }299 static matchPattern(e, t) { return t.test(e) }300 getThisContext(e) { return $(e).parent() }301 getContext() { return $(this.element).parent() }302 getEmailOccupiedSelector() { return ".occupiedemail-message" }303 getValue() { return $(this.element).val().toString() }304 getValueTrim() { return $(this.element).val().toString().trim() }305 setInitiated() { return $(this.element).addClass("initiated") }306 setValidated() { return $(this.element).addClass("validated") }307 isInitiated() { return $(this.element).hasClass("initiated") }308 isValidated() { return $(this.element).hasClass("validated") }309}310class c extends l {311 constructor(e) { super(e), this.newpassword = "[name=password]", this.confirmpassword = "[name=passwordVer]", this.validatePasswordCorrect(this.getValue()), this.initEvents() }312 initEvents() {313 const e = this,314 t = $(this.element).siblings("button");315 $(this.element).attr("autocomplete") && "new-password" === $(this.element).attr("autocomplete").toLowerCase() && $(this.element).on({ input: function() { e.setInitiated(), e.validatePasswordCorrect(e.getValue()), e.isValidated() && (e.validateField(e.getPasswordPattern()), e.validateFieldMatch($(e.newpassword).val(), $(e.confirmpassword))) }, blur: function() { e.setValidated(), e.validateField(e.getPasswordPattern()), e.validateFieldMatch($(e.newpassword).val(), $(e.confirmpassword)) } }), $(t).on({316 click: function() {317 const t = $(this).siblings("input"),318 i = t.attr("type"),319 s = t.attr("id");320 return "password" === i ? e.setPasswordVisible(this, t, s) : e.setPasswordInvisible(this, t, s), !1321 }322 })323 }324 validatePasswordCorrect(e) { "password" === $(this.element).attr("name") && (c.matchPattern(e, this.getPasswordPattern()) && this.renderMessageValid(), this.validatePasswordPattern(e, ".lowercase", this.passwordPatternLowerCase()), this.validatePasswordPattern(e, ".uppercase", this.getPasswordPatternUpperCase()), this.validatePasswordPattern(e, ".number", this.getPasswordPatternnumber()), this.validatePasswordPattern(e, ".specialchar", this.getPasswordPatternSpecialChar()), this.validatePasswordPattern(e, ".totalchars", this.getPasswordPatternTotalChar())) }325 validatePasswordPattern(e, t, i) {326 const s = $(this.element).siblings(".evaluatepassword-message");327 c.matchPattern(e, i) ? s.find(t).prop("checked", !0) : s.find(t).prop("checked", !1)328 }329 setPasswordVisible(e, i, s) { i.attr("type", "text"), $(e).attr("aria-labelledby", "make-invisible-text-" + s), $(e).removeClass("make-visible"), $(e).addClass("make-invisible"), $(e).attr(t.getAriadescribedby(), s + "-" + c.getPasswordvisibletextId()), $("#" + s + "-" + c.getPasswordvisibletextId()).html(t.getMessage("accessible_passwordvisible")) }330 setPasswordInvisible(e, i, s) { i.attr("type", "password"), $(e).attr("aria-labelledby", "make-visible-text-" + s), $(e).removeClass("make-invisible"), $(e).addClass("make-visible"), $(e).attr(t.getAriadescribedby(), s + "-" + c.getPasswordvisibletextId()), $("#" + s + "-" + c.getPasswordvisibletextId()).html(t.getMessage("accessible_passwordinvisible")) }331 getPasswordPattern() { return new RegExp("^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[-_,.;:!?+\\\\/@%(){}\\[\\]\"*`~^=|\\s'])[A-Za-z0-9-_,.;:!?+\\\\/@%(){}\\[\\]\"*`~^=|\\s']{8,50}$") }332 passwordPatternLowerCase() { return new RegExp("[a-z]") }333 getPasswordPatternUpperCase() { return new RegExp("[A-Z]") }334 getPasswordPatternnumber() { return new RegExp("[0-9]") }335 getPasswordPatternTotalChar() { return new RegExp("^.{8,50}$") }336 getPasswordPatternSpecialChar() { return new RegExp("[-_,.;:!?+\\\\/@%(){}\\[\\]\"*`~^=|\\s']") }337 static getPasswordvisibletextId() { return "togglevisible-sr" }338}339class d extends l {340 constructor(e) { super(e) }341 static getPersonnummer() { return $("#pnr").val() }342 static isPersonnummer() { const e = $("#pnr").val(); return void 0 !== e && e.length > 0 }343}344class u extends l {345 constructor(e) { super(e), this.newemail = "[name=email]", this.confirmemail = "[name=emailVer]", this.initEvents() }346 initEvents() {347 const e = this;348 $(this.element).on({ input: function() { e.setInitiated(), e.isValidated() && (e.validateEmail(), e.validateFieldMatch($(e.newemail).val(), $(e.confirmemail))) }, blur: function() { e.setValidated(), e.isInitiated() && e.validateEmail(), e.validateFieldMatch($(e.newemail).val(), $(e.confirmemail)) } }), $(this.element).attr("id") && "email" === $(this.element).attr("id").toLowerCase() && $(this.element).on({ blur: function(i) { if ($(this).hasClass("valid")) { t.awebShowSpinner(); const s = d.getPersonnummer(); return d.isPersonnummer() ? e.checkPnrEmailAvailability(this, s, i) : e.checkEmailAvailability(this, i), !1 } } })349 }350 checkEmailAvailability(e, i) {351 const s = this;352 $.ajax({ url: t.getTrack() + "/validateemail", cache: !1, type: "GET", data: { epost: e.value }, success: function() { s.renderEmailNotOccupiedMessage() }, error: function() { s.renderEmailOccupiedMessage() }, complete: function() { t.awebHideSpinner(), s.setFocusOnRelatedTarget(i) } })353 }354 checkPnrEmailAvailability(e, i, s) {355 const n = this;356 $.ajax({ url: t.getTrack() + "/validatepnremail", cache: !1, type: "GET", data: { epost: e.value, personnummer: i }, success: function() { n.renderEmailNotOccupiedMessage() }, error: function() { n.renderEmailOccupiedMessage() }, complete: function() { t.awebHideSpinner(), n.setFocusOnRelatedTarget(s) } })357 }358 validateEmail() { this.validateEmailPatterns(this.getValueTrim()) ? this.renderMessageValid() : this.renderMessageInvalid() }359 validateEmailPatterns(e) { return !u.matchPattern(e, this.getEmailInvalidPattern()) && u.matchPattern(e, this.getEmailValidPattern()) }360 renderEmailOccupiedMessage() {361 const e = $(this.element).attr("id");362 $(this.element).attr(t.getAriadescribedby(), "occupiedemail-" + e), $(this.getEmailOccupiedSelector(), this.getContext()).text(""), $(this.getEmailOccupiedSelector(), this.getContext()).show(), $(this.getEmailOccupiedSelector(), this.getContext()).text(t.getMessage("occupiedemail")), this.renderFieldInvalid(this.element)363 }364 setFocusOnRelatedTarget(e) {365 const i = t.getRelatedTargetId(e);366 void 0 !== i && $("#" + i).focus()367 }368 renderEmailNotOccupiedMessage() { $(this.getEmailOccupiedSelector(), this.getContext()).text(""), $(this.element).removeAttr(t.getAriadescribedby()) }369 getEmailInvalidPattern() { return new RegExp("(\\.\\.)|(@\\.)|(\\.@)|(^\\.)") }370 getEmailValidPattern() { return new RegExp("^([+\\-\\w.]+)@((\\[?[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}]?)|((([\\-\\w]{1,63}\\.)+)([a-zA-Z]{2,63})))$") }371}372class h extends l {373 constructor(e) { super(e), this.name_field = 'input[name$="Name"]:not([readonly])', this.initEvents() }374 initEvents() {375 const e = this;376 $(this.element).on({ input: function() { e.setInitiated(), l.matchPattern(e.getValue(), e.getNamePattern()) && e.renderMessageValid(), e.isValidated() && e.validateField(e.getNamePattern()) }, blur: function() { e.setValidated(), e.validateField(e.getNamePattern()) } })377 }378 getNamePattern() { return new RegExp("^[A-Za-zªµºÃ-ÃÃ-öø-ËË-ËË -ˤˬˮͰ-ʹͶͷͺ-ͽÎÎ-ÎÎÎ-ΡΣ-ϵϷ-ÒÒ-Ô§Ô±-ÕÕÕ¡-Ö×-תװ-×²Ø -Ùٮٯٱ-ÛÛÛ¥Û¦Û®Û¯Ûº-Û¼Û¿ÜÜ-ܯÝ-Þ¥Þ±ß-ߪߴߵߺà -à à à ¤à ¨à¡-à¡à¢ ࢢ-ࢬà¤-हऽà¥à¥-ॡॱ-ॷॹ-ॿà¦
-à¦à¦à¦à¦-নপ-রলশ-হঽà§à§à§à§-ৡৰৱà¨
-à¨à¨à¨à¨-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹà©-à©à©à©²-à©´àª
-àªàª-àªàª-નપ-રલળવ-હઽà«à« à«¡à¬
-à¬à¬à¬à¬-ନପ-ରଲଳଵ-ହଽààà-à¡à±à®à®
-à®à®-à®à®-à®à®à®à®à®à®à®£à®¤à®¨-பம-ஹà¯à°
-à°à°-à°à°-నప-ళవ-హఽà±à±à± ౡà²
-à²à²-à²à²-ನಪ-ಳವ-ಹಽà³à³ ೡೱೲà´
-à´à´-à´à´-ഺഽàµàµ ൡൺ-ൿà¶
-à¶à¶-නඳ-රලà·-à·à¸-ะาำà¹-à¹àºàºàºàºàºàºàºàº-àºàº-àºàº¡-ຣລວສຫàº-ະາຳຽà»-à»à»à»-à»à¼à½-à½à½-ཬà¾-à¾á-áªá¿á-áá-áá¡á¥á¦á®-á°áµ-ááá -á
ááá-áºá¼-áá-áá-ááá-áá -áá-áá-á°á²-áµá¸-á¾áá-á
á-áá-áá-áá-áá-áá -á´á-á¬á¯-á¿á-áá -áªá-áá-áá -á±á-áá -á¬á®-á°á-á³ááá -á¡·á¢-ᢨᢪᢰ-ᣵá¤-á¤á¥-á¥á¥°-ᥴá¦-ᦫá§-á§á¨-á¨á¨ -á©áª§á¬
-ᬳá
-áá®-ᮠᮮᮯᮺ-ᯥá°-á°£á±-á±á±-ᱽᳩ-ᳬᳮ-ᳱᳵᳶá´-ᶿá¸-á¼á¼-á¼á¼ -á½
á½-á½á½-á½á½á½á½á½-á½½á¾-ᾴᾶ-ᾼιá¿-á¿á¿-á¿á¿-á¿á¿-á¿á¿ -Ῥῲ-ῴῶ-ῼâ±â¿â-ââââ-âââ-ââ¤â¦â¨âª-ââ¯-â¹â¼-â¿â
-â
â
âââ°-Ⱞⰰ-â±â± -ⳤⳫ-ⳮⳲⳳâ´-ⴥⴧâ´â´°-ⵧⵯâ¶-â¶â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾâ·-â·â·-â·â·-â·â·-â·â¸¯ã
ãã±-ãµã»ã¼ã-ãã-ãã¡-ãºã¼-ã¿ã
-ãã±-ãã -ãºã°-ã¿ã-䶵ä¸-é¿ê-êê-ê½ê-êê-êêªê«ê-ê®ê¿-êê -ê¥ê-êê¢-êê-êê-êê -êªê¸-ê ê -ê
ê -ê ê -ê ¢ê¡-ꡳê¢-ꢳꣲ-ꣷꣻê¤-ꤥꤰ-ê¥ê¥ -ꥼê¦-ꦲê§ê¨-ꨨê©-ê©ê©-ê©ê© -ꩶꩺêª-ꪯꪱꪵꪶꪹ-ꪽê«ê«ê«-ê«ê« -ꫪꫲ-ê«´ê¬-ê¬ê¬-ê¬ê¬-ê¬ê¬ -ꬦꬨ-ꬮê¯-ꯢê°-í£í°-íí-í»ï¤-ï©ï©°-ï«ï¬-ï¬ï¬-ï¬ï¬ï¬-ﬨשׁ-זּטּ-לּמּïïïïï-ï®±ï¯-ï´½ïµ-ï¶ï¶-ï·ï·°-ﷻﹰ-ﹴﹶ-ﻼA-Zï½-ï½ï½¦-ï¾¾ï¿-ï¿ï¿-ï¿ï¿-ï¿ï¿-ï¿ Â áá â-ââââFâã\ufeff'´-]+$") }379}380class p extends l {381 constructor(e) { super(e), this.initEvents() }382 initEvents() {383 const e = this;384 $(this.element).on({ input: function() { e.setInitiated(), l.matchPattern(e.getValueTrim(), e.getPhonePattern()) && e.renderMessageValid(), e.isValidated() && e.validateFieldTrim(e.getPhonePattern()) }, blur: function() { e.setValidated(), e.validateFieldTrim(e.getPhonePattern()) } })385 }386 getPhonePattern() { return new RegExp("^(\\+|[0-9])(?:[0-9()-]){4,14}[0-9]$") }387}388class m {389 constructor(e) { this.element = e, this.initEvents() }390 initEvents() { $(this.element).on({ click: function() { return window.location = "/" + t.getLang() + "/login", !1 } }) }391}392class g {393 constructor(e) { this.element = e, this.initEvents() }394 initEvents() { $(this.element).on({ click: function() { return window.location = "/" + t.getLang() + "/selections", !1 } }) }395}396class f {397 constructor(e) { this.element = e, this.initEvents() }398 initEvents() { $(this.element).on({ click: function() { return window.location = "/" + t.getLang() + "/logout", !1 } }) }399}400class b {401 constructor(e) { this.element = e, this.initEvents() }402 initEvents() {403 const e = this,404 i = "expanded";405 $(this.element).on({ click: function() { return $(e.element).toggleClass(i), $(e.element).siblings(".mypages-container").toggleClass(i), $(e.element).attr("aria-expanded", $(e.element).hasClass(i)), !1 } }), $(document).mouseup((function(t) { if (!$(t.target).closest(".menu-button-container.mypages").length) return $(e.element).removeClass(i), $(e.element).siblings(".mypages-container").removeClass(i), !1 })), $(document).on("keyup", (function(s) { if (t.isEsckey(s)) return $(e.element).removeClass(i), $(e.element).siblings(".mypages-container").removeClass(i), !1 }))406 }407}408class v {409 constructor(e) { this.element = e, this.initEvents() }410 initEvents() {411 const e = this,412 i = "expanded";413 $(this.element).on({ click: function() { return $(e.element).toggleClass(i), $(e.element).siblings(".menu-container").toggleClass(i), $(e.element).attr("aria-expanded", $(e.element).hasClass(i)), $("body").toggleClass("hasoverlay"), !1 } }), $(".menu-container .close-button").on({ click: function() { return $(e.element).removeClass(i), $(e.element).siblings(".menu-container").removeClass(i), $(e.element).attr("aria-expanded", !1), $("body").removeClass("hasoverlay"), !1 } }), $(document).mouseup((function(t) { $(".menu-button-container.navigation .menu-container").is(":visible") && !$(t.target).closest(".menu-button-container.navigation").length && ($(e.element).removeClass(i), $(e.element).siblings(".menu-container").removeClass(i), $("body").removeClass("hasoverlay")) })), $(document).on("keyup", (function(s) { t.isEsckey(s) && ($(e.element).removeClass(i), $(e.element).siblings(".menu-container").removeClass(i), $("body").removeClass("hasoverlay")) }))414 }415}416class w {417 constructor(e) { this.element = e, this.initEvents() }418 initEvents() {419 const e = this,420 t = "expanded";421 $(this.element).on({422 click: function() {423 $(e.element).toggleClass(t), $(e.element).closest(".menu-heading").toggleClass(t), $(e.element).attr("aria-expanded", $(e.element).hasClass(t));424 var i = $(e.element).closest(".menu-part").find(".menu-body");425 i.hasClass(t) ? i.slideUp("fast", (function() { i.toggleClass(t) })) : (i.toggleClass(t), i.slideDown("fast", (function() {})))426 }427 })428 }429}430class y {431 constructor() { this.password_field = "input[type=password]:not([data-initiated])", this.email_field = "input[type=email]:not([data-initiated])", this.name_field = 'input[name$="Name"]:not([readonly]):not([data-initiated])', this.phone_field = "input[type=tel]:not([data-initiated])", this.select = ".dropdown select:not([data-initiated])", this.checkbox = ".checkbox.dependent input[type=checkbox]:not([data-initiated])", this.accordion = ".accordion .expand-button:not([data-initiated])", this.datepicker = ".datepicker input[type=date]:not([data-initiated]),.datepicker select:not([data-initiated])", this.pnr = "#pnr", this.multi_select = ".multi-select", this.logiIn_button = ".login-button:not([data-initiated])", this.selEection_button = ".selection-button:not([data-initiated])", this.logout_button = ".mypages-logout-link .outlined-button:not([data-initiated])", this.mypages_button = ".menu-toggle-button-notification.mypages-button:not([data-initiated])", this.navigation_button = ".menu-toggle-button-burger.menu-button:not([data-initiated])", this.navigation_toggle_button = ".navigation-toggle-button:not([data-initiated])", this.popup = ".popup-component:not([data-initiated])", this.initEvents(), this.generateObjects() }432 generateObjects() {433 const e = "data-initiated";434 $(this.datepicker).each((function(t, i) { new a(i), $(i).attr(e, "") })), $(this.multi_select).each((function(t, i) { new n(i), $(i).attr(e, "") })), $(this.accordion).each((function(t, s) { new i(s), $(s).attr(e, "") })), $(this.select).each((function(t, i) { new o(i), $(i).attr(e, "") })), $(this.checkbox).each((function(t, i) { new r(i), $(i).attr(e, "") })), $(this.password_field).each((function(t, i) { new c(i), $(i).attr(e, "") })), $(this.email_field).each((function(t, i) { new u(i), $(i).attr(e, "") })), $(this.name_field).each((function(t, i) { new h(i), $(i).attr(e, "") })), $(this.phone_field).each((function(t, i) { new p(i), $(i).attr(e, "") })), $(this.pnr).each((function(t, i) { new d(i), $(i).attr(e, "") })), $(this.login_button).each((function(t, i) { new m(i), $(i).attr(e, "") })), $(this.selection_button).each((function(t, i) { new g(i), $(i).attr(e, "") })), $(this.logout_button).each((function(t, i) { new f(i), $(i).attr(e, "") })), $(this.mypages_button).each((function(t, i) { new b(i), $(i).attr(e, "") })), $(this.navigation_button).each((function(t, i) { new v(i), $(i).attr(e, "") })), $(this.navigation_toggle_button).each((function(t, i) { new w(i), $(i).attr(e, "") })), $(this.popup).each((function(t, i) { new s(i), $(i).attr(e, "") }))435 }436 initEvents() {437 const e = this;438 $(document).on("ajaxComplete", (function() { e.generateObjects() }))439 }440}441class x {442 constructor() { this.element = ".subject-container", this.close_button = ".subject-container .close-button", this.toggle_expand = ".subject-container .toggle-expand", this.selectable_item = ".subject-container .selectable-item", $(this.element).attr("data-initiated", ""), this.initEvents() }443 initEvents() {444 const e = this;445 $(e.close_button).on("click", (function() { e.closeSubjectList() })), $(e.selectable_item).on("click", (function() { x.clearSelection(), e.updateTriggerName($(this).find(".subjectname")), e.updateSelectedItem($(this)), e.closeSubjectList(), $(e.element).trigger("change") })), $(e.toggle_expand).on("click", (function() { e.toggleExpand($(this)) })), $(e.element).on("keydown", (function(i) { t.trapTabKey(i, $(this).find(".close-button"), $(this).find("button:visible:last")); const s = $(i.target); return t.isEsckey(i) ? (e.closeSubjectList(), !1) : t.isArrowdown(i) ? (e.moveToNextElement(s), !1) : t.isArrowup(i) ? (e.moveToPreviousElement(s), !1) : t.isHomeKey(i) ? (e.getFirstElement().focus(), !1) : t.isEndKey(i) ? (e.getLastElement().focus(), !1) : t.isArrowright(i) ? (e.handleArrowRight(s), !1) : t.isArrowleft(i) ? (e.handleArrowLeft(s), !1) : t.isSpacekey(i) || t.isEnterkey(i) ? (s.trigger("click"), !1) : void 0 })), $(document).on("click", (function(t) { if (e.isSubjectListVisible() && e.isClickOutsideSubjectList(t)) return e.closeSubjectList(), !1 }))446 }447 handleArrowRight(e) { e.hasClass("toggle-expand") && (this.isExpanded(e) ? this.moveToNextElement(e) : x.expandItem(e)) }448 handleArrowLeft(e) { this.isExpanded(e) ? e.hasClass("expanded") && x.collapseItem(e) : 0 !== e.closest("li").length && this.moveToParent(e) }449 getFirstElement() { return $(this.element).find("li:visible").first().children("button") }450 getLastElement() { return $(this.element).find("li:visible").last().children("button") }451 moveToParent(e) { e.parents(".list").siblings(x.getToggleExpand()).focus() }452 moveToNextElement(e) {453 const t = $(".subject-container button:not(.close-button):visible"),454 i = t.index(e) + 1;455 t.eq(i).focus()456 }457 moveToPreviousElement(e) {458 const t = $(".subject-container button:not(.close-button):visible"),459 i = t.index(e) - 1;460 i >= 0 && t.eq(i).focus()461 }462 isExpanded(e) { return e.hasClass("expanded") }463 isLastChild(e) { return $(e.target).closest("li").is(":last-child") }464 isFirstChild(e) { return $(e.target).closest("li").is(":first-child") }465 updateTriggerName(e) {466 const t = e.text().trim().replace(/^\w/, (e => e.toUpperCase()));467 $("#subjectstrigger .selected-name").html(t)468 }469 updateSelectedItem(e) { e.attr(t.getAriaPressed(), "true"), e.closest("li").addClass("selected").attr(t.getAriaSelected(), "true") }470 isSubjectListVisible() { return $(this.element).is(":visible") }471 isClickOutsideSubjectList(e) { return !$(e.target).closest(this.element).length }472 closeSubjectList() { t.closeLightbox(), setTimeout((function() { $("#subjectstrigger").focus() }), 300) }473 toggleExpand(e) { e.hasClass("expanded") ? x.collapseItem(e) : x.expandItem(e) }474 static clearSelection() { $(".list-item.selected").removeClass("selected").removeAttr(t.getAriaSelected()).find(this.getSelectableItem()).attr(t.getAriaPressed(), "false") }475 static expandItem(e) {476 const i = e.closest(".list-item").find(".list-body").first();477 e.addClass("expanded"), e.attr(t.getAriaExpanded(), !0), $(i).slideDown("fast")478 }479 static collapseItem(e) {480 const i = e.closest(".list-item").find(".list-body").first();481 e.removeClass("expanded"), e.attr(t.getAriaExpanded(), !1), $(i).slideUp("fast")482 }483 static makeSelectionVisible() {484 const e = $("#subjecttree .selected").parents(".list").siblings(this.getToggleExpand());485 $(e).each((function(e, t) { x.expandItem($(t)) })), this.getSelectedItem().focus()486 }487 static getSelectedItem() { return $(".list-item.selected").find(this.getSelectableItem()) }488 static onClearFilter() { $("#subjecttree").find(".selected").attr(t.getAriaPressed(), "false").closest("li").removeClass("selected").removeAttr("aria-selected"), $("#clearsubject").attr(t.getAriaPressed(), "true").closest("li").addClass("selected").attr("aria-selected", "true"), $("#subjectstrigger .selected-name").html($(".default-value").text()), this.collapseAllTreeItems() }489 static collapseAllTreeItems() { $(".toggle-expand").each((function(e, t) { x.collapseItem($(t)) })) }490 static getSelectableItem() { return ".selectable-item" }491 static getToggleExpand() { return ".toggle-expand" }492}493class k {494 constructor() { this.html = "html", this.freetext = "#freetext", this.searchresult = ".searchresult", this.filterlist = ".filterlist", this.expanded = "#expanded", this.showallfilters = "#showallfilters", this.expandtext = ".expand-text", this.contracttext = ".contract-text", this.searchform = "#searchform", this.showfilters = "#showfilters", this.searchresultcard = ".searchresultcard", this.aria_labelledby = "aria-labelledby", this.aria_expanded = "aria-expanded", this.setup(), this.setupAutocomplete() }495 setup() {496 const e = this;497 $(document).ready((function() {498 if ($(e.searchform).length > 0) {499 e.updateDynamicFilterValues();500 const t = e.readQueryParamsFromForm();501 e.updateInitialSearchForm(t)502 }...
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 const button = await page.$('text=Get started');6 const ariaPressed = await button.getAriaPressed();7 console.log(ariaPressed);8 await browser.close();9})();10getAriaPressed()11getAriaRole()12getAriaValueMax()13getAriaValueMin()14getAriaValueNow()15getAriaValueText()16getAttributes()17getBoundingBox()18getClassName()19getClientRect()20getComputedStyle()21getInnerText()22getIsVisible()23getOuterHTML()24getOwnerFrame()25getSelector()26getShapeOutside()27getTagName()28getTrimmedInnerText()29getTrimmedTextContent()30getTextContent()31getURL()32getVisibleText()33isEditable()34isDisabled()35isFocused()36isHidden()37isSelectorVisible()38isTextVisible()39isUserHidden()40waitForSelectorState()41waitForSelectorVisible()42waitForState()43waitForVisible()44waitForXPathState()45waitForXPathVisible()46addScriptTag()47addStyleTag()48bringToFront()49check()50click()51closePage()52closeWindow()53content()54deselectOption()55dispatchEvent()56evaluate()57evaluateHandle()58evaluateOnNewDocument()59exposeBinding()60exposeFunction()61fill()62focus()63frame()64frames()65goBack()66goForward()67goto()68hover()69innerHeight()70innerWidth()71inputValue()72intercept()73isClosed()74isConnected()75keyboard()76mainFrame()77metrics()78mouse()79off()80on()81once()82opener()83press()84queryObjects()85reload()86route()87routePrefix()88routes()89selectOption()90setContent()91setInputFiles()92setViewportSize()93setViewportSizeOverride()94storageState()95tap()96text()97title()98touchscreen()99type()100uncheck()101url()102viewportSize()103waitForEvent()104waitForFunction()105waitForLoadState()106waitForNavigation()107waitForRequest()108waitForResponse()109waitForSelector()110waitForTimeout()111waitForURL()112waitForXPath()113window()114windowCount()115windowName()116windowSize()117x()118y()119xpath()
Using AI Code Generation
1const { getAriaPressed } = require('playwright/lib/internal');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const button = await page.$('button:has-text("Contact")');8 const ariaPressed = await getAriaPressed(button);9 console.log(ariaPressed);10 await browser.close();11})();
Using AI Code Generation
1const { getAriaPressed } = require('@playwright/test/lib/server/frames');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const ariaPressed = await getAriaPressed(page, 'css=button:has-text("Toggle Dark Mode")');8 console.log(ariaPressed);9 await browser.close();10})();
Using AI Code Generation
1const { chromium } = require('playwright');2const { getAriaPressed } = require('playwright/lib/internal/accessibility');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const ariaPressed = await getAriaPressed(page, '#navbar ul li:first-child a');8 console.log(ariaPressed);9 await browser.close();10})();11const { chromium } = require('playwright');12const { getAXTree } = require('playwright/lib/internal/accessibility');13(async () => {14 const browser = await chromium.launch();15 const context = await browser.newContext();16 const page = await context.newPage();17 const axTree = await getAXTree(page);18 console.log(axTree);19 await browser.close();20})();21const { chromium } = require('playwright');22const { getAXSnapshot } = require('playwright/lib/internal/accessibility');23(async () => {24 const browser = await chromium.launch();25 const context = await browser.newContext();26 const page = await context.newPage();27 const axSnapshot = await getAXSnapshot(page);28 console.log(axSnapshot);29 await browser.close();30})();
Using AI Code Generation
1const { chromium } = require('playwright');2const { getAriaPressed } = require('playwright/lib/internal/accessibility/accessibility.js');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const button = await page.$('text="Get started"');8 const ariaPressed = await getAriaPressed(button);9 console.log(ariaPressed);10 await browser.close();11})();
Using AI Code Generation
1const { getAriaPressed } = require('playwright/lib/internal/aria');2(async () => {3 const {chromium} = require('playwright');4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const selector = '.navbar__inner .navbar__toggle';8 await page.waitForSelector(selector);9 const ariaPressed = await getAriaPressed(page, selector);10 console.log(ariaPressed);11 await browser.close();12})();13const { getAriaPressed } = require('playwright/lib/internal/aria');14(async () => {15 const {chromium} = require('playwright');16 const browser = await chromium.launch();17 const context = await browser.newContext();18 const page = await context.newPage();19 const selector = '.navbar__inner .navbar__toggle';20 await page.waitForSelector(selector);21 const ariaPressed = await getAriaPressed(page, selector);22 console.log(ariaPressed);23 await browser.close();24})();
Using AI Code Generation
1const { getAriaPressed } = require('@playwright/test/lib/internal/aria');2const { test, expect } = require('@playwright/test');3test('test aria-pressed', async ({ page }) => {4 const ariaPressed = await getAriaPressed(page, 'button#bold');5 expect(ariaPressed).toBe('false');6});
Using AI Code Generation
1const { getAriaPressed } = require('playwright/lib/utils/aria');2const { getAttribute } = require('playwright/lib/utils/attribute');3const { getInnerText } = require('playwright/lib/utils/innerText');4const { getVisibleText } = require('playwright/lib/utils/visibleText');5const { getAttribute } = require('playwright/lib/utils/attribute');6const { getInnerText } = require('playwright/lib/utils/innerText');7const { getVisibleText } = require('playwright/lib/utils/visibleText');8const { getAttribute } = require('playwright/lib/utils/attribute');9const { getInnerText } = require('playwright/lib/utils/innerText');10const { getVisibleText } = require('playwright/lib/utils/visibleText');11const { getAttribute } = require('playwright/lib/utils/attribute');12const { getInnerText } = require('playwright/lib/utils/innerText');13const { getVisibleText } = require('playwright/lib/utils/visibleText');14const { getAttribute } = require('playwright/lib/utils/attribute');15const { getInnerText } = require('playwright/lib/utils/innerText');16const { getVisibleText } = require('playwright/lib/utils/visibleText');17const { getAttribute } = require('playwright/lib/utils/attribute');18const { getInnerText
Using AI Code Generation
1const { getAriaPressed } = require('@playwright/test/lib/utils/internal-api');2const { test, expect } = require('@playwright/test');3test('getAriaPressed', async ({ page }) => {4 const ariaPressed = await getAriaPressed(page, 'text="Docs"');5 expect(ariaPressed).toBe('true');6});7const { getAriaPressed } = require('@playwright/test/lib/utils/internal-api');8const { test, expect } = require('@playwright/test');9test('getAriaPressed', async ({ page }) => {10 const ariaPressed = await getAriaPressed(page, 'button:has-text("Get started")');11 expect(ariaPressed).toBe('false');12});13const { getAriaPressed } = require('@playwright/test/lib/utils/internal-api');14const { test, expect } = require('@playwright/test');15test('getAriaPressed', async ({ page }) => {16 const ariaPressed = await getAriaPressed(page, 'button:has-text("Get started")');17 expect(ariaPressed).toBe('false');18});19const { getAriaPressed } = require('@playwright/test/lib/utils/internal-api');20const { test, expect } = require('@playwright/test');21test('getAriaPressed', async ({ page }) => {22 const ariaPressed = await getAriaPressed(page, 'button:has-text("Get started")');23 expect(ariaPressed).toBe('false');24});
Jest + Playwright - Test callbacks of event-based DOM library
firefox browser does not start in playwright
Is it possible to get the selector from a locator object in playwright?
How to run a list of test suites in a single file concurrently in jest?
Running Playwright in Azure Function
firefox browser does not start in playwright
This question is quite close to a "need more focus" question. But let's try to give it some focus:
Does Playwright has access to the cPicker object on the page? Does it has access to the window object?
Yes, you can access both cPicker and the window object inside an evaluate call.
Should I trigger the events from the HTML file itself, and in the callbacks, print in the DOM the result, in some dummy-element, and then infer from that dummy element text that the callbacks fired?
Exactly, or you can assign values to a javascript variable:
const cPicker = new ColorPicker({
onClickOutside(e){
},
onInput(color){
window['color'] = color;
},
onChange(color){
window['result'] = color;
}
})
And then
it('Should call all callbacks with correct arguments', async() => {
await page.goto(`http://localhost:5000/tests/visual/basic.html`, {waitUntil:'load'})
// Wait until the next frame
await page.evaluate(() => new Promise(requestAnimationFrame))
// Act
// Assert
const result = await page.evaluate(() => window['color']);
// Check the value
})
Check out the latest blogs from LambdaTest on this topic:
Native apps are developed specifically for one platform. Hence they are fast and deliver superior performance. They can be downloaded from various app stores and are not accessible through browsers.
One of the essential parts when performing automated UI testing, whether using Selenium or another framework, is identifying the correct web elements the tests will interact with. However, if the web elements are not located correctly, you might get NoSuchElementException in Selenium. This would cause a false negative result because we won’t get to the actual functionality check. Instead, our test will fail simply because it failed to interact with the correct element.
Smartphones have changed the way humans interact with technology. Be it travel, fitness, lifestyle, video games, or even services, it’s all just a few touches away (quite literally so). We only need to look at the growing throngs of smartphone or tablet users vs. desktop users to grasp this reality.
As part of one of my consulting efforts, I worked with a mid-sized company that was looking to move toward a more agile manner of developing software. As with any shift in work style, there is some bewilderment and, for some, considerable anxiety. People are being challenged to leave their comfort zones and embrace a continuously changing, dynamic working environment. And, dare I say it, testing may be the most ‘disturbed’ of the software roles in agile development.
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!