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

Add robotframework-seleniumlibrary #149

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Robot-Framework/resources/common_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,19 @@ Check that the application was started
Should Not Be Empty ${app_pids} ${app_name} is not started
Log To Console ${app_name} is started

Check Application Login Page
[Documentation] Check that application is able to connect to Internet and login page is available
[Arguments] ${application}=outlook
@{browser_ids} SeleniumLibrary.Get Browser Ids
Log ${browser_ids}

${source} SeleniumLibrary.Get source
Log ${source}

${handles} SeleniumLibrary.Get Window Handles
Log ${handles}

Check If Ping Fails
[Documentation] Check that ping is not getting response from host
# ${out} Run and Return RC ping ${DEVICE_IP_ADDRESS} -c 1
${result} Run Process ping ${DEVICE_IP_ADDRESS} -c1 timeout=1s
Should Not Be Equal ${result.rc} ${0}
45 changes: 35 additions & 10 deletions Robot-Framework/test-suites/bat-tests/business_vm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,36 @@
*** Settings ***
Documentation Testing Business VM
Force Tags bat businessvm lenovo-x1
Resource ../../config/variables.robot
Resource ../../resources/ssh_keywords.resource
Resource ../../resources/virtualization_keywords.resource
Resource ../../config/variables.robot
Resource ../../resources/common_keywords.resource
Library SeleniumLibrary

# Suite Teardown Run Keywords Remove Wifi configuration AND Close All Connections
Suite Teardown Close All Connections
Test Setup Run Keywords Connect to netvm AND Connect to VM ${GUI_VM}

*** Variables ***
${ta_wifi_ssid} TII-Testautomation
${netvm_ssh} ${EMPTY}

*** Test Cases ***

*** Test Cases ***
Start Microsoft Outlook on LenovoX1
[Documentation] Start Microsoft Outlook in dedicated VM and verify process started
[Tags] outlook SP-T186
Connect to netvm
Connect to VM ${GUI_VM}
[Tags] outlook SP-T186 SSRCSP-5328
# Configure wifi ${netvm_ssh} ${ta_wifi_ssid} ${TA_WIFI_PSWD} lenovo=True
Start XDG application "Microsoft Outlook"
Connect to VM ${BUSINESS_VM}
Check that the application was started outlook
Check Application Login Page
[Teardown] Kill process @{app_pids}

Start Microsoft 365 on LenovoX1
[Documentation] Start Microsoft 365 in dedicated VM and verify process started
[Tags] microsoft365 SP-T188
Connect to netvm
Connect to VM ${GUI_VM}
Start XDG application "Microsoft 365"
Connect to VM ${BUSINESS_VM}
Check that the application was started microsoft365
Expand All @@ -37,8 +42,6 @@ Start Microsoft 365 on LenovoX1
Start Microsoft Teams on LenovoX1
[Documentation] Start Microsoft Teams in dedicated VM and verify process started
[Tags] teams SP-T187
Connect to netvm
Connect to VM ${GUI_VM}
Start XDG application Teams
Connect to VM ${BUSINESS_VM}
Check that the application was started teams
Expand All @@ -47,9 +50,31 @@ Start Microsoft Teams on LenovoX1
Start Microsoft Trusted Browser on LenovoX1
[Documentation] Start Microsoft Trusted Browser in dedicated VM and verify process started
[Tags] trusted_browser SP-T189
Connect to netvm
Connect to VM ${GUI_VM}
Start XDG application "Trusted Browser"
Connect to VM ${BUSINESS_VM}
Check that the application was started chromium
[Teardown] Kill process @{app_pids}

