-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Booking products tests #2438
base: develop
Are you sure you want to change the base?
Changes from 9 commits
9188420
3925df1
453c2b7
210f44e
abc9ffd
480ab5d
5220725
6c21828
903925f
9f5c971
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5229,7 +5229,13 @@ export const selector = { | |
accommodationBooking: '#\\_is_dokan_accommodation', | ||
productCategory: '#select2-product_cat-container', | ||
productCategoryInput: '.select2-search--dropdown > .select2-search__field', | ||
tags: '.select2-search__field', | ||
// tags | ||
tags: { | ||
tagInput: '//select[@id="product_tag"]/..//input[@class="select2-search__field"]', | ||
searchedTag: (tagName: string) => `//li[@class="select2-results__option select2-results__option--highlighted" and normalize-space(text())="${tagName}"]`, | ||
selectedTags: (tagName: string) => `//li[@class="select2-selection__choice" and contains(., "${tagName}")]`, | ||
removeSelectedTags: (tagName: string) => `//li[@class="select2-selection__choice" and contains(., "${tagName}")]//span[@class="select2-selection__choice__remove"]`, | ||
}, | ||
Comment on lines
+5232
to
+5238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Review tag selector implementation for consistency and maintainability The tag selector implementation has been updated with the following structure:
Consider the following improvements: - tagInput: '//select[@id="product_tag"]/..//input[@class="select2-search__field"]',
+ tagInput: '.select2-search__field',
- searchedTag: (tagName: string) => `//li[@class="select2-results__option select2-results__option--highlighted" and normalize-space(text())="${tagName}"]`,
+ searchedTag: (tagName: string) => `.select2-results__option--highlighted:contains("${tagName}")`, Rationale:
|
||
|
||
// Accommodation Booking Options | ||
minimumNumberOfNightsAllowedInABooking: '#\\_wc_booking_min_duration', | ||
|
@@ -5240,9 +5246,9 @@ export const selector = { | |
// General Booking Options | ||
bookingDurationType: '#\\_wc_booking_duration_type', | ||
bookingDuration: 'input#\\_wc_booking_duration', | ||
bookingDurationUnit: '#\\_wc_booking_duration_unit', | ||
bookingDurationMin: 'input#\\_wc_booking_min_duration', | ||
bookingDurationMax: 'input#\\_wc_booking_max_duration', | ||
bookingDurationUnit: '#\\_wc_booking_duration_unit', | ||
|
||
calendarDisplayMode: '#\\_wc_booking_calendar_display_mode', | ||
|
||
|
@@ -5274,7 +5280,7 @@ export const selector = { | |
maximumBookingWindowIntoTheFutureDateUnit: '#\\_wc_booking_max_date_unit', | ||
requireABufferPeriodOfMonthsBetweenBookings: '#\\_wc_booking_buffer_period', | ||
adjacentBuffering: '#\\_wc_booking_apply_adjacent_buffer', | ||
allDatesAre: '#\\_wc_booking_default_date_availability', | ||
allDatesAvailability: '#\\_wc_booking_default_date_availability', | ||
checkRulesAgainst: '#\\_wc_booking_check_availability_against', | ||
restrictStartAndEndDays: '#dokan_booking_has_restricted_days_field', | ||
sunday: '#\\_wc_booking_restricted_days\\[0\\]', | ||
|
@@ -5313,34 +5319,38 @@ export const selector = { | |
// Extra Options | ||
|
||
// Has Persons | ||
hasPersons: '#\\_wc_booking_has_persons', | ||
minPersons: '#\\_wc_booking_min_persons_group', | ||
maxPersons: '#\\_wc_booking_max_persons_group', | ||
multiplyAllCostsByPersonCount: '#\\_wc_booking_person_cost_multiplier', | ||
countPersonsAsBookings: '#\\_wc_booking_person_qty_multiplier', | ||
enablePersonTypes: '#\\_wc_booking_has_person_types', | ||
hasPersons: 'input#\\_wc_booking_has_persons', | ||
minPersons: 'div#bookings_persons #\\_wc_booking_min_persons_group', | ||
maxPersons: 'div#bookings_persons #\\_wc_booking_max_persons_group', | ||
multiplyAllCostsByPersonCount: 'div#bookings_persons #\\_wc_booking_person_cost_multiplier', | ||
countPersonsAsBookings: 'div#bookings_persons #\\_wc_booking_person_qty_multiplier', | ||
enablePersonTypes: 'div#bookings_persons #\\_wc_booking_has_person_types', | ||
|
||
// Add Person | ||
addPersonType: '.add_person', | ||
personTypeName: '//label[contains(text(),"Person Type Name:")]/..//input', | ||
personBaseCost: '//label[contains(text(),"Base Cost:")]/..//input', | ||
personBlockCost: '//label[contains(text(),"Block Cost:")]/..//input', | ||
description: '.person_description', | ||
min: '//label[contains(text(),"Min:")]/..//input', | ||
max: '//label[contains(text(),"Max:")]/..//input', | ||
unlink: '.unlink_booking_person', // invokes default js alert | ||
addPersonType: 'button.add_person', | ||
person: { | ||
typeName: '//div[@id="bookings_persons"]//label[contains(text(),"Person Type Name:")]/..//input', | ||
baseCost: '//div[@id="bookings_persons"]//label[contains(text(),"Base Cost:")]/..//input', | ||
blockCost: '//div[@id="bookings_persons"]//label[contains(text(),"Block Cost:")]/..//input', | ||
description: 'input.person_description', | ||
min: '//div[@id="bookings_persons"]//label[contains(text(),"Min:")]/..//input', | ||
max: '//div[@id="bookings_persons"]//label[contains(text(),"Max:")]/..//input', | ||
}, | ||
unlink: 'button.unlink_booking_person', // invokes default js alert | ||
remove: 'button.remove_booking_person', | ||
confirmRemove: 'button.swal2-confirm', | ||
|
||
// Has Resources | ||
hasResources: '#\\_wc_booking_has_resources', | ||
hasResources: 'input#\\_wc_booking_has_resources', | ||
|
||
// Add Resource | ||
label: '#\\_wc_booking_resource_label', | ||
resourcesAre: '#\\_wc_booking_resources_assignment', | ||
addResourceId: '.add_resource_id', | ||
addResource: '.add_resource', | ||
resourceBaseCost: '//label[contains(text(),"Base Cost:")]/..//input', | ||
resourceBlockCost: '//label[contains(text(),"Block Cost:")]/..//input', | ||
removeResource: '.remove_booking_resource.button', // invokes default js alert | ||
label: 'div#bookings_resources input#\\_wc_booking_resource_label', | ||
resourcesAllocation: 'div#bookings_resources select#\\_wc_booking_resources_assignment', | ||
addResourceId: 'div#bookings_resources select.add_resource_id', | ||
addResource: 'button.add_resource', | ||
resourceBaseCost: '//div[@id="bookings_resources"]//label[contains(text(),"Base Cost:")]/..//input', | ||
resourceBlockCost: '//div[@id="bookings_resources"]//label[contains(text(),"Block Cost:")]/..//input', | ||
removeResource: 'button.remove_booking_resource', // invokes default js alert | ||
|
||
// Short Description | ||
shortDescriptionIframe: '.dokan-product-short-description iframe', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove redundant input field clearing
The
clearInputField
call is unnecessary sinceclearAndType
on the next line already handles clearing the input field before typing the new value.- await this.clearInputField(productsVendor.minMax.maximumQuantity);