-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Improve test harness and add browser pooling #3871
Conversation
packages/test/page-object/src/globals/pageConditions/allImagesLoaded.js
Outdated
Show resolved
Hide resolved
packages/test/page-object/src/globals/pageConditions/allOutgoingActivitiesSent.js
Outdated
Show resolved
Hide resolved
packages/test/page-object/src/globals/pageConditions/minNumActivitiesShown.js
Outdated
Show resolved
Hide resolved
packages/test/page-object/src/globals/pageConditions/uiConnected.js
Outdated
Show resolved
Hide resolved
packages/test/page-object/src/globals/testHelpers/activityGrouping/ActivityGroupingPanel.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Corina <[email protected]>
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.
Commented.
3 things to discuss offline. I have resolved all comments. Please let me know if I overlooked anything. 😉 |
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.
LGTM - don't see a need to wait for our 1:1 to approve :)
* Update husky and lint-staged * Add debug * Only test transcript navigation tests * Add message * Disable ESLint * Run transcript.navigation tests only * Add more tests * Add messages * Fix syntax error * Update logic * Add new message * Add message * Update reporter * Add message * Log even if error * Clean up logs * Update splice * Fix scrollStabilized * Fix timeout * Add testharness2 * Move transcript.navigation.escapeKey * Move transcript.activityGrouping * Move transcript.activityGrouping * Clean up * Move transcript.navigation.pageUpDown * Move transcript.navigation.adaptiveCard.focusInput * Move transcript.navigation.* * Move some accessibility tests * Move more accessibility tests * Move all accessibility tests * Move all activities.* tests * Move activityGrouping.* tests * Move adaptiveCards.* and autoScroll.* * Move avatar.* tests * Move cardAction.* tests * Move carousel.* tests * Move chatAdapter.* tests * Move conversationStartProperties.* tests * Move deprecated.* and directLine.* tests * Move all focusManagement.* tests * Move heroCard.* tests * Move hooks.* tests * Move locale.* and markdown.* tests * Move middleware.* tests * Move newMessageButton.* tests * Move offlineUI.* tests * Move replyToId.* tests * Move sendBox.* tests * Move sendFiles.* tests * Move speechRecognition.* tests * Move styleOptions.* tests * Move suggestedActions.* tests * Move timestamp.* tests * Move toast.* tests * Move transcript.* tests * Move use*.* tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix Docker script * Improve toolchain * Default to no-watch * Fix tests * Fix tests * Fix tests * Fix tests and clean up * Fix build * Add WD pool for Jest * Update housekeeping * Clean up * Add jestserver * Update housekeep * Touchup * Consistent window size * Gracefully shutdown Jest server * Gracefully shutdown Jest server * Clean up * Clean up instance after release * Ignore get logs error * Clean up * Housekeep asynchronously * Rename * Dump logs before quit * Use global-agent * Improve test reliability * Take fullscreen shot * Move session preparation code * Fix attachment * Improve error stack * Speed up * Fix test * Fix test * Prepare session on reuse * Update snapshot * More __operation__ * Fix code coverage * Increase shm_size * Converge * Fix tests * Use stabilized * Use stabilized * Wait for focus * Remove one screenshot * Rename folders * Build test harness * Clean up test harness * Renames * Clean up * Fix build * Fix test * Remove unneeded plugin * Fix test * Fix tests * Fix tests * Fix tests * Fix test * Add comments * Add entry * Add eslint * Enable eslint * Fix ESLint * Fix ESLint * Update husky * Update lint-staged * Update precommit * Update precommit * Update comment * Remove unnecessary line * Screenshot after fail * Wait for image load before snapshot * Wait for activity to be focused * Attach last screenshot * Wait for activities * Wait for capacity * Add screenshot location * Fix error message * Fix filename * Add entry * Clean up * Fix tests * Add comment * Clean up * Clean up * Fix test reliability * Add tolerance * Update entry * Improve test reliability * Remove loop * Update entry * Improve test reliability * Add all attachments * Apply PR suggestions * Apply suggestions from code review Co-authored-by: Corina <[email protected]> * Add comment * Namespacing accessibility.delayActivity * Update tofu * Fix test * Fix test * Fix test * Test reliability * Apply PR suggestions * Remove unneeded marshal * Update message Co-authored-by: Corina <[email protected]>
Changelog Entry
Added
Fixed
husky
,lint-staged
and correspondingprecommit
scripts, by @compulim, in PR #3871Description
Goals of this PR:
sendKeys
to send TAB and other special keyshusky
,lint-staged
and Gitpre-commit
hookNew "HTML" test harness
Today/yesterday, when we develop some HTML tests that requires special keyboard input (e.g. TAB), it can only be automated via Jest/WebDriver, but not while developing (in pure Chrome). To mitigate the issue, we log to console and ask the developer to do the input manually. This means, tests running in dev mode and Jest/CI could have different behaviors.
We added a new
npm run browser
command to start a Chrome that can be remotely controlled by a corresponding WebDriver client. It can send special keyboard inputs, emulated pointer input, and take screenshots.Please download a matching version of
ChromeDriver.exe
and put it under the project root. If you are on WSL, you will needchmod +x ChromeDriver.exe
to enable execute permission.npm run browser
to start a browser session for HTML tests__tests__/*.html
will use WebDriver to run tests on themnpm run docker
to start a Docker ComposeSeparate test harness and test page object model
Today/yesterday, test harness and page object model are mingled together. Clearer responsibilities on packages will increase DX.
It was
packages/testharness
, and now into 2 packages:packages/test/harness
andpackages/test/page-object-model
.regenerator-runtime
, give a much better error stackTest code changed
body
element will have a class namedjest
, if the page is running under Jest (or CI)await pageConditions.uiConnected()
, instead ofawait host.wait(conditions.uiConnected(), 15000)
run(async () => {})
, instead of IIFE withhost.done()
orhost.error()
xxxStabilized
code by leveraging the newpageConditions.stabilized()
scrollStabilized()
or the advancedscrollToBottomCompleted()
for usageBrowser session pooling
Today/yesterday, browser sessions are disposed immediately after tests. It takes about 1 second to launch a new browser session. With ~240 HTML tests, it took 4 extra minutes.
This feature reduce that 4 minutes to (240 / 5) * 1s ~= 48 * 1s = 48 seconds (-192 seconds).
Added pooling by a WebDriver proxy, given capabilities are unchanged.
about:blank
(0, 0)
Design
The "WebDriver session pooling server" proxy will intercepts new session and delete session requests.
We move window resizing from capabilities to runtime. This means all tests no longer have unique capabilities, this enable simple session pooling.
Every instance in the pool will survive 5 runs, or 3 minutes maximum. We assume each session will take up to 30 seconds. That means, after hitting 2:30 minutes, the instance will no longer to acquire. If it was acquired, it will be continue available until release.
Specific Changes
(Other than specified above)
Dockerfile-xxx
toxxx.dockerfile
for VSCode syntax highlightingnpm run docker
to pick up changes and restart images automaticallytestharness
, means,npm install
ornpm run bootstrap
will be fasterCHANGELOG.md
I have updated documentation(Will do in another PR)Review Checklist
Accessibility reviewed (tab order, content readability, alt text, color contrast)Browser and platform compatibilities reviewedCSS styles reviewed (minimal rules, noz-index
)Documents reviewed (docs, samples, live demo)Internationalization reviewed (strings, unit formatting)package.json
andpackage-lock.json
reviewedSecurity reviewed (no data URIs, check for nonce leak)