-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We adapt the docs component to be mobile friendly.
- Loading branch information
Showing
25 changed files
with
662 additions
and
318 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
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 |
---|---|---|
|
@@ -117,7 +117,9 @@ test.describe('Documents Grid', () => { | |
.getByRole('cell') | ||
.nth(cellNumber); | ||
|
||
await expect(datagrid.getByLabel('Loading data')).toBeHidden(); | ||
await expect(datagrid.getByLabel('Loading data')).toBeHidden({ | ||
timeout: 5000, | ||
}); | ||
|
||
// Initial state | ||
await expect(docNameRow1).toHaveText(/.*/); | ||
|
@@ -134,7 +136,9 @@ test.describe('Documents Grid', () => { | |
const responseOrderingAsc = await responsePromiseOrderingAsc; | ||
expect(responseOrderingAsc.ok()).toBeTruthy(); | ||
|
||
await expect(datagrid.getByLabel('Loading data')).toBeHidden(); | ||
await expect(datagrid.getByLabel('Loading data')).toBeHidden({ | ||
timeout: 5000, | ||
}); | ||
|
||
await expect(docNameRow1).toHaveText(/.*/); | ||
await expect(docNameRow2).toHaveText(/.*/); | ||
|
@@ -155,7 +159,9 @@ test.describe('Documents Grid', () => { | |
const responseOrderingDesc = await responsePromiseOrderingDesc; | ||
expect(responseOrderingDesc.ok()).toBeTruthy(); | ||
|
||
await expect(datagrid.getByLabel('Loading data')).toBeHidden(); | ||
await expect(datagrid.getByLabel('Loading data')).toBeHidden({ | ||
timeout: 5000, | ||
}); | ||
|
||
await expect(docNameRow1).toHaveText(/.*/); | ||
await expect(docNameRow2).toHaveText(/.*/); | ||
|
@@ -244,3 +250,87 @@ test.describe('Documents Grid', () => { | |
await expect(datagrid.getByText(docName!)).toBeHidden(); | ||
}); | ||
}); | ||
|
||
test.describe('Documents Grid mobile', () => { | ||
test.use({ viewport: { width: 500, height: 1200 } }); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/'); | ||
}); | ||
|
||
test('it checks the grid when mobile', async ({ page }) => { | ||
await page.route('**/documents/**', async (route) => { | ||
const request = route.request(); | ||
if (request.method().includes('GET') && request.url().includes('page=')) { | ||
await route.fulfill({ | ||
json: { | ||
count: 1, | ||
next: null, | ||
previous: null, | ||
results: [ | ||
{ | ||
id: 'b7fd9d9b-0642-4b4f-8617-ce50f69519ed', | ||
title: 'My mocked document', | ||
accesses: [ | ||
{ | ||
id: '8c1e047a-24e7-4a80-942b-8e9c7ab43e1f', | ||
user: { | ||
id: '7380f42f-02eb-4ad5-b8f0-037a0e66066d', | ||
email: '[email protected]', | ||
full_name: 'John Doe', | ||
short_name: 'John', | ||
}, | ||
team: '', | ||
role: 'owner', | ||
abilities: { | ||
destroy: false, | ||
update: false, | ||
partial_update: false, | ||
retrieve: true, | ||
set_role_to: [], | ||
}, | ||
}, | ||
], | ||
abilities: { | ||
attachment_upload: true, | ||
destroy: true, | ||
link_configuration: true, | ||
manage_accesses: true, | ||
partial_update: true, | ||
retrieve: true, | ||
update: true, | ||
versions_destroy: true, | ||
versions_list: true, | ||
versions_retrieve: true, | ||
}, | ||
link_role: 'reader', | ||
link_reach: 'public', | ||
created_at: '2024-10-07T13:02:41.085298Z', | ||
updated_at: '2024-10-07T13:30:21.829690Z', | ||
}, | ||
], | ||
}, | ||
}); | ||
} else { | ||
await route.continue(); | ||
} | ||
}); | ||
|
||
await page.goto('/'); | ||
|
||
const datagrid = page.getByLabel('Datagrid of the documents page 1'); | ||
const tableDatagrid = datagrid.getByRole('table'); | ||
|
||
await expect(datagrid.getByLabel('Loading data')).toBeHidden({ | ||
timeout: 5000, | ||
}); | ||
|
||
const rows = tableDatagrid.getByRole('row'); | ||
const row = rows.filter({ | ||
hasText: 'My mocked document', | ||
}); | ||
|
||
await expect(row.getByRole('cell').nth(0)).toHaveText('My mocked document'); | ||
await expect(row.getByRole('cell').nth(1)).toHaveText('Public'); | ||
}); | ||
}); |
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
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
Oops, something went wrong.