Skip to content

Commit

Permalink
Basic render and button tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Sterner committed Aug 28, 2024
1 parent 7feafb7 commit 2fa9dc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/helpers/setup-vitest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
import { afterEach } from 'vitest';
import createMatchMedia from './createMatchMedia';
import '@testing-library/jest-dom'
import '@testing-library/jest-dom';

process.env.VITE_SOLID_IDENTITY_PROVIDER = 'https://solidcommunity.net';
process.env.VITE_SUGGESTED_OIDC_OPTIONS =
Expand Down
20 changes: 14 additions & 6 deletions test/pages/Profile.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,39 @@ describe('Profile Page', () => {
it('can show and hide the share documents modal', async () => {
const user = userEvent.setup();

const shareDocumentsButton = await screen.findByRole('button', { name: 'Share Documents' }, { timeout: 2000 });
expect(shareDocumentsButton).toHaveAccessibleName('Share Documents')
const shareDocumentsButton = await screen.findByRole(
'button',
{ name: 'Share Documents' },
{ timeout: 2000 }
);
expect(shareDocumentsButton).toHaveAccessibleName('Share Documents');

// Open share document modal
user.click(shareDocumentsButton);
const shareHeading = await screen.findByRole('heading', { name: 'Share All Documents' });
expect(shareHeading).toBeVisible();

// Close share document modal
user.keyboard('{escape}')
user.keyboard('{escape}');
await waitForElementToBeRemoved(shareHeading, { timeout: 5000 });
});

it('can show and hide the add document modal', async () => {
const user = userEvent.setup();

const addDocumentButton = await screen.findByRole('button', { name: 'Add Document' }, { timeout: 2000 });
expect(addDocumentButton).toHaveAccessibleName('Add Document')
const addDocumentButton = await screen.findByRole(
'button',
{ name: 'Add Document' },
{ timeout: 2000 }
);
expect(addDocumentButton).toHaveAccessibleName('Add Document');

// Open add document modal
user.click(addDocumentButton);
const addHeading = await screen.findByRole('heading', { name: 'Upload Document' });

// close add document modal
user.keyboard('{escape}')
user.keyboard('{escape}');
await waitForElementToBeRemoved(addHeading, { timeout: 5000 });
});
});

0 comments on commit 2fa9dc2

Please sign in to comment.