-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3137 from jasonbahl/fix/3136-settings-page-wont-load
fix: WPGraphQL Settings page fails to load when "graphiql_enabled" setting is "off"
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { describe, test, expect, beforeEach } from '@playwright/test' | ||
import { loginToWordPressAdmin, visitAdminFacingPage, wpAdminUrl } from '../utils' | ||
|
||
const selectors = { | ||
graphiqlEnabledCheckbox: '#wpuf-graphql_general_settings\\[graphiql_enabled\\]', | ||
} | ||
|
||
describe( 'Settings Page', () => { | ||
|
||
beforeEach( async ({ page }) => { | ||
await loginToWordPressAdmin( page ); | ||
await page.evaluate(() => localStorage.clear()); | ||
}); | ||
|
||
test( 'GraphiQL IDE can be disabled', async ({ page }) => { | ||
await visitAdminFacingPage( page, wpAdminUrl + '/admin.php?page=graphql-settings' ); | ||
// await page.goto('http://localhost:8888/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%3A8888%2Fwp-admin%2F&reauth=1'); | ||
|
||
await page.waitForTimeout( 500 ); | ||
await expect( page.locator(selectors.graphiqlEnabledCheckbox ) ).toBeChecked(); | ||
await page.locator(selectors.graphiqlEnabledCheckbox ).uncheck(); | ||
await page.getByRole('button', { name: 'Save Changes' }).click(); | ||
await page.waitForTimeout( 500 ); | ||
await expect(page.getByText('Settings saved.')).toBeVisible(); | ||
await expect( page.locator(selectors.graphiqlEnabledCheckbox ) ).not.toBeChecked(); | ||
await page.locator( selectors.graphiqlEnabledCheckbox ).check(); | ||
await page.getByRole('button', { name: 'Save Changes' }).click(); | ||
await page.waitForTimeout( 500 ); | ||
await expect(page.getByText('Settings saved.')).toBeVisible(); | ||
await expect( page.locator( selectors.graphiqlEnabledCheckbox ) ).toBeChecked(); | ||
|
||
}); | ||
|
||
}); |