Skip to content

Wait for the stock list and the bulk update request in the stock bulk edit [OS-146] - #1141

Merged
Progi1984 merged 2 commits into
PrestaShop:mainfrom
mattgoud:fix/stock-bulk-edit-wait-for-update
Oct 30, 2026
Merged

Progi1984 merged 2 commits into
PrestaShop:mainfrom
mattgoud:fix/stock-bulk-edit-wait-for-update

Conversation

@mattgoud

Copy link
Copy Markdown
Contributor
Questions Answers
Description? The stocks page loads its products by ajax (GET api/stocks/), and until the answer comes the table only holds a placeholder row. bulkEditQuantityWithInput selected all products, typed the quantity and clicked "Apply" right away: when the list was not loaded yet, nothing was selected, no update request was sent, and the method waited 120 s for an api/stocks/products response that never came (it also accepted any response of that URL, and only started listening after the click). Both bulk edit methods now wait for a real product row before selecting, then a shared applyBulkEditQuantity waits for the "Apply" button to be enabled, listens for the POST api/stocks/products before clicking, and reads the alert. The unused button.update-qty selector (which also matched the row buttons) is replaced by the existing product actions one. The stock page and its bulk update are the same on 8.2.x, 9.2.x and develop.
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #1138
Sponsor company @PrestaShopCorp
How to test? CI: "BO - Stocks - Movements : Filter by category, movement type, employee and period" and "Sort and pagination" (stocks movements) should stop failing on "should add to quantities by setting input value". Checked locally on a 9.2.x shop with the page object itself, opening the stocks page and calling bulkEditQuantityWithInput right away: before, 5 out of 5 waited 120 s and failed with page.waitForResponse: Timeout 120000ms exceeded; after, 10 out of 10 got "Stock successfully updated" in less than 1.5 s.

@mattgoud
mattgoud requested a review from a team as a code owner October 29, 2026 13:34
@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Oct 29, 2026
@mattgoud mattgoud changed the title Wait for the stock list and the bulk update request in the stock bulk edit Wait for the stock list and the bulk update request in the stock bulk edit [OS-146] Oct 29, 2026
@ps-jarvis ps-jarvis added the Waiting for QA Status: Action required, Waiting for test feedback label Oct 29, 2026
@ps-jarvis ps-jarvis moved this from Ready for review to To be tested in PR Dashboard Oct 29, 2026

@jolelievre jolelievre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but to validate and merge this one we need a test PR
Please create a PR on the core that integrates this library branch and run a full UI tests campaign, this will both validate it doesn't break the existing tests And we should be able to see if the related campaign is more stable via the number of retries

*/
private async applyBulkEditQuantity(page: Page): Promise<string> {
// The button is only enabled once the new quantity is taken into account
await this.waitForVisibleSelector(page, `${this.applyQuantityButton}:not([disabled])`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the selector to selector list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok @Progi1984 done

@ps-jarvis ps-jarvis moved this from To be tested to Waiting for author in PR Dashboard Oct 29, 2026
@mattgoud

Copy link
Copy Markdown
Contributor Author

ok @jolelievre, test PR on the core: PrestaShop/PrestaShop#43374

@jolelievre

Copy link
Copy Markdown
Contributor

Great, once @Progi1984 validates this PR and the ui tests are all green on develop, we can merge this one and update the 9.2.x branch with the latest content of the lib, this should stabilize the future campaigns

@Progi1984
Progi1984 merged commit ed7e98a into PrestaShop:main Oct 30, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting for author to Merged in PR Dashboard Oct 30, 2026
@Progi1984 Progi1984 added this to the 0.0.12 milestone Oct 30, 2026
@ps-jarvis

Copy link
Copy Markdown

PR merged, well done!

Message to @PrestaShop/committers: do not forget to milestone it before the merge.

@mattgoud

mattgoud commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@jolelievre the full campaign on 9.2.x with this fix is green: https://github.com/mattgoud/ga.tests.ui.pr/actions/runs/41077769683 (stock bulk edit tests passed in all 3 attempts, the retries were unrelated flaky tests). The bump on 9.2.x is PrestaShop/PrestaShop#43378.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting for author Waiting for QA Status: Action required, Waiting for test feedback

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

bulkEditQuantityWithInput listens for the response after the click and accepts the stock list response

5 participants