Skip to content

Commit 07440b1

Browse files
committed
Merge pull request #19 from codebendercc/email-reports-fix
Modified seleniumbender script logic when sending email reports
2 parents 0e46842 + a610920 commit 07440b1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

bin/seleniumbender

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,20 @@ if [ ${NO_LOGS} -eq 1 ]; then
134134
fi
135135

136136
# email notification with attaching the produced reports
137-
DATE=$(date +"%Y-%m-%d") # Get the current date
138137
LOGS="${ROOTDIR}/logs"
139138
REPORTS="${ROOTDIR}/reports"
140139

141-
logfile=$(ls -t ${LOGS} | egrep "${DATE}.*${IDENTIFIER}" | head -1)
142-
reportfile=$(ls -t ${REPORTS} | egrep "${DATE}.*${IDENTIFIER}" | head -1)
143-
diffnum=$(ls -t ${REPORTS} | egrep "${DATE}.*${IDENTIFIER}" | head -1 | cut -d'_' -f6)
144-
changes=${diffnum:0:1}
140+
logfile=$(ls -t ${LOGS} | egrep "${IDENTIFIER}" | head -1)
141+
logfile_timestamp=${logfile:0:19}
142+
reportfile=$(ls -t ${REPORTS} | egrep "${logfile_timestamp}-${IDENTIFIER}" | head -1)
143+
if [ -z $reportfile ]; then
144+
echo "No report file found. Exiting."
145+
exit $?
146+
else
147+
echo "Found report file: ${reportfile}"
148+
fi
149+
150+
changes=$(echo ${reportfile} | rev | cut -d'_' -f1 | rev | cut -d'.' -f1)
145151

146152
(echo "Changes since the last time: ${changes}"; uuencode "${LOGS}/${logfile}" "${logfile}"; uuencode "${REPORTS}/${reportfile}" "${reportfile}") \
147153
| mail -s "Selenium Tests Report: ${IDENTIFIER} ${email_date} Changes: ${changes}" ${EMAIL}

0 commit comments

Comments
 (0)