-
Notifications
You must be signed in to change notification settings - Fork 14
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 #1409 from danskernesdigitalebibliotek/purge-3.6-d…
…isable-cli Purge 3.6.0 / Disable the late runtime processor when using CLI
- Loading branch information
Showing
8 changed files
with
130 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
'dpl_example_breadcrumb', | ||
'devel', | ||
'field_ui', | ||
'purge_ui', | ||
'views_ui', | ||
'restui', | ||
'upgrade_status', | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cli_disable: true |
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,95 @@ | ||
import "cypress-if"; | ||
|
||
const node = { | ||
title: "Varnish test", | ||
subtitle: "A subtitle", | ||
path: "/articles/varnish-test", | ||
}; | ||
|
||
const varnishCacheHeader = "x-varnish-cache"; | ||
|
||
describe("Varnish", () => { | ||
it("is caching responses for anonymous users", () => { | ||
cy.anonymousUser(); | ||
// Query the front page twice to ensure that Varnish has had a chance to | ||
// cache the response. | ||
cy.request("/"); | ||
cy.request("/").then((response) => { | ||
cy.log("Headers", response.headers); | ||
expect(response.headers).to.have.property(varnishCacheHeader, "HIT"); | ||
}); | ||
}); | ||
|
||
it("is purged when updating content", () => { | ||
// Create a node as admin. | ||
cy.drupalLogin("/node/add/article"); | ||
cy.findByLabelText("Title").type(node.title); | ||
cy.findByRole("button", { name: "Save" }).click(); | ||
cy.contains(node.title); | ||
cy.should("not.contain", node.subtitle); | ||
// We do not have a good way to store the current path between tests so | ||
// instead we ensure that the expected path is correct. | ||
cy.url().should("include", node.path); | ||
|
||
// Check that the node is accessible and rendered with the expected content | ||
// for anonymous users. | ||
cy.anonymousUser(); | ||
cy.visit(node.path); | ||
cy.contains(node.title); | ||
cy.should("not.contain", node.subtitle); | ||
|
||
// Edit the page as admin and ensure that it is updated. | ||
cy.drupalLogin(); | ||
cy.visit(node.path); | ||
cy.findByRole("link", { | ||
name: `Edit ${node.title}`, | ||
}).click({ | ||
// Use force as the toolbar may cover the Edit link. | ||
force: true, | ||
}); | ||
cy.findByLabelText("Subtitle").type(node.subtitle); | ||
cy.findByRole("button", { name: "Save" }).click(); | ||
cy.contains(node.title); | ||
cy.contains(node.subtitle); | ||
|
||
// Ensure that the cache is purged and update shown immediately to | ||
// anonymous users. | ||
cy.anonymousUser(); | ||
cy.request(node.path).then((response) => { | ||
cy.log("Headers", response.headers); | ||
expect(response.headers).to.have.property(varnishCacheHeader, "MISS"); | ||
}); | ||
cy.visit(node.path); | ||
cy.contains(node.title); | ||
cy.contains(node.subtitle); | ||
}); | ||
|
||
before(() => { | ||
cy.drupalLogin("/admin/content"); | ||
// Delete all preexisting instances of the node. | ||
cy.get("a") | ||
.contains(node.title) | ||
.if() | ||
.each(() => { | ||
// We have to repeat the selector as Cypress will otherwise complain about | ||
// missing references to elements when clicking the page. | ||
cy.findAllByRole("link", { name: node.title }).first().click(); | ||
cy.findByRole("link", { | ||
name: `Edit ${node.title}`, | ||
}).click(); | ||
cy.findByRole("button", { name: "More actions" }) | ||
.click() | ||
.parent() | ||
.findByRole("link", { name: "Delete" }) | ||
.click(); | ||
cy.findByRole("dialog") | ||
.findByRole("button", { name: "Delete" }) | ||
.click(); | ||
|
||
// Return to the node list to prepare for the next iteration. | ||
cy.visit("/admin/content"); | ||
}); | ||
|
||
cy.anonymousUser(); | ||
}); | ||
}); |
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