-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: config ui is in sync with IDB (#528)
* chore: update package-lock.json * fix: config UI is up to date with IDB * chore: apply self suggestions from code review * chore: fix build and lint
- Loading branch information
Showing
10 changed files
with
861 additions
and
616 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,33 @@ | ||
/** | ||
* Ensure the config saves to IDB and on refresh, the config is loaded from IDB | ||
*/ | ||
|
||
import { testPathRouting as test, expect } from './fixtures/config-test-fixtures.js' | ||
import { getConfig, getConfigUi, setConfigViaUi } from './fixtures/set-sw-config.js' | ||
|
||
test.describe('config-ui', () => { | ||
test('setting the config via UI actually works', async ({ page, protocol, rootDomain }) => { | ||
await page.goto(`${protocol}//${rootDomain}`) | ||
|
||
// read the config from the page | ||
const config = await getConfigUi({ page }) | ||
|
||
// change the config | ||
const testConfig: typeof config = { | ||
...config, | ||
gateways: ['https://example.com'], | ||
routers: ['https://example2.com'] | ||
} | ||
|
||
// change the UI & save it | ||
await setConfigViaUi({ page, config: testConfig }) | ||
|
||
// verify that the IndexedDB has the new config | ||
expect(await getConfig({ page })).toMatchObject(testConfig) | ||
|
||
// reload the page, and ensure the config is the same as the one we set | ||
await page.reload() | ||
expect(await getConfigUi({ page })).toMatchObject(testConfig) | ||
expect(await getConfig({ page })).toMatchObject(testConfig) | ||
}) | ||
}) |
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
Oops, something went wrong.