diff --git a/.editorconfig b/.editorconfig index eded3ad83..246d03e1d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,36 +1,688 @@ -root = true - [*] +charset = utf-8 end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -indent_style = space indent_size = 4 -charset = utf-8 +indent_style = space +insert_final_newline = true +max_line_length = 180 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = 180 +ij_wrap_on_typing = false [*.java] -ij_visual_guides = 180 -ij_java_align_multiline_throws_list = true -ij_java_align_multiline_annotation_parameters = true -ij_java_annotation_parameter_wrap = off +ij_visual_guides = +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_deconstruction_list_components = true +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = false +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = false +ij_java_align_multiline_resources = false +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = true +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_align_types_in_multi_catch = false +ij_java_annotation_parameter_wrap = normal +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = normal +ij_java_assert_statement_colon_on_next_line = true +ij_java_assert_statement_wrap = normal +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = true +ij_java_binary_operation_wrap = normal +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_add_space = false +ij_java_block_comment_at_first_column = true +ij_java_builder_methods = +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = normal +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line ij_java_class_count_to_use_import_on_demand = 5 -ij_java_names_count_to_use_import_on_demand = 5 -ij_java_imports_layout = static java.**,static javax.**,$*,|,java.**,javax.**,* +ij_java_class_names_in_javadoc = 3 +ij_java_deconstruction_list_wrap = normal +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_not_wrap_after_single_annotation_in_parameter = false +ij_java_do_while_brace_force = always +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = true +ij_java_doc_add_blank_line_after_return = true +ij_java_doc_add_p_tag_on_empty_lines = false +ij_java_doc_align_exception_comments = false +ij_java_doc_align_param_comments = false +ij_java_doc_do_not_wrap_if_one_line = true +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = false +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = false +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = true +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_enum_constants_wrap = on_every_item +ij_java_enum_field_annotation_wrap = split_into_lines +ij_java_extends_keyword_wrap = normal +ij_java_extends_list_wrap = normal +ij_java_field_annotation_wrap = split_into_lines +ij_java_field_name_prefix = +ij_java_field_name_suffix = +ij_java_finally_on_new_line = false +ij_java_for_brace_force = always +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = true +ij_java_generate_final_parameters = true +ij_java_if_brace_force = always +ij_java_imports_layout = $*,|,java.**,javax.**,|,*,| +ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = true -ij_java_layout_static_imports_separately = false -ij_java_method_call_chain_wrap = off -ij_java_throws_list_wrap = off -ij_java_block_comment_at_first_column = false -ij_java_line_comment_at_first_column = false -ij_java_line_comment_add_space = true - -[{*.yml,*.yaml}] +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 1 +ij_java_keep_blank_lines_between_package_declaration_and_header = 1 +ij_java_keep_blank_lines_in_code = 1 +ij_java_keep_blank_lines_in_declarations = 1 +ij_java_keep_builder_methods_indents = false +ij_java_keep_control_statement_in_one_line = false +ij_java_keep_first_column_comment = false +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_add_space_on_reformat = false +ij_java_line_comment_at_first_column = true +ij_java_local_variable_name_prefix = +ij_java_local_variable_name_suffix = +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = normal +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = normal +ij_java_modifier_list_wrap = false +ij_java_multi_catch_types_wrap = normal +ij_java_names_count_to_use_import_on_demand = 5 +ij_java_new_line_after_lparen_in_annotation = false +ij_java_new_line_after_lparen_in_deconstruction_pattern = true +ij_java_new_line_after_lparen_in_record_header = false +ij_java_new_line_when_body_is_presented = false +ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_java_parameter_annotation_wrap = off +ij_java_parameter_name_prefix = +ij_java_parameter_name_suffix = +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_annotations = +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = true +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = on_every_item +ij_java_rparen_on_new_line_in_annotation = false +ij_java_rparen_on_new_line_in_deconstruction_pattern = true +ij_java_rparen_on_new_line_in_record_header = false +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_deconstruction_list = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_annotation_eq = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_deconstruction_list = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_static_field_name_prefix = +ij_java_static_field_name_suffix = +ij_java_subclass_name_prefix = +ij_java_subclass_name_suffix = Impl +ij_java_switch_expressions_wrap = normal +ij_java_ternary_operation_signs_on_next_line = true +ij_java_ternary_operation_wrap = on_every_item +ij_java_test_name_prefix = +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = normal +ij_java_throws_list_wrap = normal +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = split_into_lines +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = true +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = true +ij_java_wrap_semicolon_after_call_chain = false + +[*.properties] +ij_visual_guides = +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[.editorconfig] +ij_visual_guides = +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.jspx,*.pom,*.rng,*.tagx,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_visual_guides = +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_add_space = false +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal + +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_visual_guides = +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.gant,*.groovy,*.gy}] +ij_visual_guides = +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_add_space = false +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enable_groovydoc_formatting = true +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_ginq_general_clause_wrap_policy = 2 +ij_groovy_ginq_having_wrap_policy = 1 +ij_groovy_ginq_indent_having_clause = true +ij_groovy_ginq_indent_on_clause = true +ij_groovy_ginq_on_wrap_policy = 1 +ij_groovy_ginq_space_after_keyword = true +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_add_space_on_reformat = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_record_parentheses = false +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_chain_calls_after_dot = false +ij_groovy_wrap_long_lines = false + +[{*.har,*.json,*.jsonc}] +indent_size = 2 +ij_visual_guides = +ij_json_array_wrapping = split_into_lines +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = split_into_lines +ij_json_property_alignment = do_not_align +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = false +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_visual_guides = +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.kt,*.kts}] +ij_visual_guides = +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = normal +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_add_space = false +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = true +ij_kotlin_call_parameters_right_paren_on_new_line = true +ij_kotlin_call_parameters_wrap = on_every_item +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = false +ij_kotlin_continuation_indent_for_expression_bodies = false +ij_kotlin_continuation_indent_in_argument_lists = false +ij_kotlin_continuation_indent_in_elvis = false +ij_kotlin_continuation_indent_in_if_conditions = false +ij_kotlin_continuation_indent_in_parameter_lists = false +ij_kotlin_continuation_indent_in_supertype_lists = false +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = normal +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = true +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_break_after_multiline_when_entry = true +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_add_space_on_reformat = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = normal +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = on_every_item +ij_kotlin_name_count_to_use_star_import = 5 +ij_kotlin_name_count_to_use_star_import_for_members = 3 +ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 1 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.markdown,*.md}] +ij_visual_guides = +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true + +[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] +ij_visual_guides = +ij_toml_keep_indents_on_empty_lines = false + +[{*.yaml,*.yml}] indent_size = 2 -ij_continuation_indent_size = 2 +ij_visual_guides = +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true ij_yaml_keep_indents_on_empty_lines = false ij_yaml_keep_line_breaks = true -ij_any_block_comment_at_first_column = false -ij_java_line_comment_at_first_column = false -ij_java_line_comment_add_space = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc8796a7c..ace89a032 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,11 @@ name: Build on: push: branches: [ "develop", "feature/**", "bugfix/**" ] + paths-ignore: [ '.mvn/**', 'mvnw', 'mvnw.cmd', '.run/**', 'docs/**', '.editorconfig', '.gitignore', '**.md' ] pull_request: branches: [ "develop" ] types: [ opened, reopened, edited ] + paths-ignore: [ '.mvn/**', 'mvnw', 'mvnw.cmd', '.run/**', 'docs/**', '.editorconfig', '.gitignore', '**.md' ] jobs: build: @@ -66,8 +68,8 @@ jobs: directives: -DmacosTests moduleName: it-macos - os: windows-latest - profiles: browsers - directives: -DbrowsersTests + profiles: windows + directives: -DwindowsTests moduleName: it runs-on: ${{ matrix.os }} env: diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml deleted file mode 100644 index 07bef60d9..000000000 --- a/.github/workflows/stale-issues.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Close inactive issues -on: - schedule: - - cron: 0 0 1 * * - -jobs: - close-issues: - if: false - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - name: Close Stale Issues - uses: actions/stale@v9.0.0 - with: - days-before-issue-stale: 30 - days-before-issue-close: 14 - stale-issue-label: stale - stale-issue-message: This issue is stale because it has been open for 30 days with no activity. - close-issue-message: This issue was closed because it has been inactive for 14 days since being marked as stale. - days-before-pr-stale: -1 - days-before-pr-close: -1 - repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.run/spotless_apply.run.xml b/.run/spotless_apply.run.xml new file mode 100644 index 000000000..abbc5b550 --- /dev/null +++ b/.run/spotless_apply.run.xml @@ -0,0 +1,32 @@ + + + + + + + + \ No newline at end of file diff --git a/DEV.md b/DEV.md index f7944287a..2e6cefd9b 100644 --- a/DEV.md +++ b/DEV.md @@ -13,10 +13,12 @@ client would. So, we build the framework in a dedicated module, and then we incl | [it-bidi](it-bidi) | Runs a bunch of tests with the `webSocketUrl` capability | | [it-testbook](it-testbook) | Runs a bunch of tests with a testbook | | [it-macos](it-macos) | Runs a bunch of tests specific to macOS (Safari) | +| [it-windows](it-windows) | Runs a bunch of tests on Windows (useful for GH actions to reduce flakiness) | | [it-appium](it-appium) | Runs a bunch of tests with Appium | | [verify-commons](verify-commons) | Contains common classes used in other verify modules | | [verify-browsers](verify-browsers) | Verifies results of the `it`, `it-testbook`, `it-grid`, and `it-bidi` modules | | [verify-macos](verify-macos) | Verifies results of the `it-macos` module | +| [verify-windows](verify-windows) | Verifies results of the `it-windows` module | | [verify-appium](verify-appium) | Verifies results of the `it-appium` module | | [cleanup](cleanup) | Cleans each module after the execution | @@ -79,8 +81,10 @@ Where: on [Maven Central](https://central.sonatype.com/artifact/io.github.giulong/spectrum). * the `-DbrowsersTests` property is a shorthand to activate all the profiles needed to run tests on all the browsers. It's equivalent to running with these active profiles: `-P chrome,firefox,edge`. -* the `-DmacosTests` property is a shorthand to activate all the profiles needed to run tests on macOS. It's equivalent to +* the `-DmacosTests` property is a shorthand to activate all the profiles needed to run tests specific to Safari. It's equivalent to running with these active profiles: `-P safari`. +* the `-DwindowsTests` property is a shorthand to activate all the profiles needed to run tests on Windows in GitHub build action. It's equivalent to + running with these active profiles: `-P windows`. NOTE: this is not needed in local: it's meant to just run fewer tests on windows workers in CI builds. * the `-DappiumTests` property is a shorthand to activate all the profiles needed to run tests on Appium. It's equivalent to running with these active profiles: `-P uiAutomator2`. * the `-fae` option is [Maven's](https://maven.apache.org/ref/3.6.3/maven-embedder/cli.html) shorthand for `--fail-at-end`, needed to always run the `cleanup` module. diff --git a/README.md b/README.md index 26e6cca4d..df03e2024 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![GitHub Discussions](https://img.shields.io/github/discussions/giulong/spectrum)](https://github.com/giulong/spectrum/discussions)
-Spectrum logo +Spectrum logo

@@ -74,14 +74,14 @@ https://github.com/giulong/spectrum/assets/27963644/fecee8f5-f6dc-4b47-81a3-514e > `-Dspectrum.driver=firefox`, `-Dspectrum.driver=edge` or `-Dspectrum.driver=safari` Here's an overview of the project created by the archetype, along with the generated report and video:

-login-formreport +login-formreport https://github.com/giulong/spectrum/assets/27963644/df6b801e-91ca-415b-b510-a45b7392de20 You can also configure Spectrum to produce additional reports, such as summary and coverage:

-summaryhtml testbook +summaryhtml testbook If you like Spectrum, please consider giving it a GitHub Star ⭐ diff --git a/cleanup/pom.xml b/cleanup/pom.xml index 57b2abe56..f6a64cad8 100644 --- a/cleanup/pom.xml +++ b/cleanup/pom.xml @@ -18,14 +18,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - org.apache.maven.plugins maven-resources-plugin @@ -138,6 +130,42 @@ + + Copy LauncherSessionListener to "it-windows" module's classes + clean + + copy-resources + + + ../it-windows/target/classes/META-INF/services + + + ${spectrumMetaInfServicesFolder} + + ${launcherSessionListener} + + + + + + + Copy LauncherSessionListener to "verify-windows" module's classes + clean + + copy-resources + + + ../verify-windows/target/classes/META-INF/services + + + ${spectrumMetaInfServicesFolder} + + ${launcherSessionListener} + + + + + Copy LauncherSessionListener to "it-appium" module's classes clean diff --git a/src/main/resources/images/login-form-it-extent-report.png b/docs/assets/images/login-form-it-extent-report.png similarity index 100% rename from src/main/resources/images/login-form-it-extent-report.png rename to docs/assets/images/login-form-it-extent-report.png diff --git a/src/main/resources/images/login-form-it.png b/docs/assets/images/login-form-it.png similarity index 100% rename from src/main/resources/images/login-form-it.png rename to docs/assets/images/login-form-it.png diff --git a/src/main/resources/images/html-summary.png b/docs/assets/images/readme-html-summary.png similarity index 100% rename from src/main/resources/images/html-summary.png rename to docs/assets/images/readme-html-summary.png diff --git a/src/main/resources/images/html-testbook.png b/docs/assets/images/readme-html-testbook.png similarity index 100% rename from src/main/resources/images/html-testbook.png rename to docs/assets/images/readme-html-testbook.png diff --git a/it-appium/pom.xml b/it-appium/pom.xml index 711605cb1..6f7835c91 100644 --- a/it-appium/pom.xml +++ b/it-appium/pom.xml @@ -39,6 +39,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin @@ -86,4 +90,4 @@ - \ No newline at end of file + diff --git a/it-bidi/pom.xml b/it-bidi/pom.xml index a2882fb20..08c658340 100644 --- a/it-bidi/pom.xml +++ b/it-bidi/pom.xml @@ -39,6 +39,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/it-grid/pom.xml b/it-grid/pom.xml index a2c4b8c21..220523e31 100644 --- a/it-grid/pom.xml +++ b/it-grid/pom.xml @@ -48,6 +48,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java b/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java index 0df6cc60e..c5a433536 100644 --- a/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java +++ b/it-grid/src/test/java/io/github/giulong/spectrum/it_grid/tests/FilesIT.java @@ -2,7 +2,9 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf; import java.io.IOException; @@ -10,8 +12,11 @@ import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Scanner; import com.fasterxml.jackson.databind.ObjectMapper; @@ -50,6 +55,10 @@ void download() { downloadPage.getDownloadLinks().getFirst().click(); assertThrows(TimeoutException.class, () -> checkDownloadedFile(FILE_TO_DOWNLOAD)); + + final Path downloadsFolder = Path.of(String.valueOf(configuration.getVars().get("downloadsFolder"))); + assertTrue(Files.exists(downloadsFolder)); + assertNotEquals(0, Objects.requireNonNull(downloadsFolder.toFile().listFiles()).length); } @Test diff --git a/it-macos/pom.xml b/it-macos/pom.xml index 9e5395f18..4ab606df8 100644 --- a/it-macos/pom.xml +++ b/it-macos/pom.xml @@ -39,6 +39,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/it-testbook/pom.xml b/it-testbook/pom.xml index 578b7e794..63f3ceeb3 100644 --- a/it-testbook/pom.xml +++ b/it-testbook/pom.xml @@ -39,6 +39,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java index 6ece60b46..03fe62c2a 100644 --- a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java +++ b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/TestBookSessionListener.java @@ -176,7 +176,7 @@ public void launcherSessionClosed(LauncherSession session) { private void createExtentFiles(final List fileNames, final Path directory) { for (String fileName : fileNames) { assertTrue(Files.createFile(directory.resolve(fileUtils.removeExtensionFrom(fileName)).resolve(fileName)).toFile().exists()); - Thread.sleep(1000); // just to be sure files have different creation dates + Thread.sleep(1000); // just to be sure files have different creation dates } } @@ -184,7 +184,7 @@ private void createExtentFiles(final List fileNames, final Path director private void createFiles(final List fileNames, final Path directory) { for (String fileName : fileNames) { assertTrue(Files.createFile(directory.resolve(fileName)).toFile().exists()); - Thread.sleep(1000); // just to be sure files have different creation dates + Thread.sleep(1000); // just to be sure files have different creation dates } } @@ -192,7 +192,7 @@ private void createFiles(final List fileNames, final Path directory) { private void createDirectories(final List directoryNames, final Path parentDirectory) { for (String fileName : directoryNames) { assertTrue(Files.createDirectories(parentDirectory.resolve(fileName)).toFile().exists()); - Thread.sleep(1000); // just to be sure files have different creation dates + Thread.sleep(1000); // just to be sure files have different creation dates } } diff --git a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java index a2cb6e454..07f475432 100644 --- a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java +++ b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/FilesIT.java @@ -1,9 +1,15 @@ package io.github.giulong.spectrum.it_testbook.tests; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Objects; + import io.github.giulong.spectrum.SpectrumTest; import io.github.giulong.spectrum.it_testbook.pages.DownloadPage; import io.github.giulong.spectrum.it_testbook.pages.UploadPage; @@ -33,6 +39,10 @@ void download() { downloadPage.getDownloadLinks().getFirst().click(); assertThrows(TimeoutException.class, () -> checkDownloadedFile(FILE_TO_DOWNLOAD)); + + final Path downloadsFolder = Path.of(String.valueOf(configuration.getVars().get("downloadsFolder"))); + assertTrue(Files.exists(downloadsFolder)); + assertNotEquals(0, Objects.requireNonNull(downloadsFolder.toFile().listFiles()).length); } @Test diff --git a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java index e352852bf..d69209c75 100644 --- a/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java +++ b/it-testbook/src/test/java/io/github/giulong/spectrum/it_testbook/tests/LoginFormIT.java @@ -51,7 +51,6 @@ void shouldRunSuccessfully(final String userName, final boolean expected, final static Stream valuesProvider() { return Stream.of( arguments("tom", true, "/secure"), - arguments("giulio", false, "/login") - ); + arguments("giulio", false, "/login")); } } diff --git a/it-windows/pom.xml b/it-windows/pom.xml new file mode 100644 index 000000000..f15f50dfe --- /dev/null +++ b/it-windows/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + + + io.github.giulong + spectrum-aggregate + ${revision} + + + it-windows + + + + io.github.giulong + spectrum + ${revision} + test + + + + + + + org.apache.maven.plugins + maven-clean-plugin + + + org.apache.maven.plugins + maven-resources-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + com.diffplug.spotless + spotless-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + + + + windows + + + windowsTests + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + Chrome IT + + integration-test + + + chrome + + chrome + + target/failsafe-reports/failsafe-chrome.xml + + + + + + + + + diff --git a/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/CheckboxPage.java b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/CheckboxPage.java new file mode 100644 index 000000000..e1b2b7f23 --- /dev/null +++ b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/CheckboxPage.java @@ -0,0 +1,35 @@ +package io.github.giulong.spectrum.it_windows.pages; + +import static org.openqa.selenium.support.ui.ExpectedConditions.*; + +import java.util.List; + +import io.github.giulong.spectrum.SpectrumPage; +import io.github.giulong.spectrum.interfaces.Endpoint; + +import lombok.Getter; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.FindBys; + +@Getter +@Endpoint("checkboxes") +@SuppressWarnings("unused") +public class CheckboxPage extends SpectrumPage { + + @FindBys({ + @FindBy(id = "checkboxes"), + @FindBy(tagName = "input") + }) + private List checkboxes; + + @Override + public CheckboxPage waitForPageLoading() { + pageLoadWait.until(and( + urlToBe("https://the-internet.herokuapp.com/checkboxes"), + visibilityOfAllElements(checkboxes))); + + return this; + } +} diff --git a/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/LandingPage.java b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/LandingPage.java new file mode 100644 index 000000000..7f5e45878 --- /dev/null +++ b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/pages/LandingPage.java @@ -0,0 +1,19 @@ +package io.github.giulong.spectrum.it_windows.pages; + +import io.github.giulong.spectrum.SpectrumPage; + +import lombok.Getter; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +@Getter +@SuppressWarnings("unused") +public class LandingPage extends SpectrumPage { + + @FindBy(tagName = "h1") + private WebElement title; + + @FindBy(linkText = "Checkboxes") + private WebElement checkboxLink; +} diff --git a/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/tests/WindowsCheckboxIT.java b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/tests/WindowsCheckboxIT.java new file mode 100644 index 000000000..45a3b7d56 --- /dev/null +++ b/it-windows/src/test/java/io/github/giulong/spectrum/it_windows/tests/WindowsCheckboxIT.java @@ -0,0 +1,49 @@ +package io.github.giulong.spectrum.it_windows.tests; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.condition.OS.WINDOWS; + +import io.github.giulong.spectrum.SpectrumTest; +import io.github.giulong.spectrum.it_windows.pages.CheckboxPage; +import io.github.giulong.spectrum.it_windows.pages.LandingPage; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.openqa.selenium.WebElement; + +@SuppressWarnings("unused") +@DisplayName("Checkbox Page") +@EnabledOnOs(WINDOWS) +class WindowsCheckboxIT extends SpectrumTest { + + private LandingPage landingPage; + + private CheckboxPage checkboxPage; + + @Test + void testWithNoDisplayName() { + // Open the base url of the application under test + driver.get(configuration.getApplication().getBaseUrl()); + assertEquals("Welcome to the-internet", landingPage.getTitle().getText()); + + extentTest.info("Custom step that should not be highlighted on video playback"); + landingPage.getCheckboxLink().click(); + extentTest.info("Custom step that should not be highlighted on video playback"); + + final WebElement firstCheckbox = checkboxPage.getCheckboxes().getFirst(); + final WebElement secondCheckbox = checkboxPage.getCheckboxes().get(1); + + assertFalse(firstCheckbox.isSelected()); + assertTrue(secondCheckbox.isSelected()); + + extentTest.info("Custom step that should not be highlighted on video playback"); + firstCheckbox.click(); + assertTrue(firstCheckbox.isSelected()); + + // Take a screenshot with a custom message + screenshotInfo("After checking the first checkbox"); + } +} diff --git a/it-windows/src/test/resources/banner.txt b/it-windows/src/test/resources/banner.txt new file mode 100644 index 000000000..db9687271 --- /dev/null +++ b/it-windows/src/test/resources/banner.txt @@ -0,0 +1,19 @@ +<#assign length = 19 + name?length> +<#assign pad = length + (54 - length)/2> + +====================================================== + +${"START MODULE ${name?upper_case} TESTS"?left_pad(pad)} + +====================================================== + __________________________________________________ + / ____ _ \ +| / ___| _ __ ___ ___| |_ _ __ _ _ _ __ ___ | +| \___ \| '_ \ / _ \/ __| __| '__| | | | '_ ` _ \ | +| ___) | |_) | __/ (__| |_| | | |_| | | | | | | | +| |____/| .__/ \___|\___|\__|_| \__,_|_| |_| |_| | +| ******|_|${" Version: ${version}"?left_pad(39, "*")} | +| | +| Please consider giving a GitHub star: | +| ${url?right_pad(44)}| + \__________________________________________________/ diff --git a/it-windows/src/test/resources/configuration.yml b/it-windows/src/test/resources/configuration.yml new file mode 100644 index 000000000..915e5c16e --- /dev/null +++ b/it-windows/src/test/resources/configuration.yml @@ -0,0 +1,10 @@ +application: + baseUrl: https://the-internet.herokuapp.com/ + +drivers: + waits: + downloadTimeout: 5 + +extent: + theme: DARK + fileName: report-${spectrum.driver:-chrome}.html diff --git a/it-windows/src/test/resources/filtered/properties.yaml b/it-windows/src/test/resources/filtered/properties.yaml new file mode 100644 index 000000000..b34a324ea --- /dev/null +++ b/it-windows/src/test/resources/filtered/properties.yaml @@ -0,0 +1,3 @@ +name: ${project.artifactId} +version: ${project.version} +url: https://github.com/giulong/spectrum diff --git a/it-windows/src/test/resources/logback-test.xml b/it-windows/src/test/resources/logback-test.xml new file mode 100644 index 000000000..f42375332 --- /dev/null +++ b/it-windows/src/test/resources/logback-test.xml @@ -0,0 +1,25 @@ + + + + + + + + + + ${COLOR_PATTERN} + + + + + ${FILE_PATH}/spectrum.log + + ${PATTERN} + + + + + + + + diff --git a/it/pom.xml b/it/pom.xml index 649aab0a3..1ca76bd7c 100644 --- a/it/pom.xml +++ b/it/pom.xml @@ -39,6 +39,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java b/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java index 1affa6079..0484565b0 100644 --- a/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java +++ b/it/src/test/java/io/github/giulong/spectrum/it/tests/FakerIT.java @@ -82,7 +82,6 @@ void inputsWithProvider(final String number) { static Stream valuesProvider() { return Stream.of( arguments(faker.numerify("##")), - arguments(faker.numerify("###")) - ); + arguments(faker.numerify("###"))); } } diff --git a/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java b/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java index 0f4af17ec..9df0e4a2e 100644 --- a/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java +++ b/it/src/test/java/io/github/giulong/spectrum/it/tests/FilesIT.java @@ -3,6 +3,10 @@ import static org.junit.jupiter.api.Assertions.*; import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Objects; + import io.github.giulong.spectrum.SpectrumTest; import io.github.giulong.spectrum.it.pages.DownloadPage; import io.github.giulong.spectrum.it.pages.UploadPage; @@ -42,6 +46,11 @@ void download() { // We call the inherited helper method to check if the downloaded file is the one we expect // This is expected to fail since we're comparing it with a wrong file assertThrows(TimeoutException.class, () -> checkDownloadedFile(FILE_TO_DOWNLOAD)); + + // We still check the driver downloaded files in the right place + final Path downloadsFolder = Path.of(String.valueOf(configuration.getVars().get("downloadsFolder"))); + assertTrue(Files.exists(downloadsFolder)); + assertNotEquals(0, Objects.requireNonNull(downloadsFolder.toFile().listFiles()).length); } @Test diff --git a/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java b/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java index 7ec2def9f..414234f9b 100644 --- a/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java +++ b/it/src/test/java/io/github/giulong/spectrum/it/tests/LoginFormIT.java @@ -65,8 +65,7 @@ void shouldRunSuccessfully(final String userName, final boolean expected, final static Stream valuesProvider() { return Stream.of( arguments("tom", true, "/secure"), - arguments("giulio", false, "/login") - ); + arguments("giulio", false, "/login")); } @Test diff --git a/pom.xml b/pom.xml index b8bd77987..e68991db8 100644 --- a/pom.xml +++ b/pom.xml @@ -68,10 +68,12 @@ it-bidi it-testbook it-macos + it-windows it-appium verify-commons verify-browsers verify-macos + verify-windows verify-appium cleanup @@ -108,6 +110,16 @@ + + windows + + it-windows + verify-commons + verify-windows + cleanup + + + appium @@ -195,7 +207,7 @@ ch.qos.logback logback-classic - 1.5.20 + 1.5.21 org.slf4j @@ -310,20 +322,6 @@ maven-clean-plugin 3.5.0 - - com.diffplug.spotless - spotless-maven-plugin - 3.0.0 - - - - - java,javax,ch,com,io,net,lombok,org - - - - - org.apache.maven.plugins maven-checkstyle-plugin @@ -332,7 +330,7 @@ com.puppycrawl.tools checkstyle - 12.1.1 + 12.2.0 com.github.sevntu-checkstyle @@ -371,6 +369,31 @@ + + com.diffplug.spotless + spotless-maven-plugin + 3.1.0 + + + + + java,javax,ch,com,io,net,lombok,org + + + + ${maven.multiModuleProjectDirectory}/spotless.xml + + + + + + validate + + check + + + + org.apache.maven.plugins maven-compiler-plugin @@ -386,7 +409,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.3.1 + 3.4.0 UTF-8 @@ -433,7 +456,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.4.2 + 3.5.0 com.github.victools @@ -484,6 +507,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-resources-plugin diff --git a/spectrum/pom.xml b/spectrum/pom.xml index 37981619b..618fd3b6d 100644 --- a/spectrum/pom.xml +++ b/spectrum/pom.xml @@ -195,6 +195,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin @@ -311,7 +315,7 @@ org.apache.maven.plugins maven-source-plugin - 3.3.1 + 3.4.0 attach-sources diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java index 12b43301e..d49ecaa65 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumEntity.java @@ -120,6 +120,7 @@ public abstract class SpectrumEntity, Data> { * Hovers on the provided WebElement, leveraging the {@code actions} field * * @param webElement the WebElement on which to hover + * * @return the calling SpectrumEntity instance */ @SuppressWarnings("unchecked") @@ -142,9 +143,11 @@ public T screenshot() { } /** - * Adds a screenshot with the provided message and INFO status to the current test in the Extent Report + * Adds a screenshot with the provided message and INFO status to the current + * test in the Extent Report * * @param msg the message to log + * * @return the calling SpectrumEntity instance */ @SuppressWarnings("unchecked") @@ -155,9 +158,11 @@ public T screenshotInfo(final String msg) { } /** - * Adds a screenshot status with the provided message and WARN to the current test in the Extent Report + * Adds a screenshot status with the provided message and WARN to the current + * test in the Extent Report * * @param msg the message to log + * * @return the calling SpectrumEntity instance */ @SuppressWarnings("unchecked") @@ -168,9 +173,11 @@ public T screenshotWarning(final String msg) { } /** - * Adds a screenshot with the provided message and FAIL status to the current test in the Extent Report + * Adds a screenshot with the provided message and FAIL status to the current + * test in the Extent Report * * @param msg the message to log + * * @return the calling SpectrumEntity instance */ @SuppressWarnings("unchecked") @@ -181,9 +188,10 @@ public T screenshotFail(final String msg) { } /** - * Adds a screenshot with the provided message and the provided status to the current test in the Extent Report + * Adds a screenshot with the provided message and the provided status to the + * current test in the Extent Report * - * @param msg the message to log + * @param msg the message to log * @param status the log's status */ public void addScreenshotToReport(final String msg, final Status status) { @@ -209,16 +217,19 @@ public void addScreenshotToReport(final String msg, final Status status) { } /** - * Deletes the download folder (its path is provided in the {@code configuration*.yaml}) + * Deletes the download folder (its path is provided in the + * {@code configuration*.yaml}) */ public void deleteDownloadsFolder() { fileUtils.deleteContentOf(Path.of(configuration.getRuntime().getDownloadsFolder())); } /** - * Leverages the configurable {@code downloadWait} to check fluently if the file at the provided path is fully downloaded + * Leverages the configurable {@code downloadWait} to check fluently if the file + * at the provided path is fully downloaded * * @param path the path to the downloaded file to wait for + * * @return the calling SpectrumEntity instance */ @SuppressWarnings("unchecked") @@ -232,10 +243,12 @@ public T waitForDownloadOf(final Path path) { } /** - * Leverages the {@code waitForDownloadOf} method and then compares the checksums of the two files provided. + * Leverages the {@code waitForDownloadOf} method and then compares the + * checksums of the two files provided. * * @param downloadedFileName name of the downloaded file - * @param fileToCheckName name of the static file to be used as comparison + * @param fileToCheckName name of the static file to be used as comparison + * * @return true if the files are equal */ public boolean checkDownloadedFile(final String downloadedFileName, final String fileToCheckName) { @@ -246,17 +259,20 @@ public boolean checkDownloadedFile(final String downloadedFileName, final String waitForDownloadOf(downloadedFile); log.info(""" - Checking if these files are the same: - {} - {} - """, downloadedFile, fileToCheck); + Checking if these files are the same: + {} + {} + """, downloadedFile, fileToCheck); return Arrays.equals(sha256Of(downloadedFile), sha256Of(fileToCheck)); } /** - * Leverages the {@code waitForDownloadOf} method and then compares the checksums of the file provided. + * Leverages the {@code waitForDownloadOf} method and then compares the + * checksums of the file provided. + * + * @param file name of both the downloaded file and the static one to be used as + * comparison * - * @param file name of both the downloaded file and the static one to be used as comparison * @return true if the files are equal */ public boolean checkDownloadedFile(final String file) { @@ -264,10 +280,12 @@ public boolean checkDownloadedFile(final String file) { } /** - * Helper method to call Selenium's {@code clear} and {@code sendKeys} on the provided WebElement, which is then returned + * Helper method to call Selenium's {@code clear} and {@code sendKeys} on the + * provided WebElement, which is then returned * * @param webElement target WebElement * @param keysToSend keys to send + * * @return the target WebElement passed as argument */ public WebElement clearAndSendKeys(final WebElement webElement, final CharSequence keysToSend) { @@ -278,11 +296,13 @@ public WebElement clearAndSendKeys(final WebElement webElement, final CharSequen } /** - * Uploads to the provided WebElement (usually an input field with {@code type="file"}) the file with the provided name, taken from the + * Uploads to the provided WebElement (usually an input field with + * {@code type="file"}) the file with the provided name, taken from the * configurable {@code runtime.filesFolder}. * * @param webElement target WebElement - * @param fileName name of the file to be uploaded + * @param fileName name of the file to be uploaded + * * @return the calling SpectrumEntity instance */ @SuppressWarnings("unchecked") @@ -295,9 +315,11 @@ public T upload(final WebElement webElement, final String fileName) { } /** - * Checks if the WebElement with the provided {@code by} is present in the current page + * Checks if the WebElement with the provided {@code by} is present in the + * current page * * @param by the WebElement's selector + * * @return true if the WebElement is found */ public boolean isPresent(final By by) { @@ -307,9 +329,11 @@ public boolean isPresent(final By by) { } /** - * Checks if no WebElement with the provided {@code by} is present in the current page + * Checks if no WebElement with the provided {@code by} is present in the + * current page * * @param by the WebElement's selector + * * @return true if the WebElement is not found */ public boolean isNotPresent(final By by) { @@ -320,7 +344,8 @@ public boolean isNotPresent(final By by) { * Checks if the provided WebElement has the provided css class * * @param webElement the WebElement to check - * @param className the css class to look for + * @param className the css class to look for + * * @return true if the WebElement has the provided css class */ public boolean hasClass(final WebElement webElement, final String className) { @@ -330,10 +355,12 @@ public boolean hasClass(final WebElement webElement, final String className) { } /** - * Checks if the provided WebElement has all the provided css classes + * Checks if the provided WebElement has all the provided css + * classes * * @param webElement the WebElement to check - * @param classes the css classes to look for + * @param classes the css classes to look for + * * @return true if the WebElement has all the provided css classes */ public boolean hasClasses(final WebElement webElement, final String... classes) { diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java index ab36eb175..9440ba87f 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumPage.java @@ -27,9 +27,11 @@ public abstract class SpectrumPage, Data> extend private String endpoint; /** - * Opens the web page at the URL made by the concatenation of the {@code baseUrl} provided in the {@code configuration.yaml} - * and the value of the {@code @Endpoint} annotation on the calling SpectrumPage. - * It also calls the {@link SpectrumPage#waitForPageLoading()} waitForPageLoading} before returning + * Opens the web page at the URL made by the concatenation of the + * {@code baseUrl} provided in the {@code configuration.yaml} and the value of + * the {@code @Endpoint} annotation on the calling SpectrumPage. It also calls + * the {@link SpectrumPage#waitForPageLoading()} waitForPageLoading} before + * returning * * @return the calling SpectrumPage instance */ @@ -44,9 +46,10 @@ public T open() { } /** - * This is a method that by default just logs a warning. If you need to check for custom conditions before considering - * a page fully loaded, you should override this method, so that calling {@link SpectrumPage#open() open} - * on pages will call your implementation automatically + * This is a method that by default just logs a warning. If you need to check + * for custom conditions before considering a page fully loaded, you should + * override this method, so that calling {@link SpectrumPage#open() open} on + * pages will call your implementation automatically * * @return the calling SpectrumPage instance */ @@ -58,7 +61,8 @@ public T waitForPageLoading() { } /** - * Checks whether the SpectrumPage instance on which this is called is fully loaded + * Checks whether the SpectrumPage instance on which this is called is fully + * loaded * * @return true if the SpectrumPage is loaded */ @@ -97,7 +101,8 @@ void injectJsWebElementProxyInto(final Field field) { if (value instanceof List) { log.debug("Field {} is a list. Cannot build proxy eagerly", field.getName()); - @SuppressWarnings("unchecked") final Object webElementProxy = Proxy.newProxyInstance( + @SuppressWarnings("unchecked") + final Object webElementProxy = Proxy.newProxyInstance( List.class.getClassLoader(), new Class[]{List.class}, JsWebElementListInvocationHandler diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java index 2046ddb6a..a2ef02b6e 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumSessionListener.java @@ -70,8 +70,7 @@ void parseConfiguration() { .map(profile -> String.format("configuration-%s", profile)) .toList(); - parseVars(CONFIGURATION); - profileConfigurations.forEach(this::parseVars); + parseVars(profileConfigurations); yamlUtils.updateWithInternalFile(configuration, DEFAULT_CONFIGURATION_YAML); if (isUnix()) { @@ -86,23 +85,27 @@ void parseConfiguration() { List parseProfiles() { return Arrays.stream(Optional - .ofNullable(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION, String.class)) - .orElse(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML, String.class)) - .split(",")) + .ofNullable(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION)) + .orElse(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML)) + .split(",")) .filter(not(String::isBlank)) .toList(); } - @SuppressWarnings("unchecked") - void parseVars(final String profileConfiguration) { - vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML, Map.class)); + void parseVars(final List profileConfigurations) { + vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML)); if (isUnix()) { - vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_UNIX_YAML, Map.class)); + vars.putAll(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_UNIX_YAML)); } - vars.putAll(Optional.ofNullable(yamlUtils.readClientNode(VARS_NODE, CONFIGURATION, Map.class)).orElse(new HashMap<>())); - vars.putAll(Optional.ofNullable(yamlUtils.readClientNode(VARS_NODE, profileConfiguration, Map.class)).orElse(new HashMap<>())); + vars.putAll(Optional + .>ofNullable(yamlUtils.readClientNode(VARS_NODE, CONFIGURATION)) + .orElse(new HashMap<>())); + + profileConfigurations.forEach(p -> vars.putAll(Optional + .>ofNullable(yamlUtils.readClientNode(VARS_NODE, p)) + .orElse(new HashMap<>()))); } boolean isUnix() { diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumTest.java b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumTest.java index 34150ad09..906388fc6 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumTest.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/SpectrumTest.java @@ -162,7 +162,8 @@ void beforeEach(final TestContext testContext, final TestData testData, final St @SneakyThrows SpectrumPage injectPageInto(final Field field) { - @SuppressWarnings("unchecked") final SpectrumPage spectrumPage = (SpectrumPage) field.getType().getDeclaredConstructor().newInstance(); + @SuppressWarnings("unchecked") + final SpectrumPage spectrumPage = (SpectrumPage) field.getType().getDeclaredConstructor().newInstance(); Reflections.setField(field, this, spectrumPage); return spectrumPage; @@ -186,7 +187,8 @@ void injectDataIn(final List> spectrumPages) { final Type type = Reflections.getGenericSuperclassOf(dataSpectrumPages.getFirst().getClass(), SpectrumPage.class).getActualTypeArguments()[1]; final String typeName = type.getTypeName(); - @SuppressWarnings("unchecked") final Class dataClass = (Class) type; + @SuppressWarnings("unchecked") + final Class dataClass = (Class) type; final Data data = yamlUtils.readClient(String.format("%s/data.yaml", configuration.getData().getFolder()), dataClass); dataSpectrumPages diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DataResolver.java b/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DataResolver.java index 5186263af..06460be7e 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DataResolver.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DataResolver.java @@ -37,7 +37,8 @@ public Data resolveParameter(@NonNull final ParameterContext parameterContext, f return null; } - @SuppressWarnings("unchecked") final Class dataClass = (Class) type; + @SuppressWarnings("unchecked") + final Class dataClass = (Class) type; final ExtensionContext.Store rootStore = context.getRoot().getStore(GLOBAL); return rootStore.computeIfAbsent(DATA, e -> { diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DriverResolver.java b/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DriverResolver.java index 86db60d90..fa170ea76 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DriverResolver.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/extensions/resolvers/DriverResolver.java @@ -111,7 +111,8 @@ public WebDriver resolveParameter(@NonNull final ParameterContext parameterConte .build()); final WebDriver decoratedDriver = new EventFiringDecorator<>(webDriverListeners.toArray(new WebDriverListener[0])).decorate(driver); - @SuppressWarnings("unchecked") final WebDriver originalDriver = ((Decorated) decoratedDriver).getOriginal(); + @SuppressWarnings("unchecked") + final WebDriver originalDriver = ((Decorated) decoratedDriver).getOriginal(); store.put(TEST_STEP_BUILDER_CONSUMER, testStepBuilderConsumer); store.put(DRIVER, decoratedDriver); diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/FileUtils.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/FileUtils.java index 183d1fbfd..e17409435 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/FileUtils.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/FileUtils.java @@ -29,8 +29,8 @@ public final class FileUtils { private static final String DEFAULT_TIMESTAMP_PATTERN = "dd-MM-yyyy_HH-mm-ss"; private static final String TIMESTAMP_TO_REPLACE = "\\$\\{timestamp:?(?.*)}"; private static final Pattern TIMESTAMP_PATTERN = Pattern.compile(".*\\$\\{timestamp:(?.*)}.*"); - private static final int[] ILLEGAL_CHARS = - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 34, 42, 47, 58, 60, 62, 63, 92, 124}; + private static final int[] ILLEGAL_CHARS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 34, 42, 47, + 58, 60, 62, 63, 92, 124}; public static FileUtils getInstance() { return INSTANCE; diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/FixedSizeQueue.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/FixedSizeQueue.java index e27579723..20da030ea 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/FixedSizeQueue.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/FixedSizeQueue.java @@ -27,7 +27,7 @@ public FixedSizeQueue shrinkTo(final int maxSize) { final int currentSize = size(); log.debug("Shrinking queue. Current size: {}, max size: {}", currentSize, maxSize); - for (int i = 0; i < currentSize - maxSize; i++) { // shrinking the queue to the proper size + for (int i = 0; i < currentSize - maxSize; i++) { // shrinking the queue to the proper size poll(); } diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/Reflections.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/Reflections.java index 21fa8b8a6..abc7e9e8b 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/Reflections.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/Reflections.java @@ -61,10 +61,6 @@ public static Field getField(final String fieldName, final Object object) { @SafeVarargs public static T getFieldValue(final String fieldName, final Object object, final T... reified) { - if (reified == null || reified.length > 0) { - throw new IllegalArgumentException("Do not pass arguments as last parameter"); - } - final Object value = getValueOf(getField(fieldName, object), object); return getClassOf(reified).cast(value); } @@ -112,9 +108,14 @@ public static List getAnnotatedFieldsValues(final Object object, final Cl .toList(); } + @SafeVarargs @SuppressWarnings("unchecked") - public static Class getClassOf(final T[] array) { - return (Class) array.getClass().getComponentType(); + public static Class getClassOf(final T... reified) { + if (reified == null || reified.length > 0) { + throw new IllegalArgumentException("Do not pass arguments as last parameter"); + } + + return (Class) reified.getClass().getComponentType(); } @SneakyThrows diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java index 196424e89..04c04a821 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java @@ -95,12 +95,14 @@ public T readInternal(final String file, final Class clazz) { return read(internalFileProvider, file, clazz); } - public T readClientNode(final String node, final String file, final Class clazz) { - return readNode(clientFileProvider, node, file, clazz); + @SafeVarargs + public final T readClientNode(final String node, final String file, final T... reified) { + return readNode(clientFileProvider, node, file, Reflections.getClassOf(reified)); } - public T readInternalNode(final String node, final String file, final Class clazz) { - return readNode(internalFileProvider, node, file, clazz); + @SafeVarargs + public final T readInternalNode(final String node, final String file, final T... reified) { + return readNode(internalFileProvider, node, file, Reflections.getClassOf(reified)); } public void updateWithClientFile(final T t, final String file) { diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProvider.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProvider.java index 1597185bf..b748f87a2 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProvider.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProvider.java @@ -27,8 +27,7 @@ public Class getViews() { @Override public InjectableValues getInjectableValues() { - return new InjectableValues - .Std() + return new InjectableValues.Std() .addValue("enabledFromClient", true); } diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProvider.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProvider.java index 386ba5e0d..69d9c9c99 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProvider.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProvider.java @@ -19,8 +19,7 @@ public Class getViews() { @Override public InjectableValues getInjectableValues() { - return new InjectableValues - .Std() + return new InjectableValues.Std() .addValue("enabledFromClient", false); } diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/js/Js.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/js/Js.java index c7c91bdcc..cf42f99e1 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/js/Js.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/js/Js.java @@ -15,21 +15,25 @@ @SuppressWarnings("checkstyle:MultipleStringLiterals") public class Js { - private static final Map CONVERSION_MAP = new HashMap<>() {{ - put("class", "className"); - put("readonly", "readOnly"); - }}; + private static final Map CONVERSION_MAP = new HashMap<>() { + { + put("class", "className"); + put("readonly", "readOnly"); + } + }; private final StringUtils stringUtils = StringUtils.getInstance(); private JavascriptExecutor driver; /** - * Find the first WebElement using the given method starting from the provided context + * Find the first WebElement using the given method starting from the provided + * context * - * @param context the context where to search the element + * @param context the context where to search the element * @param webElementFinder locating mechanism for finding the WebElement - * @param locatorValue the value used by the locating mechanism + * @param locatorValue the value used by the locating mechanism + * * @return the found WebElement */ public WebElement findElement(final WebElement context, final WebElementFinder webElementFinder, final String locatorValue) { @@ -40,7 +44,8 @@ public WebElement findElement(final WebElement context, final WebElementFinder w * Find the first WebElement using the given method starting from document * * @param webElementFinder the locating mechanism for finding the WebElement - * @param locatorValue the value used by the locating mechanism + * @param locatorValue the value used by the locating mechanism + * * @return the found WebElement */ public WebElement findElement(final WebElementFinder webElementFinder, final String locatorValue) { @@ -48,11 +53,13 @@ public WebElement findElement(final WebElementFinder webElementFinder, final Str } /** - * Find all WebElements using the given method starting from the provided context + * Find all WebElements using the given method starting from the provided + * context * - * @param context the context where to search the elements + * @param context the context where to search the elements * @param webElementFinder the locating mechanism for finding all WebElements - * @param locatorValue the value used by the locating mechanism + * @param locatorValue the value used by the locating mechanism + * * @return the list of found WebElements */ public List findElements(final WebElement context, final WebElementFinder webElementFinder, final String locatorValue) { @@ -60,10 +67,12 @@ public List findElements(final WebElement context, final WebElementF } /** - * Find all WebElements using the given method starting from the provided context + * Find all WebElements using the given method starting from the provided + * context * * @param webElementFinder the locating mechanism for finding all WebElements - * @param locatorValue the value used by the locating mechanism + * @param locatorValue the value used by the locating mechanism + * * @return the list of found WebElements */ public List findElements(final WebElementFinder webElementFinder, final String locatorValue) { @@ -74,6 +83,7 @@ public List findElements(final WebElementFinder webElementFinder, fi * Get the innerText of the provided webElement * * @param webElement the WebElement from which the innerText has to be taken + * * @return the value of the innerText */ public String getText(final WebElement webElement) { @@ -83,8 +93,9 @@ public String getText(final WebElement webElement) { /** * Get the CSS Value of the provided property * - * @param webElement the WebElement from which the tag CSS value is taken + * @param webElement the WebElement from which the tag CSS value is taken * @param cssProperty the CSS property to read + * * @return the value of the CSS property as String */ public String getCssValue(final WebElement webElement, final String cssProperty) { @@ -95,6 +106,7 @@ public String getCssValue(final WebElement webElement, final String cssProperty) * Get the shadowRoot of the provided WebElement * * @param webElement the WebElement from which the shadowRoot is taken + * * @return the shadowRoot of the WebElement */ public SearchContext getShadowRoot(final WebElement webElement) { @@ -105,6 +117,7 @@ public SearchContext getShadowRoot(final WebElement webElement) { * Get the Tag of the provided WebElement * * @param webElement the WebElement from which the tag name is taken + * * @return the tag name of the WebElement */ public String getTagName(final WebElement webElement) { @@ -116,8 +129,9 @@ public String getTagName(final WebElement webElement) { /** * Get the static attribute of the provided WebElement * - * @param webElement the WebElement from which the static attribute is taken + * @param webElement the WebElement from which the static attribute is taken * @param domAttribute the static Attribute to retrieve + * * @return the DOM Attribute of the WebElement or null if there isn't */ public String getDomAttribute(final WebElement webElement, final String domAttribute) { @@ -129,8 +143,9 @@ public String getDomAttribute(final WebElement webElement, final String domAttri /** * Get the property of the provided WebElement * - * @param webElement the webElement from which the property is taken + * @param webElement the webElement from which the property is taken * @param domProperty the property to retrieve + * * @return the DOM property of the WebElement or null if there isn't */ public String getDomProperty(final WebElement webElement, final String domProperty) { @@ -140,10 +155,12 @@ public String getDomProperty(final WebElement webElement, final String domProper } /** - * Get the property of the provided WebElement, if is null tries to take the dom attribute with the same name + * Get the property of the provided WebElement, if is null tries to take the dom + * attribute with the same name * * @param webElement the webElement from which the property is taken - * @param attribute the property/attribute to retrieve + * @param attribute the property/attribute to retrieve + * * @return the attribute/property current value or null if the value is not set. */ public String getAttribute(final WebElement webElement, final String attribute) { @@ -157,6 +174,7 @@ public String getAttribute(final WebElement webElement, final String attribute) * Determine whether the element is selected or not * * @param webElement the webElement to check + * * @return true if element is currently selected/checked, false otherwise */ public boolean isSelected(final WebElement webElement) { @@ -167,6 +185,7 @@ public boolean isSelected(final WebElement webElement) { * Determine whether the element is enabled or not * * @param webElement the webElement to check + * * @return true if element is enabled, false otherwise */ public boolean isEnabled(final WebElement webElement) { @@ -179,23 +198,28 @@ public boolean isEnabled(final WebElement webElement) { * Determine whether the element is displayed or not * * @param webElement the webElement to check + * * @return true if element is displayed, false otherwise */ public boolean isDisplayed(final WebElement webElement) { return (boolean) driver.executeScript("var rectangle = arguments[0].getBoundingClientRect();" + "return arguments[0].checkVisibility({visibilityProperty:true, opacityProperty:true}) && " + - "rectangle.height > 0 && rectangle.width > 0", webElement); + "rectangle.height > 0 && rectangle.width > 0", + webElement); } /** * Get the size of the provided WebElement * * @param webElement the WebElement from which the size is taken + * * @return the rendered Size of the WebElement */ public Dimension getSize(final WebElement webElement) { - @SuppressWarnings("unchecked") final List dimensions = (List) driver.executeScript("var rectangle = arguments[0].getBoundingClientRect(); " + - "return [rectangle.width, rectangle.height];", webElement); + @SuppressWarnings("unchecked") + final List dimensions = (List) driver.executeScript("var rectangle = arguments[0].getBoundingClientRect(); " + + "return [rectangle.width, rectangle.height];", + webElement); return new Dimension(((Number) dimensions.get(0)).intValue(), ((Number) dimensions.get(1)).intValue()); } @@ -204,11 +228,14 @@ public Dimension getSize(final WebElement webElement) { * Get the location and size of the provided WebElement * * @param webElement the WebElement from which the location and size are taken + * * @return the location and size of the rendered WebElement */ public Rectangle getRect(final WebElement webElement) { - @SuppressWarnings("unchecked") final List rectangle = (List) driver.executeScript("var rectangle = arguments[0].getBoundingClientRect(); " + - "return [rectangle.x, rectangle.y, rectangle.width, rectangle.height];", webElement); + @SuppressWarnings("unchecked") + final List rectangle = (List) driver.executeScript("var rectangle = arguments[0].getBoundingClientRect(); " + + "return [rectangle.x, rectangle.y, rectangle.width, rectangle.height];", + webElement); final Point point = new Point((rectangle.get(0)).intValue(), (rectangle.get(1)).intValue()); final Dimension dimension = new Dimension((rectangle.get(2)).intValue(), (rectangle.get(3)).intValue()); @@ -220,11 +247,14 @@ public Rectangle getRect(final WebElement webElement) { * Get the location of the provided WebElement * * @param webElement the WebElement from which the location and size are taken + * * @return the top left-hand point of the rendered WebElement */ public Point getLocation(final WebElement webElement) { - @SuppressWarnings("unchecked") final List point = (List) driver.executeScript("var rectangle = arguments[0].getBoundingClientRect(); " + - "return [rectangle.x, rectangle.y];", webElement); + @SuppressWarnings("unchecked") + final List point = (List) driver.executeScript("var rectangle = arguments[0].getBoundingClientRect(); " + + "return [rectangle.x, rectangle.y];", + webElement); return new Point(((Number) point.get(0)).intValue(), ((Number) point.get(1)).intValue()); } @@ -233,6 +263,7 @@ public Point getLocation(final WebElement webElement) { * Performs a click with javascript on the provided WebElement * * @param webElement the WebElement to click on + * * @return the calling SpectrumEntity instance */ public Js click(final WebElement webElement) { @@ -246,6 +277,7 @@ public Js click(final WebElement webElement) { * * @param webElement the WebElement to target the send method * @param keysToSend the String to send to webElement + * * @return the calling SpectrumEntity instance */ public Js sendKeys(final WebElement webElement, final CharSequence... keysToSend) { @@ -263,6 +295,7 @@ public Js sendKeys(final WebElement webElement, final CharSequence... keysToSend * Performs a submit action on the provided form * * @param webElement the WebElement to submit + * * @return the calling SpectrumEntity instance */ public Js submit(final WebElement webElement) { @@ -275,6 +308,7 @@ public Js submit(final WebElement webElement) { * Clear input value with javascript on the provided WebElement * * @param webElement the WebElement used to clear the input field + * * @return the calling SpectrumEntity instance */ public Js clear(final WebElement webElement) { diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparator.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparator.java index 835c77f8e..60907da23 100644 --- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparator.java +++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparator.java @@ -17,13 +17,15 @@ public class StatusComparator implements TestsComparator { @JsonPropertyDescription("Weights of tests statuses. A lower weight means the test is shown before those with a higher one in the Extent report") - private final Map weights = new HashMap<>() {{ - put(INFO, INFO.getLevel()); - put(PASS, PASS.getLevel()); - put(WARNING, WARNING.getLevel()); - put(SKIP, SKIP.getLevel()); - put(FAIL, FAIL.getLevel()); - }}; + private final Map weights = new HashMap<>() { + { + put(INFO, INFO.getLevel()); + put(PASS, PASS.getLevel()); + put(WARNING, WARNING.getLevel()); + put(SKIP, SKIP.getLevel()); + put(FAIL, FAIL.getLevel()); + } + }; @Override public int compare(final Test test1, final Test test2) { diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumEntityTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumEntityTest.java index 28196c792..09363ab7d 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumEntityTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumEntityTest.java @@ -226,8 +226,7 @@ void getSharedFields() { "data", "statefulExtentTest", "testContext", - "jsWebElementProxyBuilder" - ))); + "jsWebElementProxyBuilder"))); } @Test @@ -486,8 +485,7 @@ void isPresent(final List webElements, final boolean expected) { static Stream isPresentProvider() { return Stream.of( arguments(List.of(), false), - arguments(List.of(mock(WebElement.class)), true) - ); + arguments(List.of(mock(WebElement.class)), true)); } @DisplayName("isNotPresent should return true if the element located by the provided By is not in the dom") @@ -502,8 +500,7 @@ void isNotPresent(final List webElements, final boolean expected) { static Stream isNotPresentProvider() { return Stream.of( arguments(List.of(), true), - arguments(List.of(mock(WebElement.class)), false) - ); + arguments(List.of(mock(WebElement.class)), false)); } @DisplayName("hasClass should check if the provided webElement has the provided css class") @@ -520,8 +517,7 @@ static Stream hasClassProvider() { arguments(null, false), arguments("", false), arguments("cssClass", true), - arguments("one cssClass another", true) - ); + arguments("one cssClass another", true)); } @DisplayName("hasClasses should check if the provided webElement has all the provided css class") @@ -538,8 +534,7 @@ static Stream hasClassesProvider() { arguments(null, false), arguments("", false), arguments("cssClass", false), - arguments("one cssClass another", true) - ); + arguments("one cssClass another", true)); } private static final class DummySpectrumEntity extends SpectrumEntity, T> { diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumPageTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumPageTest.java index 205c19957..cf938afc8 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumPageTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumPageTest.java @@ -142,8 +142,7 @@ static Stream valuesProvider() { return Stream.of( arguments("baseUrl", "/endpoint", "baseUrl/endpoint", true), arguments("baseUrl", "endpoint", "baseUrl/endpoint", true), - arguments("baseUrl", "/endpoint", "nope", false) - ); + arguments("baseUrl", "/endpoint", "nope", false)); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumSessionListenerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumSessionListenerTest.java index 4eca27a11..cc9f43789 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumSessionListenerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/SpectrumSessionListenerTest.java @@ -124,9 +124,9 @@ void launcherSessionOpened() { when(yamlUtils.readInternal("properties.yaml", ProjectProperties.class)).thenReturn(projectProperties); when(freeMarkerWrapper.interpolate(banner, projectProperties)).thenReturn(interpolatedBanner); - when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION, String.class)).thenReturn(profile); - when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML, String.class)).thenReturn("defaultProfile"); - when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML, Map.class)).thenReturn(Map.of("one", "one")); + when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION)).thenReturn(profile); + when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn("defaultProfile"); + when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn(Map.of("one", "one")); when(launcherSession.getLauncher()).thenReturn(launcher); when(configuration.getRuntime()).thenReturn(runtime); @@ -180,11 +180,11 @@ void parseConfigurationNoProfile() { System.setProperty("os.name", "Win"); // parseProfile - when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION, String.class)).thenReturn(""); - when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML, String.class)).thenReturn("defaultProfile"); + when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION)).thenReturn(""); + when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn("defaultProfile"); // parseVars - when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML, Map.class)).thenReturn(Map.of("one", "one")); + when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn(Map.of("one", "one")); spectrumSessionListener.parseConfiguration(); @@ -201,11 +201,11 @@ void parseConfiguration() { System.setProperty("os.name", "Win"); // parseProfile - when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION, String.class)).thenReturn(profile); - when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML, String.class)).thenReturn("defaultProfile"); + when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION)).thenReturn(profile); + when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn("defaultProfile"); // parseVars - when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML, Map.class)).thenReturn(Map.of("one", "one")); + when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn(Map.of("one", "one")); spectrumSessionListener.parseConfiguration(); @@ -223,12 +223,12 @@ void parseConfigurationUnix() { System.setProperty("os.name", "nix"); // parseProfile - when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION, String.class)).thenReturn(profile); - when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML, String.class)).thenReturn("defaultProfile"); + when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION)).thenReturn(profile); + when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn("defaultProfile"); // parseVars - when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML, Map.class)).thenReturn(Map.of("one", "one")); - when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_UNIX_YAML, Map.class)).thenReturn(Map.of("one", "one")); + when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn(Map.of("one", "one")); + when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_UNIX_YAML)).thenReturn(Map.of("one", "one")); spectrumSessionListener.parseConfiguration(); @@ -242,8 +242,8 @@ void parseConfigurationUnix() { @ParameterizedTest(name = "with profile {0} and default profile {1} we expect {2}") @MethodSource("profilesValuesProvider") void parseProfiles(final String profile, final String defaultProfile, final List expected) { - when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION, String.class)).thenReturn(profile); - when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML, String.class)).thenReturn(defaultProfile); + when(yamlUtils.readClientNode(PROFILE_NODE, CONFIGURATION)).thenReturn(profile); + when(yamlUtils.readInternalNode(PROFILE_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn(defaultProfile); assertEquals(expected, spectrumSessionListener.parseProfiles()); } @@ -255,8 +255,7 @@ static Stream profilesValuesProvider() { arguments("overridden-profile,second", "default-profile", List.of("overridden-profile", "second")), arguments(null, "default-profile", List.of("default-profile")), arguments(null, "default-profile,another", List.of("default-profile", "another")), - arguments(null, " ,,default-profile,another", List.of("default-profile", "another")) - ); + arguments(null, " ,,default-profile,another", List.of("default-profile", "another"))); } @DisplayName("parseVars should put in the VARS map all the variables read from the configuration yaml files") @@ -267,11 +266,11 @@ void parseVars(final Map defaultVars, final Map System.setProperty("os.name", "Win"); - when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML, Map.class)).thenReturn(defaultVars); - when(yamlUtils.readClientNode(VARS_NODE, CONFIGURATION, Map.class)).thenReturn(vars); - when(yamlUtils.readClientNode(VARS_NODE, profileConfiguration, Map.class)).thenReturn(envVars); + when(yamlUtils.readInternalNode(VARS_NODE, DEFAULT_CONFIGURATION_YAML)).thenReturn(defaultVars); + when(yamlUtils.readClientNode(VARS_NODE, CONFIGURATION)).thenReturn(vars); + when(yamlUtils.readClientNode(VARS_NODE, profileConfiguration)).thenReturn(envVars); - spectrumSessionListener.parseVars(profileConfiguration); + spectrumSessionListener.parseVars(List.of(profileConfiguration)); assertEquals(expected, Vars.getInstance()); } @@ -283,12 +282,12 @@ void parseVarsUnix(final Map defaultVars, final Map varsValuesProvider() { arguments(Map.of("one", "one"), null, null, Map.of("one", "one")), arguments(Map.of("one", "one"), Map.of("two", "two"), null, Map.of("one", "one", "two", "two")), arguments(Map.of("one", "one"), null, Map.of("three", "three"), Map.of("one", "one", "three", "three")), - arguments(Map.of("one", "one"), Map.of("two", "two"), Map.of("three", "three"), Map.of("one", "one", "two", "two", "three", "three")) - ); + arguments(Map.of("one", "one"), Map.of("two", "two"), Map.of("three", "three"), Map.of("one", "one", "two", "two", "three", "three"))); } @DisplayName("isUnix should check the OS") @@ -315,7 +313,6 @@ static Stream isUnixValuesProvider() { arguments("nix", true), arguments("blah", true), arguments("Win", false), - arguments("WiN", false) - ); + arguments("WiN", false)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/interceptors/SpectrumInterceptorTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/interceptors/SpectrumInterceptorTest.java index 73dc4f35e..4c5b8b581 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/interceptors/SpectrumInterceptorTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/interceptors/SpectrumInterceptorTest.java @@ -160,8 +160,7 @@ static Stream valuesProvider() { return Stream.of( arguments(true, true), arguments(true, false), - arguments(false, false) - ); + arguments(false, false)); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/DataResolverTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/DataResolverTest.java index f31946fd0..47412c0f7 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/DataResolverTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/DataResolverTest.java @@ -91,8 +91,7 @@ void supportsParameter(final String typeName, final boolean expected) { static Stream valuesProvider() { return Stream.of( arguments("Data", true), - arguments("not-good", false) - ); + arguments("not-good", false)); } @DisplayName("resolveParameter should load the data class from client side and deserialize the data.yaml on it") diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/StatefulExtentTestResolverTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/StatefulExtentTestResolverTest.java index 6b52c7e01..d06d0a8df 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/StatefulExtentTestResolverTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/StatefulExtentTestResolverTest.java @@ -148,7 +148,6 @@ static Stream noVideoValuesProvider() { return Stream.of( arguments(false, false), arguments(true, false), - arguments(true, true) - ); + arguments(true, true)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/bidi/BiDiTypeBasedParameterResolverTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/bidi/BiDiTypeBasedParameterResolverTest.java index 46e48bac8..f8cfab48a 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/bidi/BiDiTypeBasedParameterResolverTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/resolvers/bidi/BiDiTypeBasedParameterResolverTest.java @@ -77,8 +77,7 @@ void supportsParameter(final Class clazz, final boolean expected) { static Stream valuesProvider() { return Stream.of( arguments(String.class, true), - arguments(Object.class, false) - ); + arguments(Object.class, false)); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/watchers/EventsWatcherTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/watchers/EventsWatcherTest.java index 4ebfe7846..35ada4729 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/extensions/watchers/EventsWatcherTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/extensions/watchers/EventsWatcherTest.java @@ -195,8 +195,7 @@ void isTestFactory(final String methodName, final boolean expected) throws NoSuc static Stream valuesProvider() { return Stream.of( arguments("testFactoryMethod", true), - arguments("testAfterEach", false) - ); + arguments("testAfterEach", false)); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/interfaces/BiDiDriverTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/interfaces/BiDiDriverTest.java index 1a6d6ef8a..df1cb0716 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/interfaces/BiDiDriverTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/interfaces/BiDiDriverTest.java @@ -51,7 +51,6 @@ static Stream valuesProvider() { arguments(true, true, true), arguments(true, false, true), arguments(false, true, true), - arguments(false, false, false) - ); + arguments(false, false, false)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/ColoredConverterTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/ColoredConverterTest.java index 31bb2ec28..c01acf7cd 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/ColoredConverterTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/ColoredConverterTest.java @@ -40,7 +40,6 @@ static Stream valuesProvider() { arguments(WARN, YELLOW_FG), arguments(INFO, BLUE_FG), arguments(TRACE, MAGENTA_FG), - arguments(DEBUG, DEFAULT_FG) - ); + arguments(DEBUG, DEFAULT_FG)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/DriverDeserializerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/DriverDeserializerTest.java index 0ae9f065f..b132ad934 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/DriverDeserializerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/DriverDeserializerTest.java @@ -72,7 +72,6 @@ static Stream valuesProvider() { arguments("xcuiTest", mock(XCUITest.class)), arguments("windows", mock(Windows.class)), arguments("mac2", mock(Mac2.class)), - arguments("appiumGeneric", mock(AppiumGeneric.class)) - ); + arguments("appiumGeneric", mock(AppiumGeneric.class))); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/EnvironmentDeserializerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/EnvironmentDeserializerTest.java index 836dd8384..e1cfd0db5 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/EnvironmentDeserializerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/EnvironmentDeserializerTest.java @@ -68,7 +68,6 @@ static Stream valuesProvider() { arguments("${justToTestInterpolation:-local}", mock(LocalEnvironment.class)), arguments("local", mock(LocalEnvironment.class)), arguments("grid", mock(GridEnvironment.class)), - arguments("appium", mock(AppiumEnvironment.class)) - ); + arguments("appium", mock(AppiumEnvironment.class))); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedBooleanDeserializerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedBooleanDeserializerTest.java index 49ac62e3e..9ebe77493 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedBooleanDeserializerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedBooleanDeserializerTest.java @@ -73,7 +73,6 @@ static Stream valuesProvider() { arguments("${varInEnv:-true}", false), arguments("${varInEnv}", false), arguments("${not.set}", false), - arguments("${notSet}", false) - ); + arguments("${notSet}", false)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedObjectDeserializerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedObjectDeserializerTest.java index b28cd6149..b052189dc 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedObjectDeserializerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedObjectDeserializerTest.java @@ -265,8 +265,7 @@ static Stream valuesProvider() { arguments("$", 0), arguments("$", 0), arguments("$", Integer.parseInt(VAR_IN_ENV)), - arguments("$", Integer.parseInt(VAR_IN_ENV)) - ); + arguments("$", Integer.parseInt(VAR_IN_ENV))); } @Test @@ -321,7 +320,6 @@ static Stream isNumberValuesProvider() { arguments("-123", true), arguments("-123,5", true), arguments("-123.5", true), - arguments("-", false) - ); + arguments("-", false)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedStringDeserializerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedStringDeserializerTest.java index 95fbc9d16..91fb83149 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedStringDeserializerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/InterpolatedStringDeserializerTest.java @@ -81,8 +81,7 @@ static Stream valuesProvider() { arguments("${varInEnv}", VAR_IN_ENV), arguments("${varInEnv:-~/local}", VAR_IN_ENV), arguments("${not.set}", "${not.set}"), - arguments("${notSet}", "${notSet}") - ); + arguments("${notSet}", "${notSet}")); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/LogbackLogLevelDeserializerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/LogbackLogLevelDeserializerTest.java index 10a910a3a..a7d7c7ed4 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/LogbackLogLevelDeserializerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/jackson/deserializers/LogbackLogLevelDeserializerTest.java @@ -56,7 +56,6 @@ static Stream valuesProvider() { arguments("DEBUG", DEBUG), arguments("INFO", INFO), arguments("WARN", WARN), - arguments("default", DEBUG) - ); + arguments("default", DEBUG)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/EventsWebDriverListenerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/EventsWebDriverListenerTest.java index 3ab25773e..533eab3de 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/EventsWebDriverListenerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/EventsWebDriverListenerTest.java @@ -127,8 +127,7 @@ void parse() { s, "null", "css selector: #gettotal -> tag name: button", - "css selector: #get1-.total -> tag name: button" - ); + "css selector: #get1-.total -> tag name: button"); when(webElement1.toString()).thenReturn(webElement1ToString); when(webElement2.toString()).thenReturn(webElement2ToString); @@ -167,8 +166,7 @@ void parseDefault() { s, "null", "css selector: #gettotal -> tag name: button", - "css selector: #get1-.total -> tag name: button" - ); + "css selector: #get1-.total -> tag name: button"); when(webElement1.toString()).thenReturn(webElement1ToString); when(webElement2.toString()).thenReturn(webElement2ToString); diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/SpectrumWebDriverListenerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/SpectrumWebDriverListenerTest.java index ce0507487..dc12fea50 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/SpectrumWebDriverListenerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/internals/web_driver_listeners/SpectrumWebDriverListenerTest.java @@ -51,8 +51,7 @@ static Stream valuesProvider() { arguments("[[[[ChromeDriver: chrome on WINDOWS (5db9fd1ca57389187f02aa09397ea93c)] -> css selector: #gettotal]] -> tag name: button]", "css selector: #gettotal -> tag name: button"), arguments("[[[[ChromeDriver: chrome on WINDOWS (5db9fd1ca57389187f02aa09397ea93c)] -> css selector: #get1-.total]] -> tag name: button]", - "css selector: #get1-.total -> tag name: button") - ); + "css selector: #get1-.total -> tag name: button")); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/ContextManagerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/ContextManagerTest.java index 48ba94327..d30fa2e13 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/ContextManagerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/ContextManagerTest.java @@ -74,9 +74,11 @@ void initForContext() { void initWithParentFor() { final String uniqueId = "uniqueId"; final String parentUniqueId = "parentUniqueId"; - final Map testContexts = new HashMap<>() {{ - put(parentUniqueId, testContext); - }}; + final Map testContexts = new HashMap<>() { + { + put(parentUniqueId, testContext); + } + }; Reflections.setField("testContexts", contextManager, testContexts); when(context.getUniqueId()).thenReturn(uniqueId); diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/ExtentReporterTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/ExtentReporterTest.java index 72f72118c..5ee2eb16d 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/ExtentReporterTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/ExtentReporterTest.java @@ -536,8 +536,7 @@ static Stream valuesProvider() { return Stream.of( arguments(FAIL, RED), arguments(SKIP, AMBER), - arguments(INFO, GREEN) - ); + arguments(INFO, GREEN)); } @DisplayName("logTestEnd should create the test in the report and delegate to finalizeTest") diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/FileUtilsTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/FileUtilsTest.java index b1c66a3e0..891822991 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/FileUtilsTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/FileUtilsTest.java @@ -107,8 +107,7 @@ static Stream fileNamesProvider() { arguments("fileName.html", "fileName.html"), arguments("fileName-${timestamp}.html", "fileName-[0-9]{2}-[0-9]{2}-[0-9]{4}_[0-9]{2}-[0-9]{2}-[0-9]{2}.html"), arguments("fileName-${timestamp:dd-MM-yyyy_HH-mm-ss}.html", "fileName-[0-9]{2}-[0-9]{2}-[0-9]{4}_[0-9]{2}-[0-9]{2}-[0-9]{2}.html"), - arguments("fileName-${timestamp:dd-MM-yyyy}.html", "fileName-[0-9]{2}-[0-9]{2}-[0-9]{4}.html") - ); + arguments("fileName-${timestamp:dd-MM-yyyy}.html", "fileName-[0-9]{2}-[0-9]{2}-[0-9]{4}.html")); } @DisplayName("getExtensionOf should return the extension of the provided fileName") @@ -122,8 +121,7 @@ static Stream getExtensionOfValuesProvider() { return Stream.of( arguments("fileName.abc", "abc"), arguments("fileName", "fileName"), - arguments("fileName.", "") - ); + arguments("fileName.", "")); } @DisplayName("removeExtensionFrom should return the provided fileName without the extension") @@ -137,8 +135,7 @@ static Stream removeExtensionFromValuesProvider() { return Stream.of( arguments("fileName.abc", "fileName"), arguments("fileName", "fileName"), - arguments("fileName.", "fileName") - ); + arguments("fileName.", "fileName")); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/FixedSizeQueueTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/FixedSizeQueueTest.java index dd1ac5491..c284986af 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/FixedSizeQueueTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/FixedSizeQueueTest.java @@ -55,7 +55,6 @@ static Stream valuesProvider() { return Stream.of( arguments(3, 2, 2), arguments(1, 1, 1), - arguments(1, 2, 1) - ); + arguments(1, 2, 1)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/ReflectionsTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/ReflectionsTest.java index 01a2374bf..627d74396 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/ReflectionsTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/ReflectionsTest.java @@ -40,8 +40,7 @@ void getFieldsOf(final Class clazz, final Class limit, final List static Stream valuesProvider() { return Stream.of( arguments(Dummy.class, DummyParent.class, List.of("fieldString", "secured")), - arguments(Dummy.class, Object.class, List.of("fieldString", "secured", "parentField")) - ); + arguments(Dummy.class, Object.class, List.of("fieldString", "secured", "parentField"))); } @Test @@ -95,8 +94,7 @@ void getFieldValueException(final Dummy[] reified) { static Stream getFieldValueExceptionValuesProvider() { return Stream.of( - arguments((Object) new Dummy[]{new Dummy("value")}) - ); + arguments((Object) new Dummy[]{new Dummy("value")})); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/RetentionTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/RetentionTest.java index 686d436e0..f8ec74502 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/RetentionTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/RetentionTest.java @@ -502,7 +502,6 @@ static Stream valuesProvider() { return Stream.of( arguments(5L, true), arguments(3L, true), - arguments(0L, false) - ); + arguments(0L, false)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/SummaryTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/SummaryTest.java index 015536e1a..07ac36816 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/SummaryTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/SummaryTest.java @@ -184,7 +184,6 @@ void toResult(final boolean successful, final Result expected) { static Stream valuesProvider() { return Stream.of( arguments(true, SUCCESSFUL), - arguments(false, FAILED) - ); + arguments(false, FAILED)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/YamlUtilsTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/YamlUtilsTest.java index 6c7547b58..b5ea033d0 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/YamlUtilsTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/YamlUtilsTest.java @@ -79,8 +79,8 @@ void construction() { "HtmlTestBookReporter", "LogSummaryReporter", "TxtSummaryReporter", - "HtmlSummaryReporter" - ), ((YAMLMapper) Reflections.getFieldValue("yamlMapper", yamlUtils)).getRegisteredModuleIds()); + "HtmlSummaryReporter"), + ((YAMLMapper) Reflections.getFieldValue("yamlMapper", yamlUtils)).getRegisteredModuleIds()); assertEquals(Set.of( "jackson-datatype-jsr310", @@ -88,8 +88,8 @@ void construction() { "String", "boolean", "Level", - "Duration" - ), ((YAMLMapper) Reflections.getFieldValue("dynamicConfYamlMapper", yamlUtils)).getRegisteredModuleIds()); + "Duration"), + ((YAMLMapper) Reflections.getFieldValue("dynamicConfYamlMapper", yamlUtils)).getRegisteredModuleIds()); assertFalse(((ObjectWriter) Reflections.getFieldValue("writer", yamlUtils)).isEnabled(SerializationFeature.FAIL_ON_EMPTY_BEANS)); } @@ -123,14 +123,15 @@ void readInternal() { @Test @DisplayName("readNode should return null if the provided client file doesn't exist") void readNotExistingClientNode() { - assertNull(yamlUtils.readClientNode("/objectKey", "not-existing", TestYaml.ObjectKey.class)); + assertNull(yamlUtils.readClientNode("/objectKey", "not-existing")); } @DisplayName("readNode should check if the provided file exists and return the node requested") @ParameterizedTest(name = "with file {0}") @ValueSource(strings = {"test.yaml", "test.yml", "configurations/test.yaml"}) void readNode(final String file) { - assertEquals("objectValue", Objects.requireNonNull(yamlUtils.readInternalNode("/objectKey", file, TestYaml.ObjectKey.class)).getObjectField()); + final TestYaml.ObjectKey value = Objects.requireNonNull(yamlUtils.readInternalNode("/objectKey", file)); + assertEquals("objectValue", value.getObjectField()); } @DisplayName("readNode for client-side files should just delegate to the readNode method") @@ -154,7 +155,8 @@ void readClientNode(final String file) throws IOException { @Test @DisplayName("readInternalNode should just delegate to the readNode method") void readInternalNode() { - assertEquals("objectValue", yamlUtils.readInternalNode("/objectKey", "test.yaml", TestYaml.ObjectKey.class).getObjectField()); + final TestYaml.ObjectKey value = yamlUtils.readInternalNode("/objectKey", "test.yaml"); + assertEquals("objectValue", value.getObjectField()); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/DriverConsumerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/DriverConsumerTest.java index 2a4f11cd4..abffaf892 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/DriverConsumerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/DriverConsumerTest.java @@ -89,8 +89,7 @@ static Stream valuesProvider() { arguments(SUCCESSFUL, true), arguments(FAILED, true), arguments(ABORTED, true), - arguments(DISABLED, false) - ); + arguments(DISABLED, false)); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/EventsConsumerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/EventsConsumerTest.java index ca1604590..2af2bd978 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/EventsConsumerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/EventsConsumerTest.java @@ -43,8 +43,7 @@ static Stream tagsIntersectProvider() { arguments(Set.of(TEST), null, false), arguments(null, Set.of(TEST), false), arguments(Set.of(SUITE, TEST), Set.of(TEST), true), - arguments(Set.of(TEST), Set.of(SUITE, TEST), true) - ); + arguments(Set.of(TEST), Set.of(SUITE, TEST), true)); } @DisplayName("primaryAndSecondaryIdMatch") @@ -70,8 +69,7 @@ static Stream primaryAndSecondaryIdMatchProvider() { arguments("class", "test", "class", "test", true), arguments("classAAA", "test", "class.*", "test", true), arguments("class", "testAAA", "class", "test.*", true), - arguments("classAAA", "testAAA", "class.*", "test.*", true) - ); + arguments("classAAA", "testAAA", "class.*", "test.*", true)); } @DisplayName("justPrimaryIdMatches") @@ -90,8 +88,7 @@ static Stream justPrimaryIdMatchesProvider() { arguments("class", null, false), arguments("class", "nope", false), arguments("class", "class", true), - arguments("classAAA", "class.*", true) - ); + arguments("classAAA", "class.*", true)); } @DisplayName("reasonMatches") @@ -110,8 +107,7 @@ static Stream reasonMatchesProvider() { arguments(AFTER, null, false), arguments(AFTER, BEFORE, false), arguments(AFTER, AFTER, true), - arguments("afterAAA", "after.*", true) - ); + arguments("afterAAA", "after.*", true)); } @DisplayName("resultMatches") @@ -128,8 +124,7 @@ static Stream resultProvider() { return Stream.of( arguments(null, FAILED, false), arguments(SUCCESSFUL, FAILED, false), - arguments(SUCCESSFUL, SUCCESSFUL, true) - ); + arguments(SUCCESSFUL, SUCCESSFUL, true)); } @DisplayName("findMatchFor") @@ -157,8 +152,7 @@ static Stream findMatchForProvider() { arguments(Event.builder().result(FAILED).primaryId("class").build(), Event.builder().result(FAILED).primaryId("nope").build(), false), arguments(Event.builder().result(FAILED).primaryId("class").build(), Event.builder().result(FAILED).primaryId("class").build(), true), arguments(Event.builder().result(FAILED).tags(Set.of(TEST)).build(), Event.builder().result(FAILED).tags(Set.of(SUITE)).build(), false), - arguments(Event.builder().result(FAILED).tags(Set.of(TEST)).build(), Event.builder().result(FAILED).tags(Set.of(TEST)).build(), true) - ); + arguments(Event.builder().result(FAILED).tags(Set.of(TEST)).build(), Event.builder().result(FAILED).tags(Set.of(TEST)).build(), true)); } @Test @@ -180,7 +174,7 @@ void match() { // we use the getContext method in the consumes of the DummyEventsConsumer below just to verify the interaction verify(firedEvent).getContext(); - verify(matchingEvent, never()).getContext(); // we never consume the user-defined event (as "event"). We consume the fired event + verify(matchingEvent, never()).getContext(); // we never consume the user-defined event (as "event"). We consume the fired event verify(neverMatchingEvent, never()).getContext(); } @@ -216,8 +210,7 @@ private static class DummyEventsConsumer extends EventsConsumer { DummyEventsConsumer() { events = List.of( - Event.builder().reason(BEFORE).primaryId("class").build() - ); + Event.builder().reason(BEFORE).primaryId("class").build()); } @Override diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/MailConsumerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/MailConsumerTest.java index c5ecfb8fb..f0df6097a 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/MailConsumerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/MailConsumerTest.java @@ -115,7 +115,7 @@ void accept() { when(attachment2.getFile()).thenReturn(file2); final MailConsumer mailConsumer = new MailConsumer(); - assertEquals(List.of(), Reflections.getFieldValue("attachments", mailConsumer)); // to check the default is an empty list + assertEquals(List.of(), Reflections.getFieldValue("attachments", mailConsumer)); // to check the default is an empty list Reflections.setField("attachments", mailConsumer, List.of(attachment1, attachment2)); mailConsumer.accept(event); diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoBaseConsumerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoBaseConsumerTest.java index 5c87f30f8..0324bd00d 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoBaseConsumerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoBaseConsumerTest.java @@ -67,8 +67,7 @@ static Stream shouldAcceptValuesProvider() { arguments(DISABLED, true, false), arguments(SUCCESSFUL, true, false), arguments(DISABLED, false, false), - arguments(SUCCESSFUL, false, true) - ); + arguments(SUCCESSFUL, false, true)); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoConsumerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoConsumerTest.java index 6212fe08e..d16552978 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoConsumerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/events/video/VideoConsumerTest.java @@ -274,7 +274,7 @@ void chooseDimensionForProvided(final int width, final int height) { reset(video); when(video.getWidth()).thenReturn(width); - if (width >= 1) { // short-circuit + if (width >= 1) { // short-circuit when(video.getHeight()).thenReturn(height); } when(driver.manage()).thenReturn(options); @@ -294,8 +294,7 @@ static Stream dimensionProvider() { return Stream.of( arguments(0, 0), arguments(1, 0), - arguments(0, 1) - ); + arguments(0, 1)); } @DisplayName("makeItEven should increment the provided int if it's odd") @@ -308,8 +307,7 @@ void makeItEven(final int i, final int expected) { static Stream valuesProvider() { return Stream.of( arguments(0, 0), - arguments(1, 2) - ); + arguments(1, 2)); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProviderTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProviderTest.java index e29d948ce..1847f815a 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProviderTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/ClientFileProviderTest.java @@ -37,8 +37,8 @@ void getViews() { @Test @DisplayName("getInjectableValues should return the client injectables") void getInjectableValues() { - final MockedConstruction mockedConstruction = mockConstruction(InjectableValues.Std.class, (mock, context) -> - when(mock.addValue("enabledFromClient", true)).thenReturn(mock)); + final MockedConstruction mockedConstruction = mockConstruction(InjectableValues.Std.class, + (mock, context) -> when(mock.addValue("enabledFromClient", true)).thenReturn(mock)); final InjectableValues actual = fileProvider.getInjectableValues(); @@ -83,8 +83,7 @@ void findValidPathsFor(final String file, final Stream strings) { static Stream valuesProvider() { return Stream.of( arguments("file", Stream.of("file", "file.yaml", "file.yml")), - arguments("folder/file", Stream.of("folder/file", "folder/file.yaml", "folder/file.yml")) - ); + arguments("folder/file", Stream.of("folder/file", "folder/file.yaml", "folder/file.yml"))); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProviderTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProviderTest.java index 8294c0031..8c22d0b16 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProviderTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/file_providers/InternalFileProviderTest.java @@ -27,8 +27,8 @@ void getViews() { @Test @DisplayName("getInjectableValues should return the internal injectables") void getInjectableValues() { - final MockedConstruction mockedConstruction = mockConstruction(InjectableValues.Std.class, (mock, context) -> - when(mock.addValue("enabledFromClient", false)).thenReturn(mock)); + final MockedConstruction mockedConstruction = mockConstruction(InjectableValues.Std.class, + (mock, context) -> when(mock.addValue("enabledFromClient", false)).thenReturn(mock)); final InjectableValues actual = fileProvider.getInjectableValues(); diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/js/JsTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/js/JsTest.java index dc83f40f5..55c4bb8c1 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/js/JsTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/js/JsTest.java @@ -291,8 +291,7 @@ void testGetSize() { List dimensions = Arrays.asList(200, 100); when(webDriver.executeScript( "var rectangle = arguments[0].getBoundingClientRect(); return [rectangle.width, rectangle.height];", - webElement - )).thenReturn(dimensions); + webElement)).thenReturn(dimensions); Dimension result = js.getSize(webElement); @@ -307,8 +306,7 @@ void testGetRect() { List rectangleValues = Arrays.asList(50, 60, 200, 100); when(webDriver.executeScript( "var rectangle = arguments[0].getBoundingClientRect(); return [rectangle.x, rectangle.y, rectangle.width, rectangle.height];", - webElement - )).thenReturn(rectangleValues); + webElement)).thenReturn(rectangleValues); Rectangle result = js.getRect(webElement); @@ -325,8 +323,7 @@ void testGetLocation() { List pointValues = Arrays.asList(50, 60); when(webDriver.executeScript( "var rectangle = arguments[0].getBoundingClientRect(); return [rectangle.x, rectangle.y];", - webElement - )).thenReturn(pointValues); + webElement)).thenReturn(pointValues); Point result = js.getLocation(webElement); diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/testbook/TestBookUnitTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/testbook/TestBookUnitTest.java index 64037a64b..512a6ca69 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/testbook/TestBookUnitTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/testbook/TestBookUnitTest.java @@ -179,10 +179,11 @@ void updateGroupedTests(final String className, final Map valuesProvider() { return Stream.of( arguments("className", new HashMap<>()), - arguments("className", new HashMap<>() {{ - put("className", new HashSet<>()); - }}) - ); + arguments("className", new HashMap<>() { + { + put("className", new HashSet<>()); + } + })); } @Test diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/NameComparatorTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/NameComparatorTest.java index 50fb5b752..22da7299a 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/NameComparatorTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/NameComparatorTest.java @@ -38,7 +38,6 @@ static Stream valuesProvider() { return Stream.of( arguments("aaa", "bbb", -1), arguments("bbb", "aaa", 1), - arguments("aaa", "aaa", 0) - ); + arguments("aaa", "aaa", 0)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparatorTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparatorTest.java index 7b7c638fd..e6cdf9a7f 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparatorTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/tests_comparators/StatusComparatorTest.java @@ -42,7 +42,6 @@ static Stream valuesProvider() { return Stream.of( arguments(PASS, FAIL, -1), arguments(FAIL, PASS, 1), - arguments(PASS, PASS, 0) - ); + arguments(PASS, PASS, 0)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/video/VideoTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/video/VideoTest.java index 509a9d3d6..187e317b9 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/video/VideoTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/video/VideoTest.java @@ -39,8 +39,7 @@ void isDisabled(final List frames, final boolean expected) { static Stream valuesProvider() { return Stream.of( arguments(List.of(AUTO_BEFORE), false), - arguments(List.of(), true) - ); + arguments(List.of(), true)); } @DisplayName("shouldRecord should check if the provided frame name should be recorded") @@ -56,8 +55,7 @@ static Stream shouldRecordValuesProvider() { arguments(List.of(AUTO_BEFORE), true), arguments(List.of(MANUAL, AUTO_BEFORE), true), arguments(List.of(MANUAL), false), - arguments(List.of(), false) - ); + arguments(List.of(), false)); } @DisplayName("getAndIncrementFrameNumberFor should return the current frame number and increment it if the provided frame should be recorded, -1 otherwise") @@ -80,7 +78,6 @@ static Stream getAndIncrementFrameNumberForValuesProvider() { arguments(List.of(AUTO_BEFORE), 123, 1, 124), arguments(List.of(MANUAL, AUTO_BEFORE), 123, 1, 124), arguments(List.of(MANUAL), -1, 0, 123), - arguments(List.of(), -1, 0, 123) - ); + arguments(List.of(), -1, 0, 123)); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepBuilderConsumerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepBuilderConsumerTest.java index fe8874530..2aadb9c33 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepBuilderConsumerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepBuilderConsumerTest.java @@ -101,7 +101,6 @@ void accept(final int millisPart, final String paddedMillisPart) { static Stream valuesProvider() { return Stream.of( arguments(789, "789"), - arguments(7, "700") - ); + arguments(7, "700")); } } diff --git a/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepsConsumerTest.java b/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepsConsumerTest.java index 925a8a5b2..b92548cca 100644 --- a/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepsConsumerTest.java +++ b/spectrum/src/test/java/io/github/giulong/spectrum/utils/web_driver_events/TestStepsConsumerTest.java @@ -98,8 +98,7 @@ static Stream valuesProvider() { arguments(SUCCESSFUL, true), arguments(FAILED, true), arguments(ABORTED, true), - arguments(DISABLED, false) - ); + arguments(DISABLED, false)); } @Test diff --git a/spotless.xml b/spotless.xml new file mode 100644 index 000000000..6561179be --- /dev/null +++ b/spotless.xml @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/github-mark.png b/src/main/resources/images/github-mark.png deleted file mode 100644 index 75ba73a7d..000000000 Binary files a/src/main/resources/images/github-mark.png and /dev/null differ diff --git a/src/main/resources/images/gmail-icon.png b/src/main/resources/images/gmail-icon.png deleted file mode 100644 index f91aa3c6f..000000000 Binary files a/src/main/resources/images/gmail-icon.png and /dev/null differ diff --git a/src/main/resources/images/spectrum-logo.png b/src/main/resources/images/spectrum-logo.png deleted file mode 100644 index 6453a549f..000000000 Binary files a/src/main/resources/images/spectrum-logo.png and /dev/null differ diff --git a/verify-appium/pom.xml b/verify-appium/pom.xml index 350ff8e60..8c908bb03 100644 --- a/verify-appium/pom.xml +++ b/verify-appium/pom.xml @@ -43,6 +43,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/verify-browsers/pom.xml b/verify-browsers/pom.xml index dac04123b..6a82a5351 100644 --- a/verify-browsers/pom.xml +++ b/verify-browsers/pom.xml @@ -43,6 +43,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java b/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java index 3ea615c62..aa607b4ca 100644 --- a/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java +++ b/verify-browsers/src/test/java/io/github/giulong/spectrum/verify_browsers/unit/ItVerifierTest.java @@ -46,19 +46,19 @@ public void logFile() throws FileNotFoundException { // we indirectly check that the log consumer accepted the event with a regex in the primaryId assertTrue(logFile.contains(""" - Class Name: --- - Test Name : --- - Reason : custom-event - Result : --- - Tags : ---""")); + Class Name: --- + Test Name : --- + Reason : custom-event + Result : --- + Tags : ---""")); // we indirectly check that the log consumer accepted the event with a regex in the reason assertTrue(logFile.contains(""" - Class Name: --- - Test Name : --- - Reason : secondReason - Result : --- - Tags : ---""")); + Class Name: --- + Test Name : --- + Reason : secondReason + Result : --- + Tags : ---""")); // we check values sent to @Secured web elements are masked assertTrue(logFile.contains("Sending keys [***] to id: password")); diff --git a/verify-commons/pom.xml b/verify-commons/pom.xml index 099c90011..d362bfa9f 100644 --- a/verify-commons/pom.xml +++ b/verify-commons/pom.xml @@ -42,6 +42,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java b/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java index 4aaa2c4f8..378e5fe29 100644 --- a/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java +++ b/verify-commons/src/main/java/io/github/giulong/spectrum/verify_commons/FailsafeReportsVerifier.java @@ -71,15 +71,15 @@ public boolean verifyResultsAre(final String module, final String driver, final log .atLevel(result ? INFO : ERROR) .log(""" - \s - Results for report '{}' are: - \s - {} - {} - {} - {} - {} - """, + \s + Results for report '{}' are: + \s + {} + {} + {} + {} + {} + """, filePath, header, completedLine, diff --git a/verify-macos/pom.xml b/verify-macos/pom.xml index a0151829a..2a61bc623 100644 --- a/verify-macos/pom.xml +++ b/verify-macos/pom.xml @@ -18,11 +18,6 @@ verify-commons ${revision} - - org.hamcrest - hamcrest - test - @@ -43,6 +38,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + + com.diffplug.spotless + spotless-maven-plugin + org.apache.maven.plugins maven-surefire-plugin diff --git a/verify-windows/pom.xml b/verify-windows/pom.xml new file mode 100644 index 000000000..2b59caeaa --- /dev/null +++ b/verify-windows/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + + io.github.giulong + spectrum-aggregate + ${revision} + + + verify-windows + + + + io.github.giulong + verify-commons + ${revision} + + + + + + + org.apache.maven.plugins + maven-clean-plugin + + + org.apache.maven.plugins + maven-resources-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + com.diffplug.spotless + spotless-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + -Dfile.encoding=UTF-8 + + + + org.apache.maven.plugins + maven-failsafe-plugin + + true + + + + + diff --git a/verify-windows/src/test/java/io/github/giulong/spectrum/verify_windows/ItWindowsVerifierTest.java b/verify-windows/src/test/java/io/github/giulong/spectrum/verify_windows/ItWindowsVerifierTest.java new file mode 100644 index 000000000..850c8739a --- /dev/null +++ b/verify-windows/src/test/java/io/github/giulong/spectrum/verify_windows/ItWindowsVerifierTest.java @@ -0,0 +1,28 @@ +package io.github.giulong.spectrum.verify_windows; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.condition.OS.WINDOWS; + +import io.github.giulong.spectrum.verify_commons.FailsafeReportsVerifier; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledOnOs; + +@DisplayName("It Windows Module Verifier") +@EnabledOnOs(WINDOWS) +public class ItWindowsVerifierTest { + + private static final FailsafeReportsVerifier FAILSAFE_REPORTS_VERIFIER = FailsafeReportsVerifier.getInstance(); + + private static final int COMPLETED = 1; + private static final int ERRORS = 0; + private static final int FAILURES = 0; + private static final int SKIPPED = 0; + + @Test + @DisplayName("chrome should have run with the correct results") + public void verifyChrome() { + assertTrue(FAILSAFE_REPORTS_VERIFIER.verifyResultsAre("it-windows", "chrome", COMPLETED, ERRORS, FAILURES, SKIPPED), "CHROME"); + } +} diff --git a/verify-windows/src/test/resources/configuration.yaml b/verify-windows/src/test/resources/configuration.yaml new file mode 100644 index 000000000..104ef128a --- /dev/null +++ b/verify-windows/src/test/resources/configuration.yaml @@ -0,0 +1,6 @@ +drivers: + waits: + downloadTimeout: 5 + chrome: + args: + - --headless=new