Skip to content
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

nixos/tests/microsoft-edge: Reuse chromium tests to add tests for microsoft-edge #257165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rhysmdnz
Copy link
Contributor

@rhysmdnz rhysmdnz commented Sep 25, 2023

Description of changes

Adds nixos tests for Microsoft edge

@aszlig @primeos this steps on your chromium tests a bunch with minor capitalisation changes, and reusing the test script. Would appreciate feedback on better ways to do this / make sure I'm not causing you to much future trouble.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/2829

Copy link
Member

@aszlig aszlig left a comment

Choose a reason for hiding this comment

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

Commented with a few minor nitpicks.

I'd probably move the Edge and Chrome/Chromium tests into a dedicated directory and parametrise on something like a common.nix. That way it's less likely that changes to the Chromium test will accidentally break the test for Edge as well.

Ultimately this is for the current Chromium maintainers to decide since I no longer maintain Chromium.

@@ -119,7 +119,7 @@ mapAttrs (channel: chromiumPkg: makeTest {
machine.wait_until_succeeds(
ru(
"${xdo "create_new_win-wait_for_window" ''
search --onlyvisible --name "New Tab"
search --onlyvisible --name "New (t|T)ab"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
search --onlyvisible --name "New (t|T)ab"
search --onlyvisible --name "New [tT]ab"

@@ -132,7 +132,7 @@ mapAttrs (channel: chromiumPkg: makeTest {
machine.wait_until_succeeds(
ru(
"${xdo "close_new_tab_win-select_main_window" ''
search --onlyvisible --name "New Tab"
search --onlyvisible --name "New (t|T)ab"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
search --onlyvisible --name "New (t|T)ab"
search --onlyvisible --name "New [tT]ab"

@@ -143,7 +143,7 @@ mapAttrs (channel: chromiumPkg: makeTest {
machine.wait_until_fails(
ru(
"${xdo "close_new_tab_win-wait_for_close" ''
search --onlyvisible --name "New Tab"
search --onlyvisible --name "New (t|T)ab"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
search --onlyvisible --name "New (t|T)ab"
search --onlyvisible --name "New [tT]ab"

@@ -152,7 +152,7 @@ mapAttrs (channel: chromiumPkg: makeTest {
@contextmanager
def test_new_win(description, url, window_name):
create_new_win()
machine.wait_for_window("New Tab")
machine.wait_for_window("New (:?t|T)ab")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
machine.wait_for_window("New (:?t|T)ab")
machine.wait_for_window("New [tT]ab")

@@ -254,9 +256,9 @@ mapAttrs (channel: chromiumPkg: makeTest {
# TODO: Fix copying all of the text to the clipboard


with test_new_win("version_info", "chrome://version", "About Version") as clipboard:
with test_new_win("version_info", "chrome://version", "About (:?v|V)ersion") as clipboard:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
with test_new_win("version_info", "chrome://version", "About (:?v|V)ersion") as clipboard:
with test_new_win("version_info", "chrome://version", "About [vV]ersion") as clipboard:

filters = [
r"${chromiumPkg.version} \(Official Build",
r"${chromiumPkg.version} \(Official (:?b|B)uild",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
r"${chromiumPkg.version} \(Official (:?b|B)uild",
r"${chromiumPkg.version} \(Official [bB]uild",

maintainers = with maintainers; [ rhysmdnz ];
};

nodes.machine = { ... }: {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
nodes.machine = { ... }: {
nodes.machine = {

Comment on lines 40 to 41


Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines 10 to 11
with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;
Copy link
Member

Choose a reason for hiding this comment

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

I'd try to avoid to bring too many attributes into the full scope (see https://nix.dev/recipes/best-practices#with-scopes) and instead either use full references or explicitly inherit the ones you need into the scope.

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

Successfully merging this pull request may close these issues.

None yet

4 participants