Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit d26db8e

Browse files
authored
Merge pull request #9 from argos-ci/various-fixes
various fixes
2 parents 6e0fcde + 27c594e commit d26db8e

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ jobs:
1919
- name: Install dependencies
2020
run: npm ci
2121

22-
- name: Lint & Format
23-
run: npm run lint && npm run format
22+
- name: Lint
23+
run: npm run lint
24+
25+
- name: Check format
26+
run: npm run check-format
2427

2528
- name: Test
2629
run: npm run test

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import "@argos-ci/cypress/support";
2020

2121
## Usage
2222

23-
`cy.argosScreenshot` - command stabilizes the UI and takes a screenshot.
23+
`cy.argosScreenshot` command stabilizes the UI and takes a screenshot.
2424

2525
_How to take a screenshot with `cy.argosScreenshot` command_
2626

@@ -36,12 +36,12 @@ describe("Homepage", () => {
3636
});
3737
```
3838

39-
### Configuration
39+
## API
4040

41-
`cy.argosScreenshot([name][, options])`
41+
### cy.argosScreenshot([name][, options])
4242

4343
- `name` - The screenshot name; must be unique; default value to test title
44-
- `options` - Send to [cy.screenshot command options](https://docs.cypress.io/api/commands/screenshot)
44+
- `options` - See [cy.screenshot command options](https://docs.cypress.io/api/commands/screenshot)
4545

4646
## Helper attributes
4747

cypress/e2e/argosScreenshot.cy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const screenshotsFolder = Cypress.browser.isHeaded
2-
? `./cypress/screenshots/argos`
3-
: `./cypress/screenshots/${Cypress.spec.name}/argos`;
2+
? `./cypress/screenshots`
3+
: `./cypress/screenshots/${Cypress.spec.name}`;
44

55
describe("argosScreenshot", () => {
66
before(() => {
@@ -24,7 +24,7 @@ describe("argosScreenshot", () => {
2424

2525
it("takes a screenshot with generic name", () => {
2626
cy.readFile(
27-
`${screenshotsFolder}/argosScreenshot without name before all hook.png`
27+
`${screenshotsFolder}/argosScreenshot -- without name -- waits for loader hiding -- before all hook.png`
2828
);
2929
});
3030
});

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@
3131
"test": "cypress run",
3232
"test:open": "cypress open --e2e -b chrome",
3333
"format": "prettier --write .",
34+
"check-format": "prettier --check .",
3435
"lint": "eslint --ignore-path .gitignore .",
3536
"release": "standard-version && conventional-github-releaser --preset angular"
3637
},
3738
"dependencies": {
3839
"cypress-wait-until": "^1.7.2"
3940
},
41+
"peerDependencies": {
42+
"cypress": ">=3"
43+
},
4044
"devDependencies": {
4145
"@argos-ci/cli": "^0.1.2",
4246
"@argos-ci/cypress": "file:.",

support.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ function waitUntilNoBusy() {
5454
);
5555
}
5656

57-
/**
58-
* Takes a screenshot for Argos.
59-
*/
6057
Cypress.Commands.add(
6158
"argosScreenshot",
6259
{ prevSubject: ["optional", "element", "window", "document"] },
@@ -66,11 +63,10 @@ Cypress.Commands.add(
6663
name = null;
6764
}
6865

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

8278
// Screenshot
83-
cy.wrap(subject).screenshot(screenshotName, {
79+
cy.wrap(subject).screenshot(name, {
8480
blackout: ['[data-visual-test="blackout"]'].concat(
8581
options.blackout || []
8682
),

0 commit comments

Comments
 (0)