Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnavarro committed Feb 11, 2025
2 parents 89e445e + 3a31e02 commit 30af8f2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ node_modules
test/e2e/content-workspace/**/.posit
test/e2e/cypress/downloads/
test/e2e/cypress/screenshots/

# Possible e2e tests deployment assets
test/e2e/content-workspace/**/.posit
15 changes: 14 additions & 1 deletion test/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Cypress.Commands.add("clearupDeployments", () => {
cy.exec(`rm -rf content-workspace/static/.posit`);
});

Cypress.Commands.add("loadProjectConfig", (projectName) => {
Cypress.Commands.add("loadProjectConfigFile", (projectName) => {
const projectConfigPath = `content-workspace/${projectName}/.posit/publish/static-*.toml`;
// Do not fail on non-zero exit this time, we can provide a better error
return cy
Expand All @@ -147,6 +147,19 @@ Cypress.Commands.add("loadProjectConfig", (projectName) => {
});
});

Cypress.Commands.add("loadProjectDeploymentFile", (projectName) => {
const projectDeploymentPath = `content-workspace/${projectName}/.posit/publish/deployments/deployment-*.toml`;
// Do not fail on non-zero exit this time, we can provide a better error
return cy
.exec(`cat ${projectDeploymentPath}`, { failOnNonZeroExit: false })
.then((result) => {
if (result.code === 0 && result.stdout) {
return toml.parse(result.stdout);
}
throw new Error(`Could not load project deployment. ${result.stderr}`);
});
});

// Performs the full set of reset commands we typically use before executing our tests
Cypress.Commands.add("resetConnect", () => {
cy.clearupDeployments();
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/deployments.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe("Deployments Section", () => {
.should("be.visible")
.click();

cy.loadProjectConfig("static").then((config) => {
cy.loadProjectConfigFile("static").then((config) => {
expect(config.title).to.equal("static");
expect(config.type).to.equal("html");
expect(config.entrypoint).to.equal("index.html");
Expand Down

0 comments on commit 30af8f2

Please sign in to comment.