Skip to content

Commit 05a313b

Browse files
committed
v0.3.10 improved cypress for Bitloops
1 parent b97bfc0 commit 05a313b

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generator-bitloops",
3-
"version": "0.3.9",
3+
"version": "0.3.10",
44
"description": "Next.js with TypeScript, Tailwind, Storybook and Cypress generator by Bitloops",
55
"license": "MIT",
66
"author": "Bitloops S.A.",

setup/templates/cypress.config.ts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
import { defineConfig } from 'cypress';
2-
import * as fs from 'fs';
3-
import * as path from 'path';
42

53
export default defineConfig({
64
e2e: {
75
specPattern: "**/*.cy.{ts,tsx}",
86
supportFile: false,
97
testIsolation: false,
10-
setupNodeEvents(on) {
11-
on('task', {
12-
saveTestResults(results) {
13-
const resultsPath = path.join(__dirname, '.', 'cypress', 'results', 'results.json');
14-
if (!fs.existsSync(resultsPath)) {
15-
fs.writeFileSync(resultsPath, '[]'); // Create file if it doesn't exist
16-
}
17-
const existingResults = JSON.parse(fs.readFileSync(resultsPath, 'utf8'));
18-
existingResults.push(JSON.parse(results));
19-
fs.writeFileSync(resultsPath, JSON.stringify(existingResults, null, 2));
20-
return null; // Indicate the task was successful
21-
}
22-
});
23-
},
248
},
259
reporter: "mochawesome",
26-
reporterOptions: {
27-
reportDir: "cypress/results",
28-
overwrite: true,
29-
html: true,
30-
json: true,
31-
},
10+
reporterOptions: {
11+
reportDir: "cypress/results",
12+
overwrite: true,
13+
html: true,
14+
json: true,
15+
reportTitle: "Component Testing",
16+
reportPageTitle: "Bitloops Component Testing",
17+
charts: true,
18+
reportFilename: "report",
19+
code: true,
20+
showPassed: true,
21+
showFailed: true,
22+
showSkipped: true,
23+
saveJson: true,
24+
},
3225
});

setup/templates/cypress/helpers/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ export const isOutOfBounds = (inRect: DOMRect, outRect: DOMRect): boolean => {
1111
return isOut;
1212
};
1313

14+
export const isOutOfHorizontalBounds = (inRect: DOMRect, outRect: DOMRect): boolean => {
15+
const isOut =
16+
inRect.left < outRect.left ||
17+
inRect.right > outRect.right;
18+
return isOut;
19+
};
20+
1421
export const hasHorizontalScroll = (document: Document): boolean => {
1522
const scrollingElement = document.scrollingElement;
1623
if (!scrollingElement) {

0 commit comments

Comments
 (0)