Fix renderer type test (#1647)

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-11-21 12:48:30 +01:00 committed by GitHub
parent abceb356db
commit a96b06c95b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 16 deletions

View file

@ -31,3 +31,22 @@ export const cypressId = (
return { 'data-cypress-id': attributeContent }
}
}
/**
* Returns an object with an attribute that starts with "data-cypress-" and the given attribute name.
* It is used to check additional data during integration tests.
* This works only if the runtime is built in test mode.
*
* @param attribute The attribute name
* @param value The attribute content
* @return An object if in test mode, undefined otherwise.
*/
export const cypressAttribute = (attribute: string, value: string): Record<string, string> | undefined => {
if (!isTestMode()) {
return
}
return {
[`data-cypress-${attribute}`]: value
}
}