Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ const { defineConfig } = require('cypress');
module.exports = defineConfig({
video: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config);
},
baseUrl: 'http://localhost:4200',
viewportWidth: 1280,
viewportHeight: 720,
defaultCommandTimeout: 10000,
experimentalStudio: false,
},
});
79 changes: 70 additions & 9 deletions cypress/e2e/check-sub-navigation.cy.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,78 @@
describe('Detect sub navigation', () => {
it('should show sub navigation', () => {
cy.visit('/concepts/');
// cypress/e2e/check-sub-navigation.cy.js

const selector = '[data-testid="sub-navigation"]';
describe('Sub Navigation', () => {
beforeEach(() => {
cy.viewport(1280, 720); // Set consistent viewport size for desktop view
});

describe('Desktop Navigation', () => {
it('should show sub navigation on documentation pages', () => {
cy.visit('/concepts/');

// Check if header exists
cy.get('header').should('exist').and('be.visible');

// Verify sub-navigation exists and is visible
cy.get('[data-testid="sub-navigation"]')
.should('exist')
.and('be.visible');

// Verify sub-navigation links are properly styled
cy.get('[data-testid="sub-navigation"] a')
.should('have.length.at.least', 1)
.first()
.should('have.class', 'text-blue-400');
});

it('should not show sub navigation on home page', () => {
cy.visit('/');

// Wait for page load and any animations
cy.wait(1000);

cy.get(selector).should('exist');
// Verify sub-navigation is not present
cy.get('[data-testid="sub-navigation"]').should('not.exist');
});

it('should highlight active sub navigation item', () => {
cy.visit('/concepts/');

// Get the first sub-nav link and verify it becomes active when clicked
cy.get('[data-testid="sub-navigation"] a')
.first()
.click()
.should('have.class', '!text-black');
});

it('should show language dropdown', () => {
cy.visit('/concepts/');

// Verify language dropdown exists
cy.get('[role="combobox"]').should('exist').and('be.visible');
});
});

it('should not show sub navigation', () => {
cy.visit('/');
describe('Mobile Navigation', () => {
beforeEach(() => {
cy.viewport(375, 667); // Set mobile viewport
});

it('should show hamburger menu on mobile', () => {
cy.visit('/concepts/');

// Verify hamburger button exists
cy.get('button')
.first()
.should('be.visible')
.find('svg')
.should('have.class', 'fill-current');
});

const selector = '[data-testid="sub-navigation"]';
it('should hide desktop navigation on mobile', () => {
cy.visit('/concepts/');

cy.get(selector).should('not.exist');
// Verify desktop nav is hidden
cy.get('nav').first().should('have.class', 'hidden');
});
});
});
61 changes: 35 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"node": ">= 20.9.0"
},
"scripts": {
"test:serve": "http-server dist --port 4200 --silent",
"test:build": "npm run build || true",
"pretest:e2e": "npm run test:build",
"test:e2e": "start-server-and-test test:serve http://localhost:4200 'cypress run --browser chrome'",
"clean-dist": "rimraf ./dist",
"clean-printable": "rimraf src/content/**/printable.mdx",
"preclean": "run-s clean-dist clean-printable",
Expand Down Expand Up @@ -56,7 +60,9 @@
"cypress:open": "cypress open",
"cypress:run": "cypress run --browser chrome",
"prettier": "prettier --write '**/*.{js,json,jsx,css,scss,md,mdx}'",
"prepare": "husky && rimraf ./node_modules/.cache/webpack && yarn-deduplicate --strategy fewer"
"prepare": "husky && rimraf ./node_modules/.cache/webpack && yarn-deduplicate --strategy fewer",
"build:lib": "babel src -d lib",
"start:dev": "webpack serve --config webpack.dev.mjs --env dev --progress --define-process-env-node-env development"
},
"lint-staged": {
"*.{js,mjs,jsx,md,mdx}": [
Expand All @@ -72,12 +78,12 @@
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@babel/plugin-proposal-class-properties": "^7.17.12",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.26.3",
"@eslint/compat": "^1.2.4",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.16.0",
"@eslint/js": "^9.17.0",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/react": "^3.1.0",
"@octokit/auth-action": "^5.1.1",
Expand All @@ -89,76 +95,79 @@
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"cypress": "^13.16.0",
"cypress": "^13.17.0",
"directory-tree": "^3.5.2",
"directory-tree-webpack-plugin": "^1.0.3",
"duplexer": "^0.1.1",
"eslint": "^9.16.0",
"duplexer": "^0.1.2",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-mdx": "^3.1.5",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
"front-matter": "^4.0.2",
"github-slugger": "^2.0.0",
"globals": "^15.13.0",
"globals": "^15.14.0",
"html-webpack-plugin": "^5.6.3",
"http-server": "^14.1.1",
"husky": "^9.1.7",
"hyperlink": "^5.0.4",
"jest": "^29.7.0",
"lightningcss": "^1.28.2",
"lint-staged": "^15.2.10",
"lint-staged": "^15.3.0",
"lodash": "^4.17.21",
"markdownlint-cli": "^0.43.0",
"mdast-util-to-string": "^4.0.0",
"mini-css-extract-plugin": "^2.9.2",
"mkdirp": "^3.0.1",
"modularscale-sass": "^3.0.3",
"npm-run-all": "^4.1.1",
"modularscale-sass": "^3.0.10",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.49",
"postcss-loader": "^8.1.1",
"prettier": "^3.4.2",
"react-refresh": "^0.14.2",
"react-refresh": "^0.16.0",
"redirect-webpack-plugin": "^1.0.0",
"remark": "^15.0.1",
"remark-autolink-headings": "7.0.1",
"remark-autolink-headings": "8.0.0",
"remark-emoji": "^5.0.1",
"remark-extract-anchors": "1.1.1",
"remark-frontmatter": "^5.0.0",
"remark-gfm": "^4.0.0",
"remark-html": "^16.0.1",
"remark-refractor": "montogeek/remark-refractor",
"rimraf": "^6.0.1",
"sass": "^1.79.5",
"sass": "^1.83.1",
"sass-loader": "^16.0.4",
"sirv-cli": "^3.0.0",
"sitemap-static": "^0.4.2",
"static-site-generator-webpack-plugin": "^3.4.1",
"sitemap-static": "^0.4.4",
"start-server-and-test": "^2.0.9",
"static-site-generator-webpack-plugin": "^3.4.2",
"style-loader": "^4.0.0",
"tailwindcss": "^3.4.16",
"tailwindcss": "^3.4.17",
"tap-spot": "^1.1.2",
"unist-util-visit": "^5.0.0",
"webpack": "^5.97.1",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.0",
"webpack-merge": "^6.0.1",
"workbox-webpack-plugin": "^7.3.0",
"yarn-deduplicate": "^6.0.2"
},
"dependencies": {
"@docsearch/react": "^3.8.0",
"@docsearch/react": "^3.8.2",
"@react-spring/web": "^9.7.5",
"path-browserify": "^1.0.1",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-helmet-async": "^2.0.5",
"react-router-dom": "^6.28.0",
"react-tiny-popover": "5",
"react-use": "^17.5.1",
"react-visibility-sensor": "^5.0.2",
"react-icons": "^5.4.0",
"react-router-dom": "^7.1.1",
"react-tiny-popover": "8",
"react-tooltip": "^5.28.0",
"react-use": "^17.6.0",
"react-visibility-sensor": "^5.1.1",
"webpack-pwa-manifest": "^4.3.0",
"workbox-window": "^7.3.0"
},
Expand Down
Loading
Loading