*** Keywords ***
# Remove these after rebasing logging pr
Configure wifi
[Arguments] ${netvm_ssh} ${SSID} ${passw} ${lenovo}=False
Switch Connection ${netvm_ssh}
Log To Console Configuring Wifi
IF ${lenovo}
Execute Command nmcli dev wifi connect ${SSID} password ${passw} sudo=True sudo_password=${PASSWORD}
ELSE
Execute Command sh -c "wpa_passphrase ${SSID} ${passw} > /etc/wpa_supplicant.conf" sudo=True sudo_password=${PASSWORD}
Execute Command systemctl restart wpa_supplicant.service sudo=True sudo_password=${PASSWORD}
END

Remove Wifi configuration
[Arguments] ${lenovo}=False
Switch Connection ${netvm_ssh}
Log To Console Removing Wifi configuration
IF ${lenovo}
Execute Command nmcli con down id ${SSID} sudo=True sudo_password=${PASSWORD}
ELSE
Execute Command rm /etc/wpa_supplicant.conf sudo=True sudo_password=${PASSWORD}
Execute Command systemctl restart wpa_supplicant.service sudo=True sudo_password=${PASSWORD}
END
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "A flake for for running Robot Framework tests";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};

Expand All @@ -26,10 +26,12 @@
robotframework-advancedlogging = self.packages.${system}.robotframework-advancedlogging;
robotframework-jsonlibrary = self.packages.${system}.robotframework-jsonlibrary;
robotframework-retryfailed = self.packages.${system}.robotframework-retryfailed;
robotframework-seleniumlibrary = self.packages.${system}.robotframework-seleniumlibrary;
robotframework-seriallibrary = self.packages.${system}.robotframework-seriallibrary;
};
robotframework-jsonlibrary = pkgs.python3Packages.callPackage ./pkgs/robotframework-jsonlibrary {};
robotframework-retryfailed = pkgs.python3Packages.callPackage ./pkgs/robotframework-retryfailed {};
robotframework-seleniumlibrary = pkgs.python3Packages.callPackage ./pkgs/robotframework-seleniumlibrary {};
robotframework-seriallibrary = pkgs.python3Packages.callPackage ./pkgs/robotframework-seriallibrary {};
robotframework-advancedlogging = pkgs.python3Packages.callPackage ./pkgs/robotframework-advancedlogging {};
pkcs7 = pkgs.python3Packages.callPackage ./pkgs/pkcs7 {}; # Requirement of PyP100
Expand All @@ -47,6 +49,7 @@
robotframework
self.packages.${system}.robotframework-jsonlibrary
self.packages.${system}.robotframework-retryfailed
self.packages.${system}.robotframework-seleniumlibrary
self.packages.${system}.robotframework-seriallibrary
self.packages.${system}.robotframework-advancedlogging
self.packages.${system}.PyP100
Expand Down
57 changes: 57 additions & 0 deletions pkgs/robotframework-seleniumlibrary/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
click,
robotframework,
robotframework-pythonlibcore,
selenium,
approvaltests,
pytest-mockito,
pytestCheckHook,
robotstatuschecker,
}:

buildPythonPackage rec {
pname = "robotframework-seleniumlibrary";
version = "6.6.1";

# no tests included in PyPI tarball
src = fetchFromGitHub {
owner = "robotframework";
repo = "SeleniumLibrary";
rev = "refs/tags/v${version}";
sha256 = "sha256-ULY0FH1RFQIlhS45LU3vUKi6urZJHiDgi6NdqU5tV2g=";
};

format = "setuptools";

propagatedBuildInputs = [
click
robotframework
robotframework-pythonlibcore
selenium
];

nativeCheckInputs = [
approvaltests
pytest-mockito
pytestCheckHook
robotstatuschecker
];

preCheck = ''
mkdir utest/output_dir
'';

__darwinAllowLocalNetworking = true;

meta = {
changelog = "https://github.com/robotframework/SeleniumLibrary/blob/${src.rev}/docs/SeleniumLibrary-${version}.rst";
description = "Web testing library for Robot Framework";
homepage = "https://github.com/robotframework/SeleniumLibrary";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dotlambda ];
};
}
Loading