-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
env config settings is displayed correctly #5879
Merged
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2feca8e
env config settings is displayed correctly
andrew-codes 94283d6
Merge branch 'develop' into issue-5859-env-vars-show-undefined
andrew-codes 9ba8890
Merge branch 'develop' into issue-5859-env-vars-show-undefined
chrisbreiding 86b6b74
properly handle when env vars are not set; should show as null
andrew-codes 42dd706
Merge branch 'develop' into issue-5859-env-vars-show-undefined
flotwig 1aca6ce
include test for `undefined` env vars
andrew-codes 6dca914
Merge branch 'develop' into issue-5859-env-vars-show-undefined
andrew-codes c52c341
Merge branch 'develop' into issue-5859-env-vars-show-undefined
brian-mann ffa2aca
correctly await yielding the onConfigChanged callbacks
brian-mann 98320cf
make tests pass
andrew-codes 3690eed
make tests pass; for real
andrew-codes 5423399
improve tests
andrew-codes e1a97a1
Merge branch 'develop' into issue-5859-env-vars-show-undefined
andrew-codes 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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
const { _ } = Cypress | ||
const { each, flow, get, isString, join, map, sortBy, toPairs } = require('lodash/fp') | ||
|
||
describe('Settings', () => { | ||
beforeEach(function () { | ||
|
@@ -181,6 +182,55 @@ describe('Settings', () => { | |
expect(this.ipc.externalOpen).to.be.calledWith('https://on.cypress.io/guides/configuration') | ||
}) | ||
}) | ||
|
||
it('displays env settings', () => { | ||
cy.get('@config').then(({ resolved }) => { | ||
const getEnvKeys = flow([ | ||
get('env'), | ||
toPairs, | ||
map(([key]) => key), | ||
sortBy(get('')), | ||
]) | ||
|
||
cy.contains('.line', 'env').contains(flow([getEnvKeys, join(', ')])(resolved)) | ||
cy.contains('.line', 'env').click() | ||
const assertKeyExists = each((key) => cy.contains('.line', key)) | ||
const assertKeyValuesExists = flow([ | ||
map((key) => { | ||
return flow([ | ||
get(['env', key, 'value']), | ||
(v) => { | ||
if (isString(v)) { | ||
return `"${v}"` | ||
} | ||
|
||
return v | ||
}, | ||
])(resolved) | ||
}), | ||
each((v) => { | ||
cy.contains('.key-value-pair-value', v) | ||
}), | ||
]) | ||
|
||
const assertFromTooltipsExist = flow([ | ||
map((key) => { | ||
return [key, | ||
flow([ | ||
get(['env', key, 'from']), | ||
(from) => `.${from}`, | ||
])(resolved)] | ||
}), | ||
each(([key, fromTooltipClassName]) => { | ||
cy.contains(key).parents('.line').first().find(fromTooltipClassName) | ||
}), | ||
]) | ||
|
||
flow([getEnvKeys, assertKeyExists])(resolved) | ||
flow([getEnvKeys, assertKeyValuesExists])(resolved) | ||
flow([getEnvKeys, assertFromTooltipsExist])(resolved) | ||
}) | ||
}) | ||
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. this looks pretty gnarly, and i think you could use some cypress-isms to clean this up. come find me and i can show you some tricks |
||
}) | ||
|
||
describe('when project id panel is opened', () => { | ||
|
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
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.
these lines should go below the
const ... =
assignments because the execute async.It's generally better to group the sync/async code together