Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test uploading multiple fonts
  • Loading branch information
mikachan committed Mar 27, 2024
commit 14c419cb998b517b625432daf4f73476c57cac0b
Binary file added test/e2e/assets/Exo2-SemiBoldItalic.woff2
Binary file not shown.
24 changes: 14 additions & 10 deletions test/e2e/specs/site-editor/font-library.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,31 @@ test.describe( 'Font Library', () => {
} )
.click();

// Delete test font (Exo 2) if it exists
// Delete test font family (Exo 2) if it exists
await expect(
page.getByRole( 'tab', { name: 'Upload' } )
).toBeVisible( { timeout: 80000 } );

if (
await page
.getByRole( 'button', { name: 'Exo 2' } )
.isVisible( { timeout: 40000 } )
await page.getByRole( 'button', { name: 'Exo 2' } ).isVisible()
) {
await page.getByRole( 'button', { name: 'Exo 2' } ).click();
await page.getByRole( 'button', { name: 'Delete' } ).click();
await page.getByRole( 'button', { name: 'Delete' } ).click();
await page.getByRole( 'tab', { name: 'Library' } ).click();
}

// Upload a local font
await page
.getByRole( 'tab', { name: 'Upload' } )
.click( { timeout: 40000 } );
// Upload local fonts
await page.getByRole( 'tab', { name: 'Upload' } ).click();
const fileChooserPromise = page.waitForEvent( 'filechooser' );
await page.getByRole( 'button', { name: 'Upload Font' } ).click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles( './test/e2e/assets/Exo2-Regular.woff' );
await fileChooser.setFiles( [
'./test/e2e/assets/Exo2-Regular.woff',
'./test/e2e/assets/Exo2-SemiBoldItalic.woff2',
] );

// Check font was installed
// Check fonts were installed
await expect(
page
.getByLabel( 'Upload' )
Expand Down