Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: More E2e tests, testTags, fixes (pt 3) #60

Merged
merged 10 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .maestro/work-tests/new-case-custom-address.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: New Case View
appId: ${MAESTRO_APP_ID}
tags:
- development
- staging
- production
- pull-request
onFlowStart:
- runFlow: ../auth-tests/login.yaml
---
# wait for incidents to load
- waitForAnimationToEnd:
timeout: 5000
# start searching after loading spinner is invisible
- assertNotVisible:
id: workIncidentsLoadingIndicator
- tapOn:
id: "workNewCaseFab"
- assertVisible: ".*new case.*"

# Check address problems to show custom address fields
- scrollUntilVisible:
element:
id: locationAddressProblemsCheckbox
- tapOn:
id: locationAddressProblemsCheckbox

- evalScript: |
"${
output.result = {
testTags: [
'locationStreetAddressTextField',
'locationPostalCodeTextField',
'locationCountyTextField',
'locationCityTextField',
'locationStateTextField',
'locationCrossStreetTextField',
],
}
}"

# Custom fields should be visible when address problems is checked
- evalScript: ${output.i = 0}
- repeat:
while:
'true': ${output.i < output.result.testTags.length}
commands:
- scrollUntilVisible:
element:
id: ${output.result.testTags[output.i]}
direction: DOWN
- assertVisible:
id: ${output.result.testTags[output.i]}
- evalScript: ${output.i = output.i + 1}

# Uncheck address problems to hide custom address fields
- scrollUntilVisible:
element:
id: locationAddressProblemsCheckbox
- tapOn:
id: locationAddressProblemsCheckbox

# Custom fields should be visible when address problems is checked
- evalScript: ${output.i = 0}
- repeat:
while:
'true': ${output.i < output.result.testTags.length}
commands:
- assertNotVisible:
id: ${output.result.testTags[output.i]}
- evalScript: ${output.i = output.i + 1}
156 changes: 74 additions & 82 deletions .maestro/work-tests/new-case-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,102 +8,94 @@ tags:
onFlowStart:
- runFlow: ../auth-tests/login.yaml
---
- tapOn: ".*new case.*"
# wait for incidents to load
- waitForAnimationToEnd:
timeout: 5000
# start searching after loading spinner is invisible
- assertNotVisible:
id: workIncidentsLoadingIndicator
- tapOn:
id: "workNewCaseFab"
- assertVisible: ".*new case.*"
- assertVisible:
text: "back"
index: 1

# Bottom actions buttons should be visible
- assertVisible: ".*cancel.*"
- assertVisible: ".*Claim & Save.*"
- assertVisible: ".*Save.*"
- evalScript: |
"${
output.result = {
testTags: [
'caseEditCancelBtn',
'caseEditClaimAndSaveBtn',
'caseEditSaveBtn'
],
}
}"
- evalScript: ${output.i1 = 0}
- repeat:
while:
'true': ${output.i1 < output.result.testTags.length}
commands:
- assertVisible:
id: ${output.result.testTags[output.i1]}
- evalScript: ${output.i1 = output.i1 + 1}

# New case sections and required elements should be visible
- scrollUntilVisible:
element: ".*Property Information.*"
direction: DOWN
- assertVisible: ".*Property Information.*"

- scrollUntilVisible:
element: ".*Resident Name.*"
direction: DOWN
- assertVisible: ".*Resident Name.*"

- scrollUntilVisible:
element: ".*Phone.*"
direction: DOWN
- assertVisible: ".*Phone.*"

- scrollUntilVisible:
element: ".*Email.*"
direction: DOWN
- assertVisible: ".*Email.*"

- scrollUntilVisible:
element: ".*Location.*"
direction: DOWN
- assertVisible: ".*Location.*"
- evalScript: |
"${
output.result = {
testTags: [
'propertyResidentNameTextField',
'propertyPhone1TextField',
'propertyPhone2TextField',
'propertyEmailTextField',
'propertyLocationFullAddressTextField',
'propertyLocationSelectOnMapBtn',
'propertyLocationUseMyLocationBtn',
'locationCrossStreetTextField',
'locationAddressProblemsCheckbox',
'caseFlagHighPriorityCheckbox',
'caseMemberOfMyOrgCheckbox',
'propertyLabelNotesText',
'propertyAddNoteBtn',
],
}
}"
- evalScript: ${output.i2 = 0}
- repeat:
while:
'true': ${output.i2 < output.result.testTags.length}
commands:
- scrollUntilVisible:
element:
id: ${output.result.testTags[output.i2]}
direction: DOWN
- assertVisible:
id: ${output.result.testTags[output.i2]}
- evalScript: ${output.i2 = output.i2 + 1}

- scrollUntilVisible:
element: ".*Full Address.*"
direction: DOWN
- assertVisible: ".*Full Address.*"

