From b5d018e47ed5d2eee2112727cfccc4720a1e6ef3 Mon Sep 17 00:00:00 2001 From: JoeSchr Date: Mon, 23 Mar 2020 08:14:31 +0100 Subject: [PATCH] Improves not-valid code warnings (#2649) * Improves not-valid code warnings Makes them more explicit and also puts some of them into the code sample (the only thing many people actually read) * make warning even more obvious + fix weird formatting? Co-authored-by: Jennifer Shehane --- source/guides/core-concepts/conditional-testing.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/guides/core-concepts/conditional-testing.md b/source/guides/core-concepts/conditional-testing.md index 2e580f2674..73975ba60a 100644 --- a/source/guides/core-concepts/conditional-testing.md +++ b/source/guides/core-concepts/conditional-testing.md @@ -387,9 +387,13 @@ However, this is really the same question as asking to do conditional testing, b For instance you may want to do this: -**The following code is not valid, you cannot add error handling to Cypress commands. The code is just for demonstration purposes.** +{% note danger %} +{% fa fa-exclamation-triangle red %} The following code is not valid. +{% endnote %} ```js +//! You cannot add error handling to Cypress commands +//! This code is just for demonstration purposes cy.get('button').contains('hello') .catch((err) => { // oh no the button wasn't found @@ -408,10 +412,13 @@ Enabling this would mean that for every single command, it would recover from er Let's reimagine our "Welcome Wizard" example from before. -**The following code is not valid, you cannot add error handling to Cypress commands. The code is just for demonstration purposes.** +{% note danger %} +{% fa fa-exclamation-triangle red %} The following code is not valid. +{% endnote %} ```js -// great error recovery code +//! You cannot add error handling to Cypress commands. +//! This code is just for demonstration purposes function keepCalmAndCarryOn () { cy.get(...).should(...).click() }