Skip to content

Commit

Permalink
feat: Allow setting GK as parked
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed Jul 18, 2024
1 parent 6297567 commit 65fa55c
Show file tree
Hide file tree
Showing 31 changed files with 918 additions and 106 deletions.
30 changes: 15 additions & 15 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
// doc position_after_functions_and_oop_constructs: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/4e91f495a7ece1f2566feba2f07cc5824d68ec0b/README.rst
$config = new PhpCsFixer\Config();
$config->setRules([
'@Symfony' => true,
'no_closing_tag' => true,
'yoda_style' => false,
'curly_braces_position' => [
'allow_single_line_anonymous_functions' => true,
'functions_opening_brace' => 'same_line',
'anonymous_functions_opening_brace' => 'same_line',
'classes_opening_brace' => 'same_line',
'anonymous_classes_opening_brace' => 'same_line',
],
// 'statement_indentation' => false,
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => true,
],
])
'@Symfony' => true,
'no_closing_tag' => true,
'yoda_style' => false,
'curly_braces_position' => [
'allow_single_line_anonymous_functions' => true,
'functions_opening_brace' => 'same_line',
'anonymous_functions_opening_brace' => 'same_line',
'classes_opening_brace' => 'same_line',
'anonymous_classes_opening_brace' => 'same_line',
],
// 'statement_indentation' => false,
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => true,
],
])
->setFinder($finder);

return $config;
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
- id: php-lint-all
- id: php-cs-fixer
files: \.(php)$
args: [ "--config=.php-cs-fixer.php", "-q" ]
args: [ "--config=.php-cs-fixer.php", "-q", "--diff" ]

- repo: https://github.com/IamTheFij/docker-pre-commit.git
rev: v2.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Ensure initial state: everything is shown
Element Should Not Be Visible ${MOVE_LOG_TYPE_NOT_COLLECTIBLE_INFO}


Some logtype should be hidden for non-admin and non-holder
Some logtype should be hidden for non-owner and non-holder
Sign In ${USER_1.name} Fast

# Change collectible flag
Expand Down Expand Up @@ -87,7 +87,7 @@ Some logtype should be hidden for owner
Go To Move
Input Text ${MOVE_TRACKING_CODE_INPUT} ${GEOKRETY_1.tc}
Click Button And Check Panel Validation Has Success ${MOVE_TRACKING_CODE_NEXT_BUTTON} ${MOVE_TRACKING_CODE_PANEL} ${MOVE_LOG_TYPE_PANEL}
Element Should Be Enabled ${MOVE_LOG_TYPE_DROPPED_RADIO}
Element Should Be Disabled ${MOVE_LOG_TYPE_DROPPED_RADIO}
Element Should Be Disabled ${MOVE_LOG_TYPE_GRABBED_RADIO}
Element Should Be Disabled ${MOVE_LOG_TYPE_MEET_RADIO}
Element Should Be Enabled ${MOVE_LOG_TYPE_DIPPED_RADIO}
Expand Down
92 changes: 92 additions & 0 deletions tests-qa/acceptance/030_Geokrety/050_Parked/010_ManageFlag.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
*** Settings ***
Library RequestsLibrary
Resource ../../ressources/Authentication.robot
Resource ../../ressources/vars/Urls.robot
Resource ../../ressources/Moves.robot
Variables ../../ressources/vars/users.yml
Variables ../../ressources/vars/geokrety.yml
Variables ../../ressources/vars/moves.yml
Test Setup Test Setup

*** Variables ***

*** Test Cases ***

Parked Happy Path
Sign In ${USER_1.name} Fast

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Checkbox Should Not Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}
Select Checkbox ${GEOKRET_CREATE_PARKED_CHECKBOX}
Element Attribute Should Be ${GEOKRET_CREATE_COLLECTIBLE_CHECKBOX} disabled true
Element Attribute Should Be ${GEOKRET_CREATE_COLLECTIBLE_CHECKBOX} checked None
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Element Should Contain ${GEOKRET_DETAILS_PARKED} Parked
Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE}
${date1} = Browser.Get Element Attribute ${GEOKRET_DETAILS_PARKED} title

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Checkbox Should Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}
Unselect Checkbox ${GEOKRET_CREATE_PARKED_CHECKBOX}
Element Attribute Should Be ${GEOKRET_CREATE_COLLECTIBLE_CHECKBOX} disabled None
Element Attribute Should Be ${GEOKRET_CREATE_COLLECTIBLE_CHECKBOX} checked true
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE}
Page Should Not Contain Element ${GEOKRET_DETAILS_PARKED}
Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE}

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Checkbox Should Not Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}
Select Checkbox ${GEOKRET_CREATE_PARKED_CHECKBOX}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Element Should Contain ${GEOKRET_DETAILS_PARKED} Parked
Page Should Not Contain Element ${GEOKRET_DETAILS_COLLECTIBLE}
${date2} = Browser.Get Element Attribute ${GEOKRET_DETAILS_PARKED} title

Should Not Be Equal As Strings ${date1} ${date2}

Changing other value should not change the parked date
Sign In ${USER_1.name} Fast

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Checkbox Should Not Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}
Input Text ${GEOKRET_CREATE_NAME_INPUT} GKNewName
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Checkbox Should Not Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}

Checkbox Should Not Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}
Select Checkbox ${GEOKRET_CREATE_PARKED_CHECKBOX}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Input Text ${GEOKRET_CREATE_NAME_INPUT} GKNewName2
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}

Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Checkbox Should Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}


Can be enabled only if owner is the holder
Sign In ${USER_1.name} Fast

Post Move Fast &{MOVE_22}
Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Page Should Not Contain Element ${GEOKRET_CREATE_PARKED_CHECKBOX}

Post Move Fast &{MOVE_2}
Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Page Should Contain Element ${GEOKRET_CREATE_PARKED_CHECKBOX}


*** Keywords ***

Test Setup
Clear Database And Seed ${2} users
Seed ${1} geokrety owned by ${1}
71 changes: 71 additions & 0 deletions tests-qa/acceptance/030_Geokrety/050_Parked/020_Moves.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
*** Settings ***
Library RequestsLibrary
Resource ../../ressources/Authentication.robot
Resource ../../ressources/vars/Urls.robot
Resource ../../ressources/Moves.robot
Variables ../../ressources/vars/users.yml
Variables ../../ressources/vars/geokrety.yml
Variables ../../ressources/vars/moves.yml
Test Setup Test Setup

*** Variables ***

*** Test Cases ***

Some logtype should be hidden for non-owner
Sign In ${USER_1.name} Fast

# Change collectible flag
Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Select Checkbox ${GEOKRET_CREATE_PARKED_CHECKBOX}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Element Should Contain ${GEOKRET_DETAILS_PARKED} Parked

# Only a limited number of move type are shown
Sign In ${USER_2.name} Fast
Go To Move
Input Text ${MOVE_TRACKING_CODE_INPUT} ${GEOKRETY_1.tc}
Click Button And Check Panel Validation Has Success ${MOVE_TRACKING_CODE_NEXT_BUTTON} ${MOVE_TRACKING_CODE_PANEL} ${MOVE_LOG_TYPE_PANEL}
Element Should Be Disabled ${MOVE_LOG_TYPE_DROPPED_RADIO}
Element Should Be Disabled ${MOVE_LOG_TYPE_GRABBED_RADIO}
Element Should Be Enabled ${MOVE_LOG_TYPE_MEET_RADIO}
Element Should Be Disabled ${MOVE_LOG_TYPE_DIPPED_RADIO}
Element Should Be Enabled ${MOVE_LOG_TYPE_COMMENT_RADIO}
Element Should Be Visible ${MOVE_LOG_TYPE_NOT_COLLECTIBLE_INFO}

Some logtype should be hidden for owner
Sign In ${USER_1.name} Fast

# Change parked flag
Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Select Checkbox ${GEOKRET_CREATE_PARKED_CHECKBOX}
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}
Element Should Contain ${GEOKRET_DETAILS_PARKED} Parked

# Only a limited number of move type are shown
Sign In ${USER_1.name} Fast
Go To Move
Input Text ${MOVE_TRACKING_CODE_INPUT} ${GEOKRETY_1.tc}
Click Button And Check Panel Validation Has Success ${MOVE_TRACKING_CODE_NEXT_BUTTON} ${MOVE_TRACKING_CODE_PANEL} ${MOVE_LOG_TYPE_PANEL}
Element Should Be Disabled ${MOVE_LOG_TYPE_DROPPED_RADIO}
Element Should Be Disabled ${MOVE_LOG_TYPE_GRABBED_RADIO}
Element Should Be Disabled ${MOVE_LOG_TYPE_MEET_RADIO}
Element Should Be Enabled ${MOVE_LOG_TYPE_DIPPED_RADIO}
Element Should Be Enabled ${MOVE_LOG_TYPE_COMMENT_RADIO}
Element Should Be Visible ${MOVE_LOG_TYPE_NOT_COLLECTIBLE_INFO}


*** Keywords ***

Test Setup
Clear Database And Seed ${3} users
Seed ${1} geokrety owned by ${1}

Click Button And Check Panel Validation Has Success
[Arguments] ${button} ${current_panel} ${next_panel}
Panel validation has success ${current_panel}
Click Button ${button}
Panel Is Collapsed ${current_panel}
Panel Is Open ${next_panel}
69 changes: 69 additions & 0 deletions tests-qa/acceptance/030_Geokrety/050_Parked/030_export.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
*** Settings ***
Library RequestsLibrary
Library XML
Library DateTime
Resource ../../ressources/Authentication.robot
Resource ../../ressources/vars/Urls.robot
Variables ../../ressources/vars/users.yml
Variables ../../ressources/vars/geokrety.yml
Variables ../../ressources/vars/moves.yml
Test Setup Test Setup

*** Variables ***

*** Test Cases ***

Validate XML - structure
# Check first GK
${date_2_days_old} = Get Current Date increment=-2d result_format=%Y%m%d%H%M%d

Create Session geokrety ${GK_URL}
${xml} = GET On Session geokrety url=/export.php?modifiedsince=${date_2_days_old}
Status Should Be 200 ${xml}

${root} = Parse XML ${xml.content}
Should Be Equal ${root.tag} gkxml

${first_gk} = Get Element ${root} geokret
Should Be Equal ${first_gk.attrib['id']} 1
XML.Element Attribute Should Be ${first_gk} id 1

${name} = Get Element ${first_gk} name
XML.Element Text Should Be ${name} geokrety01
${collectible} = Get Element ${first_gk} collectible
XML.Element Text Should Be ${collectible} true
${parked} = Get Element ${first_gk} parked
XML.Element Text Should Be ${parked} false

# Park GK 1
Sign In ${USER_1.name} Fast
Go To Url ${PAGE_GEOKRETY_EDIT_URL}
Checkbox Should Not Be Selected ${GEOKRET_CREATE_PARKED_CHECKBOX}
Select Checkbox ${GEOKRET_CREATE_PARKED_CHECKBOX}
Input Text ${GEOKRET_CREATE_NAME_INPUT} GKNewName
Click Button ${GEOKRET_CREATE_CREATE_BUTTON}
Location Should Be ${PAGE_GEOKRETY_1_DETAILS_URL}


${xml} = GET On Session geokrety url=/export.php?modifiedsince=${date_2_days_old}
Status Should Be 200 ${xml}

${root} = Parse XML ${xml.content}
Should Be Equal ${root.tag} gkxml

${first_gk} = Get Element ${root} geokret
Should Be Equal ${first_gk.attrib['id']} 1
XML.Element Attribute Should Be ${first_gk} id 1

${name} = Get Element ${first_gk} name
XML.Element Text Should Be ${name} GKNewName
${collectible} = Get Element ${first_gk} collectible
XML.Element Text Should Be ${collectible} false
${parked} = Get Element ${first_gk} parked
XML.Element Text Should Be ${parked} true

*** Keywords ***

Test Setup
Clear Database And Seed ${3} users
Seed ${1} geokrety owned by ${1}
Loading

0 comments on commit 65fa55c

Please sign in to comment.