Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove the getSelectedEditors integration test helper function #19277

Conversation

timvandermeij
Copy link
Contributor

@timvandermeij timvandermeij commented Jan 1, 2025

The getSelectedEditors function is largely a copy of the getEditors function, with three small differences:

  1. getEditors allows getting any kind of editor whereas getSelectedEditors is harcoded to only getting selected editors.
  2. getEditors returns editor selectors (strings) whereas getSelectedEditors returns editor IDs (integers).
  3. getSelectedEditors returns a sorted array of editor IDs whereas getEditors does not ensure that the array is sorted.

This commit makes the getEditors function a drop-in replacement for the getSelectedEditors function to deduplicate the code and to have a unified way of getting editors.

Note that we don't actually use the contents of the returned array (only its length), so we can safely change getEditors to return a sorted array of integer editor IDs instead. Sorting the array makes the return value deterministic, which is a nice property for test stability, and integer IDs are also easier to handle in test assertions. Note that the corresponding selector strings can also easily be obtained from the integer IDs using the getEditorSelector function if needed.

Fixes a part of #19065.

The `getSelectedEditors` function is largely a copy of the `getEditors`
function, with three small differences:

1. `getEditors` allows getting any kind of editor whereas
   `getSelectedEditors` is harcoded to only getting selected editors.
2. `getEditors` returns editor selectors (strings) whereas
   `getSelectedEditors` returns editor IDs (integers).
3. `getSelectedEditors` returns a sorted array of editor IDs whereas
   `getEditors` does not ensure that the array is sorted.

This commit makes the `getEditors` function a drop-in replacement for
the `getSelectedEditors` function to deduplicate the code and to have a
unified way of getting editors.

Note that we don't actually use the contents of the returned array
(only its length), so we can safely change `getEditors` to return a
sorted array of integer editor IDs instead. Sorting the array makes the
return value deterministic, which is a nice property for test stability,
and integer IDs are also easier to handle in test assertions. Note that
the corresponding selector strings can also easily be obtained from the
integer IDs using the `getEditorSelector` function if needed.
@timvandermeij timvandermeij force-pushed the integration-tests-remove-getselectededitors branch from e30dfa1 to 9d09c56 Compare January 1, 2025 15:00
@timvandermeij
Copy link
Contributor Author

/botio integrationtest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @timvandermeij received. Current queue size: 0

Live output at: http://54.193.163.58:8877/278436fa64389db/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/402430d98017adb/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/402430d98017adb/output.txt

Total script time: 9.66 mins

  • Integration Tests: FAILED

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/278436fa64389db/output.txt

Total script time: 24.49 mins

  • Integration Tests: FAILED

@Snuffleupagus
Copy link
Collaborator

/botio integrationtest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/8b70a6221ecbb75/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/2c6f4d86a8de172/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/8b70a6221ecbb75/output.txt

Total script time: 10.30 mins

  • Integration Tests: FAILED

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/2c6f4d86a8de172/output.txt

Total script time: 24.03 mins

  • Integration Tests: FAILED

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, thank you.

@timvandermeij timvandermeij merged commit 7f5f4d0 into mozilla:master Jan 4, 2025
7 checks passed
@timvandermeij timvandermeij deleted the integration-tests-remove-getselectededitors branch January 4, 2025 12:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants