Skip to content

Commit

Permalink
feat: add Dockerfile, Cypress, code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
aeworxet committed May 13, 2024
1 parent 67cd22f commit 7ae5c45
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/studio-next/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3001',
},
});
14 changes: 14 additions & 0 deletions apps/studio-next/cypress/e2e/studio-ui.spec.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('Studio UI spec', () => {
beforeEach(() => {
cy.visit('/');
});

it('Button "Settings" should be visible in the UI', () => {
cy.get('[data-testid="button-settings"]').should('be.visible');
});

it('Button "Settings" should display tooltip "Studio settings" on hover', () => {
cy.get('[data-testid="button-settings"]').trigger('mouseenter');
cy.contains('Studio settings').should('be.visible');
});
});
5 changes: 5 additions & 0 deletions apps/studio-next/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions apps/studio-next/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// 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<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions apps/studio-next/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// 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')
9 changes: 8 additions & 1 deletion apps/studio-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
"dev": "next dev -p 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"cy:e2e:chrome": "cypress run --e2e --browser chrome",
"cy:e2e:chromium": "cypress run --e2e --browser chromium",
"cy:e2e:edge": "cypress run --e2e --browser edge",
"cy:e2e:electron": "cypress run --e2e --browser electron",
"cy:e2e:firefox": "cypress run --e2e --browser firefox",
"cy:open": "cypress open"
},
"dependencies": {
"@asyncapi/avro-schema-parser": "^3.0.19",
Expand Down Expand Up @@ -68,6 +74,7 @@
"autoprefixer": "^10.4.13",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"cypress": "^13.8.1",
"eslint-config-next": "14.1.4",
"eslint-plugin-security": "^1.5.0",
"eslint-plugin-sonarjs": "^0.16.0",
Expand Down
1 change: 1 addition & 0 deletions apps/studio-next/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const Sidebar: FunctionComponent<SidebarProps> = () => {
className='flex text-gray-500 hover:text-white focus:outline-none border-box p-4'
type="button"
onClick={() => showModal(SettingsModal)}
data-testid="button-settings"
>
<VscSettingsGear className="w-5 h-5" />
</button>
Expand Down

0 comments on commit 7ae5c45

Please sign in to comment.