Skip to content

Commit

Permalink
feat: do not take screenshots in argos folder
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Sep 2, 2022
1 parent 8f9a25a commit 27c594e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/argosScreenshot.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const screenshotsFolder = Cypress.browser.isHeaded
? `./cypress/screenshots/argos`
: `./cypress/screenshots/${Cypress.spec.name}/argos`;
? `./cypress/screenshots`
: `./cypress/screenshots/${Cypress.spec.name}`;

describe("argosScreenshot", () => {
before(() => {
Expand All @@ -24,7 +24,7 @@ describe("argosScreenshot", () => {

it("takes a screenshot with generic name", () => {
cy.readFile(
`${screenshotsFolder}/argosScreenshot without name before all hook.png`
`${screenshotsFolder}/argosScreenshot -- without name -- waits for loader hiding -- before all hook.png`
);
});
});
Expand Down
8 changes: 2 additions & 6 deletions support.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ function waitUntilNoBusy() {
);
}

/**
* Takes a screenshot for Argos.
*/
Cypress.Commands.add(
"argosScreenshot",
{ prevSubject: ["optional", "element", "window", "document"] },
Expand All @@ -66,11 +63,10 @@ Cypress.Commands.add(
name = null;
}

const screenshotName = `argos/${name || cy.state("runnable").fullTitle()}`;
Cypress.log({
name: "argosScreenshot",
displayName: `Argos Screenshot`,
message: screenshotName,
message: name,
});
// Inject styles
cy.document().then((doc) => injectStyles(doc));
Expand All @@ -80,7 +76,7 @@ Cypress.Commands.add(
cy.document().its("fonts.status").should("equal", "loaded");

// Screenshot
cy.wrap(subject).screenshot(screenshotName, {
cy.wrap(subject).screenshot(name, {
blackout: ['[data-visual-test="blackout"]'].concat(
options.blackout || []
),
Expand Down

0 comments on commit 27c594e

Please sign in to comment.