-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Cypress CI failures caused by font differences
+ DRY out a reusable command for this logic - it's happened often enough now that we need it
- Loading branch information
Showing
6 changed files
with
45 additions
and
24 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
// Export only the type to not confuse code-completion tools | ||
// export type realMountCommand = typeof realMountCommand; | ||
|
||
/** | ||
* CI doesn't have access to the Inter font, so we need to manually include it | ||
* for certain calculations that change based on the font | ||
*/ | ||
const loadFontCommand = () => { | ||
const linkElem = document.createElement('link'); | ||
linkElem.setAttribute('rel', 'stylesheet'); | ||
linkElem.setAttribute( | ||
'href', | ||
'https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap' | ||
); | ||
document.head.appendChild(linkElem); | ||
cy.wait(1000); // Wait a second to give the font time to load/swap in | ||
}; | ||
|
||
// Export only the type to not confuse code-completion tools | ||
export type loadFontCommand = typeof loadFontCommand; | ||
|
||
Cypress.Commands.add('loadFont', loadFontCommand); |
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
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