💬(frontend) change literal occurances of pad to document

- change urls from /pads to /docs
- change part of the litteral occurances of pad to document
This commit is contained in:
Anthony LC
2024-05-27 13:27:49 +02:00
committed by Anthony LC
parent d0d0b44f57
commit 0727fe0273
21 changed files with 132 additions and 116 deletions

View File

@@ -30,14 +30,16 @@ export const createPad = async (
length: number,
isPublic: boolean = false,
) => {
const panel = page.getByLabel('Pads panel').first();
const buttonCreate = page.getByRole('button', { name: 'Create the pad' });
const panel = page.getByLabel('Documents panel').first();
const buttonCreate = page.getByRole('button', {
name: 'Create the document',
});
const randomPads = randomName(padName, browserName, length);
for (let i = 0; i < randomPads.length; i++) {
await panel.getByRole('button', { name: 'Add a pad' }).click();
await page.getByText('Pad name').fill(randomPads[i]);
await panel.getByRole('button', { name: 'Add a document' }).click();
await page.getByText('Document name').fill(randomPads[i]);
if (isPublic) {
await page.getByText('Is it public ?').click();

View File

@@ -11,7 +11,7 @@ test.describe('Language', () => {
test('checks the language picker', async ({ page }) => {
await expect(
page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
}),
).toBeVisible();
@@ -22,7 +22,7 @@ test.describe('Language', () => {
await expect(
page.getByRole('button', {
name: 'Créer un nouveau pad',
name: 'Créer un nouveau document',
}),
).toBeVisible();
});

View File

@@ -10,20 +10,20 @@ test.beforeEach(async ({ page, browserName }) => {
test.describe('Pad Create', () => {
test('checks all the create pad elements are visible', async ({ page }) => {
const buttonCreateHomepage = page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
});
await buttonCreateHomepage.click();
await expect(buttonCreateHomepage).toBeHidden();
const card = page.getByLabel('Create new pad card').first();
const card = page.getByLabel('Create new document card').first();
await expect(card.getByLabel('Pad name')).toBeVisible();
await expect(card.getByLabel('Document name')).toBeVisible();
await expect(card.getByLabel('icon group')).toBeVisible();
await expect(
card.getByRole('heading', {
name: 'Name the pad',
name: 'Name the document',
level: 3,
}),
).toBeVisible();
@@ -32,7 +32,7 @@ test.describe('Pad Create', () => {
await expect(
card.getByRole('button', {
name: 'Create the pad',
name: 'Create the document',
}),
).toBeVisible();
@@ -45,12 +45,12 @@ test.describe('Pad Create', () => {
test('checks the cancel button interaction', async ({ page }) => {
const buttonCreateHomepage = page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
});
await buttonCreateHomepage.click();
await expect(buttonCreateHomepage).toBeHidden();
const card = page.getByLabel('Create new pad card').first();
const card = page.getByLabel('Create new document card').first();
await card
.getByRole('button', {
@@ -65,18 +65,18 @@ test.describe('Pad Create', () => {
page,
browserName,
}) => {
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByRole('button', { name: 'Add a pad' }).click();
await panel.getByRole('button', { name: 'Add a document' }).click();
const padName = `My routing pad ${browserName}-${Math.floor(Math.random() * 1000)}`;
await page.getByText('Pad name').fill(padName);
await page.getByRole('button', { name: 'Create the pad' }).click();
await page.getByText('Document name').fill(padName);
await page.getByRole('button', { name: 'Create the document' }).click();
const elPad = page.locator('h2').getByText(padName);
await expect(elPad).toBeVisible();
await panel.getByRole('button', { name: 'Add a pad' }).click();
await panel.getByRole('button', { name: 'Add a document' }).click();
await expect(elPad).toBeHidden();
await panel.locator('li').getByText(padName).click();
@@ -87,18 +87,18 @@ test.describe('Pad Create', () => {
await expect(page).toHaveURL('/');
const buttonCreateHomepage = page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
});
await expect(buttonCreateHomepage).toBeVisible();
await page.goto('/pads');
await page.goto('/docs');
await expect(buttonCreateHomepage).toBeVisible();
await expect(page).toHaveURL(/\/pads$/);
await expect(page).toHaveURL(/\/docs$/);
});
test('checks 404 on pads/[id] page', async ({ page }) => {
await page.goto('/pads/some-unknown-pad');
test('checks 404 on docs/[id] page', async ({ page }) => {
await page.goto('/docs/some-unknown-pad');
await expect(
page.getByText(
'It seems that the page you are looking for does not exist or cannot be displayed correctly.',
@@ -114,14 +114,14 @@ test.describe('Pad Create', () => {
response.url().includes('/documents/') && response.status() === 201,
);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByRole('button', { name: 'Add a pad' }).click();
await panel.getByRole('button', { name: 'Add a document' }).click();
const padName = `My routing pad ${browserName}-${Math.floor(Math.random() * 1000)}`;
await page.getByText('Pad name').fill(padName);
await page.getByText('Document name').fill(padName);
await page.getByText('Is it public ?').click();
await page.getByRole('button', { name: 'Create the pad' }).click();
await page.getByRole('button', { name: 'Create the document' }).click();
const responsePad = await responsePromisePad;
const is_public = (await responsePad.json()).is_public;

View File

@@ -86,7 +86,7 @@ test.describe('Pad Editor', () => {
2,
);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
// Check the first pad
await panel.getByText(firstPad).click();
@@ -116,7 +116,7 @@ test.describe('Pad Editor', () => {
}) => {
const [pad] = await createPad(page, 'pad-save-page', browserName, 1);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
// Check the first pad
await panel.getByText(pad).click();
@@ -129,14 +129,14 @@ test.describe('Pad Editor', () => {
await panel
.getByRole('button', {
name: 'Add a pad',
name: 'Add a document',
})
.click();
const card = page.getByLabel('Create new pad card').first();
const card = page.getByLabel('Create new document card').first();
await expect(
card.getByRole('heading', {
name: 'Name the pad',
name: 'Name the document',
level: 3,
}),
).toBeVisible();
@@ -151,7 +151,7 @@ test.describe('Pad Editor', () => {
test('it saves the doc when we quit pages', async ({ page, browserName }) => {
const [pad] = await createPad(page, 'pad-save-quit', browserName, 1);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
// Check the first pad
await panel.getByText(pad).click();
@@ -188,7 +188,7 @@ test.describe('Pad Editor', () => {
await keyCloakSignIn(page, newBrowserName);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByText(padName).click();
await expect(

View File

@@ -9,21 +9,21 @@ test.beforeEach(async ({ page, browserName }) => {
await keyCloakSignIn(page, browserName);
});
test.describe('Pads Panel', () => {
test.describe('Documents Panel', () => {
test('checks all the elements are visible', async ({ page }) => {
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await expect(panel.getByText('Documents')).toBeVisible();
await expect(
panel.getByRole('button', {
name: 'Sort the pads',
name: 'Sort the documents',
}),
).toBeVisible();
await expect(
panel.getByRole('button', {
name: 'Add a pad',
name: 'Add a document',
}),
).toBeVisible();
});
@@ -41,11 +41,11 @@ test.describe('Pads Panel', () => {
response.status() === 200,
);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel
.getByRole('button', {
name: 'Sort the pads by creation date ascendent',
name: 'Sort the documents by creation date ascendent',
})
.click();
@@ -54,7 +54,7 @@ test.describe('Pads Panel', () => {
await panel
.getByRole('button', {
name: 'Sort the pads by creation date descendent',
name: 'Sort the documents by creation date descendent',
})
.click();
@@ -64,7 +64,7 @@ test.describe('Pads Panel', () => {
test('checks the infinite scroll', async ({ page, browserName }) => {
test.setTimeout(90000);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
const randomPads = await createPad(page, 'pad-infinite', browserName, 40);
@@ -76,7 +76,7 @@ test.describe('Pads Panel', () => {
});
test('checks the hover and selected state', async ({ page, browserName }) => {
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await createPad(page, 'pad-hover', browserName, 2);
const selectedPad = panel.locator('li').nth(0);

View File

@@ -73,7 +73,7 @@ test.describe('Pad Tools', () => {
page.getByRole('checkbox', { name: 'Is it public ?' }),
).toBeChecked();
await page.getByText('Pad name').fill(`${randomPad}-updated`);
await page.getByText('Document name').fill(`${randomPad}-updated`);
await page.getByText('Is it public ?').click();
await page
@@ -86,7 +86,7 @@ test.describe('Pad Tools', () => {
page.getByText('The document has been updated.'),
).toBeVisible();
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await expect(
panel.locator('li').getByText(`${randomPad}-updated`),
).toBeVisible();
@@ -129,10 +129,10 @@ test.describe('Pad Tools', () => {
).toBeVisible();
await expect(
page.getByRole('button', { name: 'Create a new pad' }),
page.getByRole('button', { name: 'Create a new document' }),
).toBeVisible();
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await expect(panel.locator('li').getByText(randomPad)).toBeHidden();
});
@@ -158,7 +158,7 @@ test.describe('Pad Tools', () => {
await keyCloakSignIn(page, newBrowserName);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByText(padName).click();
await page.getByLabel('Open the document options').click();