refactor(e2e): optimize portfolio tests (#56843)

This commit is contained in:
Sem Bauke
2024-10-25 16:55:22 +02:00
committed by GitHub
parent a2eaba1862
commit df4c4e3fd2
+3 -17
View File
@@ -23,12 +23,13 @@ test.describe('Add Portfolio Item', () => {
}
await page.getByRole('button', { name: 'Edit my profile' }).click();
});
test('The title has validation', async ({ page }) => {
await page
.getByRole('button', { name: 'Add a new portfolio Item' })
.click();
});
test('The title has validation', async ({ page }) => {
await page.getByLabel(translations.settings.labels.title).fill('T');
await expect(page.getByTestId('title-validation')).toContainText(
'Title is too short'
@@ -49,9 +50,6 @@ test.describe('Add Portfolio Item', () => {
});
test('The url has validation', async ({ page }) => {
await page
.getByRole('button', { name: 'Add a new portfolio Item' })
.click();
await page.getByLabel(translations.settings.labels.url).fill('T');
await expect(page.getByTestId('url-validation')).toContainText(
'Please use a valid URL'
@@ -63,9 +61,6 @@ test.describe('Add Portfolio Item', () => {
});
test('The image has validation', async ({ page }) => {
await page
.getByRole('button', { name: 'Add a new portfolio Item' })
.click();
await page.getByLabel(translations.settings.labels.image).fill('T');
await expect(page.getByTestId('image-validation')).toContainText(
'URL must link directly to an image file'
@@ -77,9 +72,6 @@ test.describe('Add Portfolio Item', () => {
});
test('The description has validation', async ({ page }) => {
await page
.getByRole('button', { name: 'Add a new portfolio Item' })
.click();
await page
.getByLabel(translations.settings.labels.description)
.fill(
@@ -95,9 +87,6 @@ test.describe('Add Portfolio Item', () => {
});
test('It should be possible to delete a portfolio item', async ({ page }) => {
await page
.getByRole('button', { name: 'Add a new portfolio Item' })
.click();
await page
.getByLabel(translations.settings.labels.title)
.fill('My portfolio');
@@ -119,9 +108,6 @@ test.describe('Add Portfolio Item', () => {
});
test('It should be possible to add a portfolio item', async ({ page }) => {
await page
.getByRole('button', { name: 'Add a new portfolio Item' })
.click();
await expect(
page.getByRole('button', { name: 'Add a new portfolio Item' })
).toBeDisabled();