-
Notifications
You must be signed in to change notification settings - Fork 4
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: Sync attachments to assets directory #254
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
08a24cb
feat: Sync attachments to assets directory
tianfeng92 8b2b102
refine
tianfeng92 3f83a02
rename env vars
tianfeng92 2d25e98
bump reporter
tianfeng92 1c43ad3
global env vars actually are applied to suites
tianfeng92 76f3e80
works?
tianfeng92 656ecdf
null?
tianfeng92 9a4b0c2
at least this works
tianfeng92 5406700
refine
tianfeng92 b04d3cf
refine
tianfeng92 97a3041
Update src/playwright-runner.ts
tianfeng92 e5dc69a
relocate directory setting
tianfeng92 470c520
fix type
tianfeng92 52768dd
Merge branch 'main' into DEVX-2834
tianfeng92 ad8c2d7
do not use empty string
tianfeng92 0a93d86
skip null or undefined when passing args
tianfeng92 7e50233
add args check condition back
tianfeng92 10982f3
make check clear
tianfeng92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
); | ||
return; | ||
} | ||
let result: any = convert.xml2js(xmlData, { compact: true }); | ||
if (!result.testsuites || !result.testsuites.testsuite) { | ||
console.warn('JUnit file generation skipped: no test suites detected.'); | ||
return; | ||
|
@@ -63,7 +63,7 @@ | |
let totalSkipped = 0; | ||
let totalTime = 0; | ||
for (let i = 0; i < result.testsuites.testsuite.length; i++) { | ||
const testsuite = result.testsuites.testsuite[i] as any; | ||
if (testsuite._attributes) { | ||
totalTests += +testsuite._attributes.tests || 0; | ||
totalFailures += +testsuite._attributes.failures || 0; | ||
|
@@ -175,7 +175,15 @@ | |
runCfg.sauce = {}; | ||
} | ||
runCfg.sauce.region = runCfg.sauce.region || 'us-west-1'; | ||
runCfg.playwrightOutputFolder = path.join(runCfg.assetsDir, 'test-results'); | ||
runCfg.playwrightOutputFolder = | ||
suite.env?.SAUCE_SYNC_WEB_ASSETS?.toLowerCase() === 'true' | ||
? undefined | ||
: path.join(runCfg.assetsDir, 'test-results'); | ||
|
||
runCfg.webAssetsDir = | ||
suite.env?.SAUCE_SYNC_WEB_ASSETS?.toLowerCase() === 'true' | ||
? runCfg.assetsDir | ||
: ''; | ||
|
||
return runCfg; | ||
} | ||
|
@@ -200,7 +208,7 @@ | |
async function run(nodeBin: string, runCfgPath: string, suiteName: string) { | ||
const runCfg = await getCfg(runCfgPath, suiteName); | ||
|
||
const packageInfo = require(path.join(__dirname, '..', 'package.json')); | ||
console.log(`Sauce Playwright Runner ${packageInfo.version}`); | ||
console.log( | ||
`Running Playwright ${packageInfo.dependencies?.playwright || ''}`, | ||
|
@@ -303,7 +311,12 @@ | |
// eslint-disable-next-line prefer-const | ||
for (let [key, value] of Object.entries(args)) { | ||
key = utils.toHyphenated(key); | ||
if (excludeParams.includes(key.toLowerCase()) || value === false) { | ||
if ( | ||
excludeParams.includes(key.toLowerCase()) || | ||
value === false || | ||
value === undefined || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? Because later it's going to stringify
|
||
value === null | ||
) { | ||
continue; | ||
} | ||
procArgs.push(`--${key}`); | ||
|
@@ -332,6 +345,7 @@ | |
PLAYWRIGHT_JUNIT_OUTPUT_NAME: runCfg.junitFile, | ||
SAUCE_REPORT_OUTPUT_NAME: runCfg.sauceReportFile, | ||
FORCE_COLOR: '0', | ||
SAUCE_WEB_ASSETS_DIR: runCfg.webAssetsDir, | ||
}; | ||
|
||
utils.setEnvironmentVariables(env); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this will only work if and only if the customer has this env var defined as the string
"true"
? The schema forenv
is a simple object so we won't be able to provide any in-editor context/autocomplete for this value.Do we want to relax this check and just check for a non empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think set it to
true
is more accurate and doesn't cause further confusion like: what should I set? Let me try1
,yes
,enabled
and etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your opinion @alexplischke ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not suggesting the value should only be
1
oryes
orenabled
. But let's say my configuration isDo we really want to ignore it just because its not set to exactly
true
? (Not a rhetorical question, honestly wondering).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then the customer might want to try with
disabled
to disable it, which can't work as expected.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course. So what would be the least surprising behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't feel that strongly one way or the other. If you think enabling if and only if set to
true
is better, let's go with that. We're gonna eventually transition to enabling it by default so this check is gonna be removed soon anyways.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I think we should set the strict rules with documentation. No vague settings. But of course, this will be removed in the future so I think it's good to leave it like this 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't feel strongly either way as well. If you want to go the extra mile, you could do a check for
1
,true
,enable(d)
andyes
😅 Externally we should only document the value "true".