Skip to content

Commit

Permalink
Add test to verify enhanced security
Browse files Browse the repository at this point in the history
  • Loading branch information
Mwalek committed Nov 18, 2024
1 parent 9852fa6 commit 4b86280
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
7 changes: 0 additions & 7 deletions tests/E2E/tests/permissions/disallowExport.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {

test('Verify Disallow Export', async ({ page }, testInfo) => {
let noDownload = true;

page.on('download', (download) => {
noDownload = false;
});
Expand All @@ -27,11 +26,5 @@ test('Verify Disallow Export', async ({ page }, testInfo) => {
const downloadUrl = `${viewUrl}csv/`;
await checkViewOnFrontEnd(page);
await clickDownloadButton(page, downloadUrl);
console.log('Yello');
console.log('Cold Play');
console.log("<a href='#'>Roof</a>");

expect(noDownload).toBe(true);
console.log('NEw');
console.log('fresh');
});
28 changes: 28 additions & 0 deletions tests/E2E/tests/permissions/enableEnhancedSecurity.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { test, expect } from '@playwright/test';
import {
createPageWithShortcode,
createView,
gotoAndEnsureLoggedIn,
publishView,
templates,
} from '../../helpers/test-helpers';

test('Verify Ehanced Security', async ({ page }, testInfo) => {
await gotoAndEnsureLoggedIn(page, testInfo);
await createView(page, {
formTitle: 'Favorite Color',
viewName: 'Verify Ehanced Security Test',
template: templates[0],
});
await publishView(page);
const currentUrl = page.url();
const params = new URLSearchParams(new URL(currentUrl).search);
const viewId = params.get('post');
const url = await createPageWithShortcode(page, {
shortcode: `gravityview id="${viewId}"`,
title: 'Verify Ehanced Security Test Page',
});
await page.goto(url);
const errorMessage = page.locator('text=Invalid View secret provided');
await expect(errorMessage).toBeVisible();
});

0 comments on commit 4b86280

Please sign in to comment.