diff --git a/packages/apps/docs/cypress.config.js b/packages/apps/docs/cypress.config.js deleted file mode 100644 index 7bd177cbea2..00000000000 --- a/packages/apps/docs/cypress.config.js +++ /dev/null @@ -1,14 +0,0 @@ -import { defineConfig } from 'cypress'; - -export default defineConfig({ - e2e: { - baseUrl: 'http://localhost:3000', - retries: { - runMode: 3, - }, - viewportHeight: 1080, - viewportWidth: 1920, - video: false, - screenshotOnRunFailure: false, - }, -}); diff --git a/packages/apps/docs/cypress/e2e/consent.cy.ts b/packages/apps/docs/cypress/e2e/consent.cy.ts deleted file mode 100644 index fc5b222853d..00000000000 --- a/packages/apps/docs/cypress/e2e/consent.cy.ts +++ /dev/null @@ -1,39 +0,0 @@ -const COOKIECONSENTNAME = 'cookie_consent'; -describe('Consent box', () => { - beforeEach(() => { - cy.visit('/docs/__tests/pact/atom-sdk'); - }); - - afterEach(() => { - window.localStorage.clear(); - }); - - it('checks that consent modal is visible', () => { - cy.get('[data-cy="modal-background"]').should('exist'); - cy.get('[data-cy="modal"]').should('be.visible').contains('Cookie consent'); - cy.get('[data-cy="modal"]').find('button').should('have.length', 3); - }); - - describe('no consent set', () => { - beforeEach(() => { - window.localStorage.clear(); - }); - it('checks that the consent cookie is not set on start', () => { - const cookieValue = window.localStorage.getItem(COOKIECONSENTNAME); - cy.expect(cookieValue).to.equal(null); - cy.get('[data-cy="modal"]').should('be.visible'); - }); - - describe('no consent shown', () => { - beforeEach(() => { - window.localStorage.setItem(COOKIECONSENTNAME, 'true'); - }); - it('checks that modal is not shown, if COOKIECONSENTNAME is already set', () => { - cy.wait(500); - cy.get('[data-cy="modal"]').should('not.exist'); - }); - }); - }); -}); - -export {}; diff --git a/packages/apps/docs/cypress/e2e/layoutfull.cy.ts b/packages/apps/docs/cypress/e2e/layoutfull.cy.ts deleted file mode 100644 index 71344ae1d20..00000000000 --- a/packages/apps/docs/cypress/e2e/layoutfull.cy.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { closeConsentModal } from '../utils'; - -describe('full layout', () => { - const aside = () => cy.get('[data-cy="aside"]'); - const menu = () => cy.get('[data-cy="menu"]'); - const breadcrumbs = () => cy.get('[data-cy="breadcrumbs"]'); - - beforeEach(() => { - cy.visit('/docs/__tests/pact/atom-sdk'); - closeConsentModal(); - }); - describe('desktop', () => { - it('shows the breadcrumbs with icon', () => { - breadcrumbs().find('li').should('have.length', 3); - breadcrumbs().find('svg').should('exist'); - }); - it('shows the left sidemenu', () => { - cy.percySnapshot('test'); - menu().should('be.visible'); - cy.get('[data-cy="hamburgermenu"]').should('not.be.visible'); - }); - - it('shows the aside menu', () => { - aside().should('be.visible'); - aside().find('ul:first').children('li').should('have.length', 3); - - // first li child ("section 1") will not have children - aside() - .find('ul:first') - .children('li') - .first() - .children('ul') - .should('not.exist'); - - // second li child ("section 2") will have 2 children - aside() - .find('ul:first > li:nth-child(2)') - .children('ul') - .should('exist') - .children('li') - .should('have.length', 2); - - // second li child ("section 2.2") will have 1 children - aside() - .find('ul:first > li:nth-child(2) > ul > li:nth-child(2)') - .children('ul') - .should('exist') - .children('li') - .should('have.length', 1); - }); - - it('deeplink on the page when an option of the aside menu is clicked', () => { - cy.location().should((loc) => { - expect(loc.hash).to.eq(''); - }); - aside().find('ul:first > li:nth-child(3) ').click(10, 10); - cy.location().should((loc) => { - expect(loc.hash).to.eq('#section-3'); - }); - }); - }); - - describe('mobile', () => { - const hamburgerMenu = () => cy.get('[data-cy="hamburgermenu"]'); - const secondMenu = () => menu().get('[data-cy="sidemenu-submenu"]'); - const mainMenu = () => menu().get('[data-cy="sidemenu-main"]'); - const openMenu = () => { - hamburgerMenu().click(); - }; - beforeEach(() => { - cy.viewport(640, 720); - }); - - describe('test the functionality of the sidemenu', () => { - const ListMenu = () => secondMenu().find('ul > li:nth-child(2)'); - it('shows the left menu', () => { - openMenu(); - - const Atom = () => ListMenu().find('ul > li:nth-child(4)'); - const QuickStart = () => Atom().find(' > ul > li > a[data-active]'); - - // check if everything is there - menu().find('h5').contains('Test'); - secondMenu().find('ul:first-child > li').should('have.length', 4); - Atom().find(' > button').contains('Atom SDK'); - - QuickStart().contains('Quickstart'); - - Atom() - .find(' > ul') - .should('be.visible') - .children('li') - .should('have.length', 2); - }); - - it('opens and closes the basics menu when clicked', () => { - openMenu(); - const basics = () => ListMenu().find('li:nth-child(3)'); - basics().contains('Basics'); - basics().find('ul').should('not.be.visible'); - basics().click(); - basics().find('ul').should('be.visible'); - basics() - .children('ul') - .children('li > [data-active="true"]') - .should('have.length', 0); - basics().children('ul').children('li').should('have.length', 2); - basics().children('ul').children('li').eq(1).click(); - basics() - .children('ul') - .find('> li > [data-active="true"]') - .should('have.length', 1) - .first() - .contains('Build-in Functions'); - }); - - it('shows the main menu when "Pact" backbutton is clicked', () => { - openMenu(); - menu().find('h5').contains('Test').click(); - menu().find('h5').contains('Kadena Docs'); - - mainMenu().find('ul > li:last-child').contains('Test').click(); - - menu().find('h5').contains('Test'); - }); - it('opens a new page when Chainweb is clicked in the main menu', () => { - openMenu(); - menu().find('h5').contains('Test').click(); - mainMenu().find('ul').children('li:nth-child(3)').click(); - cy.wait(1000); - cy.percySnapshot('test'); - }); - }); - }); -}); - -export {}; diff --git a/packages/apps/docs/cypress/e2e/layoutlanding.cy.ts b/packages/apps/docs/cypress/e2e/layoutlanding.cy.ts deleted file mode 100644 index 1bd63b3d519..00000000000 --- a/packages/apps/docs/cypress/e2e/layoutlanding.cy.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { closeConsentModal } from '../utils'; - -describe('landing page layout', () => { - const menu = () => cy.get('[data-cy="menu"]'); - const header = () => cy.get('[data-cy="titleheader"]'); - beforeEach(() => { - cy.visit('/docs/__tests/chainweb'); - closeConsentModal(); - }); - - describe('desktop', () => { - it('does not have an asidemenu', () => { - cy.percySnapshot('test'); - cy.get('[data-cy="aside"]').should('not.exist'); - }); - - it('shows the sidemenu', () => { - menu().should('exist'); - menu() - .get('[data-cy="sidemenu-submenu"]') - .find('ul:first') - .children() - .should('have.length', 4); - }); - - it('shows the sidemenu with its own children', () => { - menu().should('exist'); - }); - - it('shows the title header', () => { - menu().should('be.visible'); - header().should('be.visible'); - header().find('h1').contains('Chainweb'); - header() - .find('h5') - .contains( - 'The safest, most user-friendly language for smart contracts', - ); - - header().find('svg').should('exist'); - - cy.get('header').first().find('nav > ul > li:last-child').click(); - header().find('h1').contains('Pact'); - }); - }); -}); diff --git a/packages/apps/docs/cypress/e2e/subscribe.cy.ts b/packages/apps/docs/cypress/e2e/subscribe.cy.ts deleted file mode 100644 index 870ad729306..00000000000 --- a/packages/apps/docs/cypress/e2e/subscribe.cy.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { IResponse } from '../../src/pages/api/subscribe'; -import { closeConsentModal } from '../utils'; - -describe('Subscribe to mailList', () => { - const subscribe = () => cy.get('[data-cy="subscribe"]'); - const getData = (data: IResponse<{}>) => { - cy.intercept( - { - method: 'POST', // Route all GET requests - url: '/api/subscribe', - }, - data, // and force the response to be: [] - ).as('postSubcribe'); // and assign an alias - }; - - beforeEach(() => { - cy.visit('/docs/__tests/pact/atom-sdk'); - closeConsentModal(); - }); - - it('submit a correct email, happy path', () => { - getData({ - status: 200, - message: 'Thank you for subscribing', - }); - - cy.percySnapshot('test'); - subscribe().should('be.visible'); - - subscribe() - .find('input[type="email"]') - .type('he-man@masteroftheuniverse.com{enter}', { delay: 10 }); - - subscribe().find('input[type="email"]').should('not.exist'); - - subscribe().contains('Thank you for subscribing'); - }); - - it('submit a correct email, breaks because of something wrong in BE', () => { - getData({ - status: 500, - message: 'Something went wrong', - }); - - subscribe() - .find('input[type="email"]') - .type('he-man@masteroftheuniverse.com{enter}', { delay: 10 }); - - subscribe().find('input[type="email"]').should('exist'); - subscribe().contains('Something went wrong'); - }); - - it('type a invalid email and the submit button should be disabled. and not submit', () => { - getData({ - status: 200, - message: 'Thank you for subscribing', - }); - - subscribe() - .find('input[type="email"]') - .type('!!skeletor@thundercars.com', { delay: 10 }); - subscribe() - .find('button[type="submit"]') - .should('have.attr', 'disabled', 'disabled'); - }); -}); - -export {}; diff --git a/packages/apps/docs/cypress/support/commands.ts b/packages/apps/docs/cypress/support/commands.ts deleted file mode 100644 index d3411353729..00000000000 --- a/packages/apps/docs/cypress/support/commands.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -// -// declare global { -// namespace Cypress { -// interface Chainable { -// login(email: string, password: string): Chainable -// drag(subject: string, options?: Partial): Chainable -// dismiss(subject: string, options?: Partial): Chainable -// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable -// } -// } -// } -import '@percy/cypress'; - -export {}; diff --git a/packages/apps/docs/cypress/support/e2e.ts b/packages/apps/docs/cypress/support/e2e.ts deleted file mode 100644 index 598ab5f0d7f..00000000000 --- a/packages/apps/docs/cypress/support/e2e.ts +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/e2e.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands'; - -// Alternatively you can use CommonJS syntax: -// require('./commands') diff --git a/packages/apps/docs/cypress/tsconfig.json b/packages/apps/docs/cypress/tsconfig.json deleted file mode 100644 index 6005415f4f9..00000000000 --- a/packages/apps/docs/cypress/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "baseUrl": "./", - "sourceMap": false, - "inlineSourceMap": true, - "types": ["cypress", "node", "./support"] - } -} diff --git a/packages/apps/docs/cypress/utils.ts b/packages/apps/docs/cypress/utils.ts deleted file mode 100644 index 2f682b465eb..00000000000 --- a/packages/apps/docs/cypress/utils.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const closeConsentModal = () => { - cy.get('[data-cy="modal-background"]', { timeout: 10000 }).click({ - x: 10, - y: 10, - force: true, - }); -}; diff --git a/packages/apps/docs/package.json b/packages/apps/docs/package.json index 25fcae0360e..74e5e81b29a 100644 --- a/packages/apps/docs/package.json +++ b/packages/apps/docs/package.json @@ -16,10 +16,6 @@ "build:scripts": "tsx ./src/scripts/build.ts", "build:storybook": "pnpm run build:scripts && storybook build", "chromatic": "chromatic -b build:storybook", - "cypress:ci": "NEXT_PUBLIC_APP_DEV=test start-server-and-test dev http://localhost:3000 cypress:run", - "cypress:cilocal": "NEXT_PUBLIC_APP_DEV=test start-server-and-test dev http://localhost:3000 cypress:open", - "cypress:open": "percy exec -- cypress open", - "cypress:run": "percy exec -- cypress run", "dev": "pnpm run build:scripts && next dev", "format": "pnpm run --sequential /^format:.*/", "format:lint": "pnpm run lint:src --fix", @@ -74,7 +70,6 @@ "@kadena-dev/lint-package": "workspace:*", "@kadena-dev/shared-config": "workspace:*", "@percy/cli": "~1.24.0", - "@percy/cypress": "~3.1.2", "@rushstack/eslint-config": "~3.3.0", "@storybook/addon-a11y": "^7.4.0", "@storybook/addon-actions": "^7.4.0", @@ -98,7 +93,6 @@ "@vanilla-extract/webpack-plugin": "2.3.1", "chalk": "^5.2.0", "chromatic": "6.20.0", - "cypress": "~12.12.0", "dotenv": "~16.0.3", "eslint": "^8.45.0", "log-update": "^5.0.1",