-
Notifications
You must be signed in to change notification settings - Fork 1.1k
update env / task examples #6331
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
167396a
update env / task examples
jennifer-shehane 50b347c
Merge branch 'main' into update-env-task-examples
jennifer-shehane c245f58
update plugin example to be more realistic
jennifer-shehane 8f99bba
lint
jennifer-shehane ca23e2c
more updates
jennifer-shehane 77f7fc2
lint
jennifer-shehane 8ea65c6
few more updates to wording
jennifer-shehane 3e09e47
Update docs/app/continuous-integration/overview.mdx
jennifer-shehane c72bb59
Update docs/api/commands/task.mdx
jennifer-shehane 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -347,43 +347,43 @@ Placeholders let you use dynamic and sensitive values while maintaining cache ef | |
| ```typescript | ||
| describe('Campaign Management', () => { | ||
| it('creates multiple campaigns with different discount percentages', () => { | ||
| const adminPassword = Cypress.env('ADMIN_PASSWORD') | ||
|
|
||
| const campaigns = [ | ||
| { name: 'Fall Sale', discountPct: 10 }, | ||
| { name: 'Spring Sale', discountPct: 15 }, | ||
| ] | ||
|
|
||
| // This loop demonstrates the caching benefit: | ||
| // - First iteration: AI generates and caches the code | ||
| // - Subsequent iterations: Reuse cached code with different placeholder values | ||
| campaigns.forEach((campaign) => { | ||
| const campaignName = campaign.name | ||
| const campaignDiscountPct = campaign.discountPct | ||
|
|
||
| cy.prompt( | ||
| [ | ||
| `Visit ${Cypress.env('ADMIN_URL')}/admin/login`, | ||
| // Using {{adminPassword}} prevents this sensitive value from being sent to AI | ||
| 'Type {{adminPassword}} into the password field', | ||
| 'Click Sign In', | ||
| 'Open the Promotions tab', | ||
| 'Click to create a new campaign', | ||
| // Using {{campaignName}} and {{campaignDiscountPct}} | ||
| // allows for high performance caching with different values | ||
| 'Type {{campaignName}} into the name field', | ||
| 'Set discount to {{campaignDiscountPct}}% for all products', | ||
| 'Save the campaign', | ||
| 'Verify the campaign "{{campaignName}}" appears in the list', | ||
| ], | ||
| { | ||
| placeholders: { | ||
| adminPassword, | ||
| campaignName, | ||
| campaignDiscountPct, | ||
| }, | ||
| } | ||
| ) | ||
| cy.task('getSecret', 'ADMIN_PASSWORD').then((adminPassword) => { | ||
| const campaigns = [ | ||
| { name: 'Fall Sale', discountPct: 10 }, | ||
| { name: 'Spring Sale', discountPct: 15 }, | ||
| ] | ||
|
|
||
| // This loop demonstrates the caching benefit: | ||
| // - First iteration: AI generates and caches the code | ||
| // - Subsequent iterations: Reuse cached code with different placeholder values | ||
| campaigns.forEach((campaign) => { | ||
| const campaignName = campaign.name | ||
| const campaignDiscountPct = campaign.discountPct | ||
|
|
||
| cy.prompt( | ||
| [ | ||
| `Visit ${Cypress.env('ADMIN_URL')}/admin/login`, | ||
| // Using {{adminPassword}} prevents this sensitive value from being sent to AI | ||
| 'Type {{adminPassword}} into the password field', | ||
| 'Click Sign In', | ||
| 'Open the Promotions tab', | ||
| 'Click to create a new campaign', | ||
| // Using {{campaignName}} and {{campaignDiscountPct}} | ||
| // allows for high performance caching with different values | ||
| 'Type {{campaignName}} into the name field', | ||
| 'Set discount to {{campaignDiscountPct}}% for all products', | ||
| 'Save the campaign', | ||
| 'Verify the campaign "{{campaignName}}" appears in the list', | ||
| ], | ||
| { | ||
| placeholders: { | ||
| adminPassword, | ||
| campaignName, | ||
| campaignDiscountPct, | ||
| }, | ||
| } | ||
| ) | ||
| }) | ||
| }) | ||
| }) | ||
| }) | ||
|
|
@@ -567,7 +567,7 @@ describe('Feature: User Registration', () => { | |
| ], | ||
| { | ||
| placeholders: { | ||
| password: Cypress.env('PASSWORD'), | ||
| password: 'PASSWORD_PLACEHOLDER', // Use cy.task('getSecret', 'PASSWORD') to get the actual value | ||
| }, | ||
| } | ||
| ) | ||
|
|
@@ -687,20 +687,20 @@ The commands in the generated code may look like: | |
| ### Login flow | ||
|
|
||
| ```javascript | ||
| const password = Cypress.env('adminPassword') | ||
|
|
||
| cy.prompt( | ||
| [ | ||
| 'visit the login page', | ||
| 'type "[email protected]" in the email field', | ||
| 'type {{password}} in the password field', | ||
| 'click the login button', | ||
| 'verify we are redirected to the dashboard', | ||
| ], | ||
| { | ||
| placeholders: { password }, | ||
| } | ||
| ) | ||
| cy.task('getSecret', 'ADMIN_PASSWORD').then((password) => { | ||
| cy.prompt( | ||
| [ | ||
| 'visit the login page', | ||
| 'type "[email protected]" in the email field', | ||
| 'type {{password}} in the password field', | ||
| 'click the login button', | ||
| 'verify we are redirected to the dashboard', | ||
| ], | ||
| { | ||
| placeholders: { password }, | ||
| } | ||
| ) | ||
| }) | ||
| ``` | ||
|
|
||
| ### E-commerce checkout | ||
|
|
@@ -794,7 +794,7 @@ cy.origin('https://cloud.cypress.io/login', () => { | |
| ], | ||
| { | ||
| placeholders: { | ||
| password: Cypress.env('PASSWORD'), | ||
| password: 'PASSWORD_PLACEHOLDER', | ||
| }, | ||
| } | ||
| ) | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.