Skip to content

Commit cf540c4

Browse files
committed
chore: add check for case sensitive inputs to evaluateSessionStatus
1 parent 69f0bd5 commit cf540c4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

playwright-test/fixtures.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ const patchCaps = (name, title) => {
4545

4646
const isHash = (entity) => Boolean(entity && typeof(entity) === "object" && !Array.isArray(entity));
4747
const nestedKeyValue = (hash, keys) => keys.reduce((hash, key) => (isHash(hash) ? hash[key] : undefined), hash);
48-
const evaluateSessionsStatus = (status) => {
48+
const isUndefined = val => (val === undefined || val === null || val === '');
49+
const evaluateSessionStatus = (status) => {
50+
if (!isUndefined(status)) {
51+
status = status.toLowerCase();
52+
}
4953
if (status === "passed") {
5054
return "passed";
51-
} else if (status === "failed" || status === "timedOut") {
55+
} else if (status === "failed" || status === "timedout") {
5256
return "failed";
5357
} else {
5458
return "";
@@ -71,7 +75,7 @@ exports.test = base.test.extend({
7175
const testResult = {
7276
action: 'setSessionStatus',
7377
arguments: {
74-
status: evaluateSessionsStatus(testInfo.status),
78+
status: evaluateSessionStatus(testInfo.status),
7579
reason: nestedKeyValue(testInfo, ['error', 'message'])
7680
},
7781
};

0 commit comments

Comments
 (0)