Skip to content

Commit 52e9261

Browse files
committed
removed basicHtml & added plainText support
1 parent 8c5e19f commit 52e9261

File tree

1 file changed

+8
-35
lines changed

1 file changed

+8
-35
lines changed

src/scripts/show_report.sh

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ REPORT_STATUS_NOT_AVAILABLE="NOT_AVAILABLE"
77
REPORT_STATUS_TEST_AVAILABLE="TEST_AVAILABLE"
88
REPORT_STATUS_IN_PROGRESS="IN_PROGRESS"
99
REQUESTING_CI="circle-ci"
10-
REPORT_FORMAT="[\"basicHtml\", \"richHtml\"]" # need to verify to add plainText as well
10+
REPORT_FORMAT="[\"plainText\", \"richHtml\"]"
1111

1212
# Error scenario mappings
1313
declare -A ERROR_SCENARIOS=(
@@ -22,26 +22,6 @@ if [[ -z "$BROWSERSTACK_BUILD_NAME" ]]; then
2222
exit 0
2323
fi
2424

25-
# Function to install html2text
26-
install_html2text() {
27-
echo "Checking and installing html2text if not installed..."
28-
if ! command -v html2text &> /dev/null; then
29-
echo "html2text not found. Installing..."
30-
if command -v apt-get &> /dev/null; then
31-
sudo apt-get update && sudo apt-get install -y html2text
32-
elif command -v yum &> /dev/null; then
33-
sudo yum install -y html2text
34-
else
35-
echo "Package manager not supported. Please install html2text manually."
36-
exit 0
37-
fi
38-
else
39-
echo "html2text is already installed."
40-
fi
41-
}
42-
43-
install_html2text
44-
4525
# Function to make API requests
4626
make_api_request() {
4727
local request_type=$1
@@ -84,7 +64,7 @@ extract_report_data() {
8464
local response=$1
8565
rich_html_response=$(echo "$response" | jq -r '.report.richHtml // empty')
8666
rich_css_response=$(echo "$response" | jq -r '.report.richCss // empty')
87-
basic_html_response=$(echo "$response" | jq -r '.report.basicHtml // empty')
67+
plain_text_response=$(echo "$response" | jq -r '.report.plainText // empty')
8868
}
8969

9070
# Function to check report status
@@ -173,20 +153,13 @@ $rich_html_response
173153
</html>" > browserstack/cadreport.html
174154
echo "Rich html report saved as browserstack/cadreport.html. To view the report, open artifacts tab & click on cadreport.html"
175155

176-
# Generate basic text report
177-
if [[ -n "$basic_html_response" ]]; then
178-
# Wrap basic_html_response with DOCTYPE html and body tags
179-
basic_html_response="<!DOCTYPE html><html>$basic_html_response/html>"
180-
181-
if command -v html2text &> /dev/null; then
182-
basic_text_report=$(echo "$basic_html_response" | html2text)
183-
echo "Basic report (text format):"
184-
echo "$basic_text_report"
185-
else
186-
echo "html2text not installed. Skipping text report generation."
187-
fi
156+
# Generate plain text report
157+
if [[ -n "$plain_text_response" ]]; then
158+
echo ""
159+
echo "Browserstack textual report"
160+
echo "$plain_text_response"
188161
else
189-
echo "Basic HTML response is empty."
162+
echo "Plain text response is empty."
190163
fi
191164
elif [[ "$REPORT_STATUS" == "$REPORT_STATUS_NOT_AVAILABLE" ]]; then
192165
error_reason=$(echo "$RESPONSE" | jq -r '.body.errorReason // empty')

0 commit comments

Comments
 (0)