Skip to content

Commit

Permalink
Merge pull request #4851 from 3liz/backport-4835-to-master
Browse files Browse the repository at this point in the history
[Backport master] Tests - Move a minor tests from manual to playwright
  • Loading branch information
Gustry authored Oct 8, 2024
2 parents 4adf5dd + af6e461 commit fca0eaf
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/end2end/playwright/media.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// @ts-check
import { test, expect } from '@playwright/test';
import { gotoMap } from './globals';

test.describe('Media', () => {
test('Tests media are deleted', async ({ page }) => {

var baseUrl = 'index.php/view/media/getMedia?repository=testsrepository&project=form_edition_all_field_type&path=';
// on the feature from the "form_edition_upload" layer
var response = await page.request.get(baseUrl + 'media/upload/form_edition_all_field_type/form_edition_upload/text_file_mandatory/lorem-2.txt');
await expect(response).toBeOK();

var response = await page.request.get(baseUrl + 'media/upload/form_edition_all_field_type/form_edition_upload/image_file_mandatory/random-2.jpg');
await expect(response).toBeOK();

var response = await page.request.get(baseUrl + '../media/specific_media_folder/random-4.jpg');
await expect(response).toBeOK();

// Open the attribute table
const url = '/index.php/view/map?repository=testsrepository&project=form_edition_all_field_type';
await gotoMap(url, page);

await page.locator('#button-attributeLayers').click();

let getFeatureRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeature') === true);

await page.locator('#attribute-layer-list button[value="form_edition_upload"]').click();
await getFeatureRequestPromise;

await page.getByRole('row', { name: '2 text_file_mandatory' }).getByRole('button').nth(2);

// var response = await page.request.get(baseUrl + 'media/upload/form_edition_all_field_type/form_edition_upload/text_file_mandatory/lorem-2.txt');
// await expect(response).toBeOK();
//
// var response = await page.request.get(baseUrl + 'media/upload/form_edition_all_field_type/form_edition_upload/image_file_mandatory/random-2.jpg');
// await expect(response).toBeFalsy();
//
// var response = await page.request.get(baseUrl + '../media/specific_media_folder/random-4.jpg');
// await expect(response).toBeFalsy();

})
})

0 comments on commit fca0eaf

Please sign in to comment.