Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(requestinterception): remove cacheSafe flag #7217

Merged
merged 2 commits into from
May 20, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test(requestinterception): update unit tests
  • Loading branch information
Androbin committed May 18, 2021
commit 24e31afca463501dbc93a2ac4c0dcaeb3f4b9b49
15 changes: 9 additions & 6 deletions test/requestinterception.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,14 @@ describe('request interception', function () {
expect(urls.has('one-style.html')).toBe(true);
expect(urls.has('one-style.css')).toBe(true);
});
it('should not cache if not cache-safe', async () => {
it('should not cache if cache disabled', async () => {
const { page, server } = getTestState();

// Load and re-load to make sure it's cached.
await page.goto(server.PREFIX + '/cached/one-style.html');

await page.setRequestInterception(true, false);
await page.setRequestInterception(true);
await page.setCacheEnabled(false);
page.on('request', (request) => request.continue());

const cached = [];
Expand All @@ -510,13 +511,14 @@ describe('request interception', function () {
await page.reload();
expect(cached.length).toBe(0);
});
it('should cache if cache-safe', async () => {
it('should cache if cache enabled', async () => {
const { page, server } = getTestState();

// Load and re-load to make sure it's cached.
await page.goto(server.PREFIX + '/cached/one-style.html');

await page.setRequestInterception(true, true);
await page.setRequestInterception(true);
await page.setCacheEnabled(true);
page.on('request', (request) => request.continue());

const cached = [];
Expand All @@ -525,10 +527,11 @@ describe('request interception', function () {
await page.reload();
expect(cached.length).toBe(1);
});
it('should load fonts if cache-safe', async () => {
it('should load fonts if cache enabled', async () => {
const { page, server } = getTestState();

await page.setRequestInterception(true, true);
await page.setRequestInterception(true);
await page.setCacheEnabled(true);
page.on('request', (request) => request.continue());

await page.goto(server.PREFIX + '/cached/one-style-font.html');
Expand Down