HEX
Server: Apache/2
System: Linux server-27-254-144-72.da.direct 5.10.0-33-amd64 #1 SMP Debian 5.10.226-1 (2024-10-03) x86_64
User: pokaorgani (1114)
PHP: 8.1.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/pokaorgani/public_html/wp-content/themes/sydney/tests/sidebars/sidebar.spec.js
// @ts-check
const { test, expect } = require('@playwright/test');

import { is_pro } from '../utils/pro';
import { adminLoginAction } from '../utils/login';


//Test if the sidebar exists on various pages
test.describe('Sidebar tests', () => {

	//Blog sidebar is visible
	test('Blog sidebar is visible', async ({ page }) => {
		await page.goto('http://tests.local/my-blog-page/');
		await expect(page.locator( '#secondary' )).toBeVisible(); 
	});

	//Single post sidebar is visible
	test('Single post sidebar is visible', async ({ page }) => {
		await page.goto('http://tests.local/similique-quis-a-libero-enim-quod-corporis-3/');
		await expect(page.locator( '#secondary' )).toBeVisible(); 
	});

	//Category sidebar is visible
	test('Category sidebar is visible', async ({ page }) => {
		await page.goto('http://tests.local/category/travel/');
		await expect(page.locator( '#secondary' )).toBeVisible(); 
	});

	//Page sidebar is visible
	test('Page sidebar is visible', async ({ page }) => {
		await page.goto('http://tests.local/sample-page/');
		await expect(page.locator( '#secondary' )).toBeVisible(); 
	} );

	//Post template No sidebar
	test('Post template: No sidebar', async ({ page }) => {
		await page.goto('http://tests.local/post-template-no-sidebar/');
		await expect(page.locator( '#secondary' )).not.toBeVisible(); 
	} );

	//Post template No sidebar
	test('Page template: No sidebar', async ({ page }) => {
		await page.goto('http://tests.local/no-sidebar-page/');
		await expect(page.locator( '#secondary' )).not.toBeVisible(); 
	} );

	//Set all posts to no sidebar
	test('All posts to no sidebar', async ({ page }) => {
        // Increase the test timeout
        test.slow();
        
		//Go to a post
        await page.goto('http://tests.local/wp-admin/customize.php?url=http%3A%2F%2Ftests.local%2Fsimilique-quis-a-libero-enim-quod-corporis-3%2F');

		//Login
        await adminLoginAction( page );

		//Disable the sidebar
		await page.locator('#sidebar_single_post').check();

		await expect(page.frameLocator('iframe').first().locator( '#secondary' )).not.toBeVisible(); 
	} );

	//Set all pages to no sidebar
	test('All pages to no sidebar', async ({ page }) => {
        // Increase the test timeout
        test.slow();
        
		//Go to a post
        await page.goto('http://tests.local/wp-admin/customize.php?url=http%3A%2F%2Ftests.local%2Fsample-page%2F');

		//Login
        await adminLoginAction( page );

		//Disable the sidebar
		await page.locator('#sidebar_single_page').check();

		await expect(page.frameLocator('iframe').first().locator( '#secondary' )).not.toBeVisible(); 
	} );	

});