-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from atlassian/release/2.0.0
Release 2.0.0
- Loading branch information
Showing
42 changed files
with
1,994 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.support import expected_conditions as ec | ||
|
||
from selenium_ui.confluence.modules import _wait_until | ||
from selenium_ui.conftest import print_timing | ||
from util.conf import BITBUCKET_SETTINGS | ||
|
||
APPLICATION_URL = BITBUCKET_SETTINGS.server_url | ||
timeout = 20 | ||
from selenium_ui.base_page import BasePage | ||
|
||
|
||
def custom_action(webdriver, datasets): | ||
page = BasePage(webdriver) | ||
@print_timing | ||
def measure(webdriver, interaction): | ||
@print_timing | ||
def measure(webdriver, interaction): | ||
webdriver.get(f'{APPLICATION_URL}/plugins/servlet/some-app/reporter') | ||
_wait_until(webdriver, ec.visibility_of_element_located((By.ID, "plugin-element")), interaction) | ||
page.go_to_url(f"{BITBUCKET_SETTINGS.server_url}/plugin/report") | ||
page.wait_until_visible((By.ID, 'report_app_element_id'), interaction) | ||
|
||
measure(webdriver, 'selenium_app_custom_action:view_report') | ||
|
||
@print_timing | ||
def measure(webdriver, interaction): | ||
webdriver.get(f'{APPLICATION_URL}/plugins/servlet/some-app/administration') | ||
_wait_until(webdriver, ec.visibility_of_element_located((By.ID, "plugin-element")), interaction) | ||
page.go_to_url(f"{BITBUCKET_SETTINGS.server_url}/plugin/dashboard") | ||
page.wait_until_visible((By.ID, 'dashboard_app_element_id'), interaction) | ||
|
||
measure(webdriver, 'selenium_app_custom_action:view_dashboard') | ||
|
||
measure(webdriver, 'selenium_app_custom_action') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.support import expected_conditions as ec | ||
|
||
from selenium_ui.confluence.modules import _wait_until | ||
from selenium_ui.conftest import print_timing | ||
from util.conf import CONFLUENCE_SETTINGS | ||
|
||
APPLICATION_URL = CONFLUENCE_SETTINGS.server_url | ||
timeout = 20 | ||
from selenium_ui.base_page import BasePage | ||
|
||
|
||
def custom_action(webdriver, datasets): | ||
page = BasePage(webdriver) | ||
@print_timing | ||
def measure(webdriver, interaction): | ||
@print_timing | ||
def measure(webdriver, interaction): | ||
webdriver.get(f'{APPLICATION_URL}/plugins/servlet/some-app/reporter') | ||
_wait_until(webdriver, ec.visibility_of_element_located((By.ID, "plugin-element")), interaction) | ||
page.go_to_url(f"{CONFLUENCE_SETTINGS.server_url}/plugin/report") | ||
page.wait_until_visible((By.ID, 'report_app_element_id'), interaction) | ||
|
||
measure(webdriver, 'selenium_app_custom_action:view_report') | ||
|
||
@print_timing | ||
def measure(webdriver, interaction): | ||
webdriver.get(f'{APPLICATION_URL}/plugins/servlet/some-app/administration') | ||
_wait_until(webdriver, ec.visibility_of_element_located((By.ID, "plugin-element")), interaction) | ||
page.go_to_url(f"{CONFLUENCE_SETTINGS.server_url}/plugin/dashboard") | ||
page.wait_until_visible((By.ID, 'dashboard_app_element_id'), interaction) | ||
|
||
measure(webdriver, 'selenium_app_custom_action:view_dashboard') | ||
|
||
measure(webdriver, 'selenium_app_custom_action') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.support.wait import WebDriverWait | ||
from selenium.webdriver.support import expected_conditions as EC | ||
from jira.selenium_ui.conftest import print_timing, application_url | ||
from selenium.webdriver.support import expected_conditions as ec | ||
from app.selenium_ui.conftest import print_timing | ||
from util.conf import JIRA_SETTINGS | ||
|
||
APPLICATION_URL = application_url() | ||
APPLICATION_URL = JIRA_SETTINGS.server_url | ||
timeout = 20 | ||
|
||
|
||
# This should be called after an issue is viewed. | ||
def custom_action(webdriver, datasets): | ||
# Click more | ||
webdriver.find_element_by_id('opsbar-operations_more').click() | ||
|
||
@print_timing | ||
def measure(webdriver, interaction): | ||
# Click to add a diagram (opens the drawio editor) | ||
webdriver.find_element_by_id('drawio-add-menu-item').click() | ||
WebDriverWait(webdriver, timeout).until(EC.frame_to_be_available_and_switch_to_it((By.ID, 'drawioEditor'))) | ||
WebDriverWait(webdriver, timeout).until(ec.frame_to_be_available_and_switch_to_it((By.ID, 'drawioEditor'))) | ||
measure(webdriver, 'selenium_open_drawio_editor') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.support import expected_conditions as ec | ||
|
||
from selenium_ui.conftest import print_timing | ||
from selenium_ui.jira.modules import _wait_until | ||
from util.conf import JIRA_SETTINGS | ||
|
||
APPLICATION_URL = JIRA_SETTINGS.server_url | ||
timeout = 20 | ||
from selenium_ui.base_page import BasePage | ||
|
||
|
||
def custom_action(webdriver, datasets): | ||
page = BasePage(webdriver) | ||
@print_timing | ||
def measure(webdriver, interaction): | ||
@print_timing | ||
def measure(webdriver, interaction): | ||
webdriver.get(f'{APPLICATION_URL}/plugins/servlet/some-app/reporter') | ||
_wait_until(webdriver, ec.visibility_of_element_located((By.ID, "plugin-element")), interaction) | ||
page.go_to_url(f"{JIRA_SETTINGS.server_url}/plugin/report") | ||
page.wait_until_visible((By.ID, 'report_app_element_id'), interaction) | ||
|
||
measure(webdriver, 'selenium_app_custom_action:view_report') | ||
|
||
@print_timing | ||
def measure(webdriver, interaction): | ||
webdriver.get(f'{APPLICATION_URL}/plugins/servlet/some-app/administration') | ||
_wait_until(webdriver, ec.visibility_of_element_located((By.ID, "plugin-dashboard")), interaction) | ||
page.go_to_url(f"{JIRA_SETTINGS.server_url}/plugin/dashboard") | ||
page.wait_until_visible((By.ID, 'dashboard_app_element_id'), interaction) | ||
|
||
measure(webdriver, 'selenium_app_custom_action:view_dashboard') | ||
|
||
measure(webdriver, 'selenium_app_custom_action') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
from pathlib import Path | ||
from typing import List | ||
|
||
from scripts.utils import validate_str_is_not_blank, validate_file_exists, resolve_path | ||
|
||
SUMMARY_FILE_NAME = "results_summary.log" | ||
DELIMITER = ('\n================================================================================' | ||
'========================================\n') | ||
|
||
|
||
def __validate_config(config: dict): | ||
validate_str_is_not_blank(config, 'column_name') | ||
validate_str_is_not_blank(config, 'profile') | ||
|
||
runs = config.get('runs') | ||
if not isinstance(runs, list): | ||
raise SystemExit(f'Config key "runs" should be a list') | ||
|
||
for run in runs: | ||
if not isinstance(run, dict): | ||
raise SystemExit(f'Config key "run" should be a dictionary') | ||
|
||
validate_str_is_not_blank(run, 'runName') | ||
validate_str_is_not_blank(run, 'fullPath') | ||
|
||
|
||
def __get_summary_files(config: dict) -> List[Path]: | ||
summary_files = [] | ||
for run in config['runs']: | ||
file_path = resolve_path(run['fullPath']) / SUMMARY_FILE_NAME | ||
validate_file_exists(file_path, f"File {file_path} does not exists") | ||
summary_files.append(resolve_path(run['fullPath']) / SUMMARY_FILE_NAME) | ||
return summary_files | ||
|
||
|
||
def __get_run_names(config: dict) -> list: | ||
run_names = [] | ||
for run in config['runs']: | ||
run_names.append(run['runName']) | ||
return run_names | ||
|
||
|
||
def __write_to_summary_report(file_names: List[Path], run_names: List, status: str, output_filename: Path): | ||
with output_filename.open('a') as outfile: | ||
outfile.write(f"Scenario status: {status}") | ||
outfile.write(DELIMITER) | ||
for file, run_name in zip(file_names, run_names): | ||
with file.open('r') as infile: | ||
outfile.write(f"Run name: {run_name}\n\n") | ||
outfile.write(infile.read()) | ||
outfile.write(DELIMITER) | ||
|
||
|
||
def __get_output_file_path(config, results_dir) -> Path: | ||
return results_dir / f"{config['profile']}_summary.log" | ||
|
||
|
||
def __get_overall_status(files: List[Path]) -> bool: | ||
for file in files: | ||
with file.open('r') as f: | ||
first_line = f.readline() | ||
if 'FAIL' in first_line: | ||
return False | ||
return True | ||
|
||
|
||
def aggregate(config: dict, results_dir: Path) -> Path: | ||
__validate_config(config) | ||
output_file_path = __get_output_file_path(config, results_dir) | ||
summary_files = __get_summary_files(config) | ||
run_names = __get_run_names(config) | ||
status_message = 'OK' if __get_overall_status(summary_files) else "FAIL" | ||
__write_to_summary_report(summary_files, run_names, status_message, output_file_path) | ||
validate_file_exists(output_file_path, f"Results file {output_file_path} is not created") | ||
print(f'Results file {output_file_path.absolute()} is created') | ||
return output_file_path |
Oops, something went wrong.