- scrollUntilVisible:
element: ".*Google Map.*"
direction: DOWN
- assertVisible: ".*Google Map.*"

- scrollUntilVisible:
element: ".*Select on Map.*"
direction: DOWN
# Clicking cancel should close popup
- tapOn:
id: caseEditCancelBtn
- assertVisible:
text: ".*Select on Map.*"
index: 1

- scrollUntilVisible:
element: ".*Use My Location.*"
direction: DOWN
id: "navItem_Work"
- assertVisible:
text: ".*Use My Location.*"
index: 1

- scrollUntilVisible:
element: ".*Notes.*"
direction: DOWN
- assertVisible: ".*Notes.*"

- scrollUntilVisible:
element: ".*Case Details.*"
direction: DOWN
- assertVisible: ".*Case Details.*"

- scrollUntilVisible:
element: ".*Work.*"
direction: DOWN
- assertVisible: ".*Work.*"

- scrollUntilVisible:
element: ".*Volunteer Report.*"
direction: DOWN
- assertVisible: ".*Volunteer Report.*"


# Clicking cancel should close popup
- tapOn: ".*Cancel.*"
- assertVisible: "Work"
- assertVisible: "Menu"
id: "navItem_Menu"

# Reopen New case popup
- tapOn: ".*new case.*"
- tapOn:
id: "workNewCaseFab"
- assertVisible: ".*new case.*"
- assertNotVisible: "Work"
- assertNotVisible: "Menu"
- assertNotVisible:
id: "navItem_Work"
- assertNotVisible:
id: "navItem_Menu"

# Clicking back should close popup
- tapOn:
text: ".*Back.*"
text: ".*back.*"
index: 1
- assertVisible: "Work"
- assertVisible: "Menu"
- assertVisible:
id: "navItem_Work"
- assertVisible:
id: "navItem_Menu"
43 changes: 27 additions & 16 deletions .maestro/work-tests/work-view.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,32 @@ tags:
onFlowStart:
- runFlow: ../auth-tests/login.yaml
---
- tapOn: "Work"
- assertVisible: "Work"
- assertVisible: "Menu"
- assertVisible: ".*Change Incident.*"
- assertVisible: ".*Search.*"
- assertVisible: ".*Filters.*"
- assertVisible: ".*Zoom in.*"
- assertVisible: ".*Zoom out.*"
- assertVisible: ".*Change Incident.*"
- assertVisible: ".*Zoom to Interactive.*"
- assertVisible: ".*Zoom to Incident.*"
- assertVisible: ".*Search.*"
- assertVisible: ".*Filters.*"
- assertVisible: ".*My location.*"
- assertVisible: ".*New Case.*"
- assertVisible: ".*Table View.*"
- tapOn:
id: "navItem_Work"
- assertVisible:
id: "navItem_Work"
- assertVisible:
id: "navItem_Menu"

- assertVisible:
id: "workIncidentSelectorFab"
- assertVisible:
id: "workIncidentSearchBtn"
- assertVisible:
id: "workIncidentFilterBtn"
- assertVisible:
id: "workZoomInBtn"
- assertVisible:
id: "workZoomOutBtn"
- assertVisible:
id: "workZoomToInteractiveBtn"
- assertVisible:
id: "workZoomToIncidentBtn"
- assertVisible:
id: "workMyLocationFab"
- assertVisible:
id: "workNewCaseFab"
- assertVisible:
id: "workToggleTableMapViewFab"
# Show total number of cases
- assertVisible: .*(\d+)(\s)(Cases).*
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ internal fun EditExistingCaseNotesView(

CrisisCleanupFab(
onClick = onAddNote,
modifier = Modifier.constrainAs(newNoteFab) {
modifier = Modifier.testTag("editCaseAddNoteFab").constrainAs(newNoteFab) {
end.linkTo(parent.end, margin = actionEdgeSpace)
bottom.linkTo(parent.bottom, margin = actionEdgeSpace)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import com.crisiscleanup.core.designsystem.LocalAppTranslator
import com.crisiscleanup.core.designsystem.component.CrisisCleanupAlertDialog
import com.crisiscleanup.core.designsystem.component.CrisisCleanupTextArea
Expand Down Expand Up @@ -37,20 +39,23 @@ fun EditNoteDialog(
onDone = { saveNote() },
hasFocus = true,
enabled = true,
modifier = Modifier.testTag("caseAlertNoteTextAreaField")
)
},
onDismissRequest = onCancel,
dismissButton = {
CrisisCleanupTextButton(
text = translator("actions.cancel"),
onClick = onCancel
onClick = onCancel,
modifier = Modifier.testTag("caseAlertNoteDismissBtn")
)
},
confirmButton = {
CrisisCleanupTextButton(
text = translator("actions.add"),
onClick = saveNote,
enabled = !isSaving,
modifier = Modifier.testTag("caseAlertNoteSaveBtn")
)
},
)
Expand Down
Loading