Skip to content

Commit

Permalink
fix(#170): fix cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-wade committed Dec 6, 2023
1 parent 66945cc commit 398312e
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 36 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ module.exports = {
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
overrides:[
{
files: ['*.cy.js'],
extends: ['plugin:cypress/recommended'],
},
],
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"format": "prettier --write .",
"generate-scaffold": "cd ./packages/cli/out && yarn run exec-source scaffold eleventy --name my-example && cd ../../..",
"generate-types": "turbo generate-types",
"lint": "eslint packages/**!(node_modules)/src/**/*.ts",
"lint": "eslint packages/**!(node_modules)/src/**/*.ts packages/cypress/e2e/**/*.js packages/cypress/support/*.js",
"serve": "turbo run serve --parallel",
"test": "turbo test",
"watch": "turbo run watch --parallel"
Expand Down
22 changes: 22 additions & 0 deletions packages/cypress/e2e/website/guides.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="cypress" />

const guides = [
'custom-validator',
'new-website',
'styling-your-component',
'writing-tests'
];

guides.forEach((guide) => {
describe(`guide: ${guide}`, () => {
beforeEach(() => {
cy.visit(`http://localhost:8081/pages/${guide}-guide/`);
});

it('should mount the layout', () => {
cy.get('tybalt-header').should('have.length', 1);
cy.get('tybalt-sidebar').should('have.length', 1);
cy.get('tybalt-footer').should('have.length', 1);
});
});
});
10 changes: 0 additions & 10 deletions packages/cypress/e2e/website/index.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,4 @@ describe('index.html', () => {
cy.get('tybalt-sidebar').should('have.length', 1);
cy.get('tybalt-footer').should('have.length', 1);
});

it('pass the lighthouse audit', () => {
cy.lighthouse({
accessibility: 90,
'best-practices': 90,
seo: 90,
pwa: 90,
performance: 90,
});
});
});
Empty file.
26 changes: 26 additions & 0 deletions packages/cypress/e2e/website/packages.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference types="cypress" />

const packages = [
'cli',
'core',
'eleventy-plugin',
'esbuild-plugin',
'eslint-plugin',
'parser',
'test-utils',
'validator'
];

packages.forEach((pkg) => {
describe(`package: ${pkg}`, () => {
beforeEach(() => {
cy.visit(`http://localhost:8081/pages/${pkg}/`);
});

it('should mount the layout', () => {
cy.get('tybalt-header').should('have.length', 1);
cy.get('tybalt-sidebar').should('have.length', 1);
cy.get('tybalt-footer').should('have.length', 1);
});
});
});
25 changes: 0 additions & 25 deletions packages/cypress/e2e/website/pages.cy.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"build": "yarn run compile && yarn run generate-types",
"clean": "rimraf dist/",
"lint": "eslint ese/ src/ support/",
"compile": "esbuild src/index.ts --format=cjs --outdir=dist",
"generate-types": "tsc"
},
Expand Down

0 comments on commit 398312e

Please sign in to comment.