Skip to content

Commit

Permalink
add tests examples
Browse files Browse the repository at this point in the history
  • Loading branch information
b-a-a-s committed May 9, 2023
1 parent 0e488e5 commit 385d182
Show file tree
Hide file tree
Showing 10 changed files with 2,335 additions and 3,034 deletions.
2 changes: 0 additions & 2 deletions .env

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ yarn-debug.log*
yarn-error.log*

components-lib
.env
**/.env

cypress/videos
cypress/screenshots

21 changes: 14 additions & 7 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
},
// component: {
// setupNodeEvents(on, config) {},
// specPattern: "src/**/*.test.{js,ts,jsx,tsx}",
// },

component: {
devServer: {
framework: 'next',
framework: 'create-react-app',
bundler: 'webpack',
},
},

e2e: {
setupNodeEvents(_on, _config) {
// implement node event listeners here
},
},
});

// const { defineConfig } = require('cypress')

// module.exports = defineConfig({
// })
34 changes: 34 additions & 0 deletions cypress/e2e/e2e.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// set timeout to 10 seconds
Cypress.config('defaultCommandTimeout', 10000);

describe('Main Page', () => {
it('visits the root url', () => {
cy.visit('/');
cy.get('h2').contains('Meeting');
});

it('can see Filter button and click it', () => {
cy.visit('/');
cy.get('button').contains('Filter').click();
});

it('can see Action button and click it', () => {
cy.visit('/');
cy.get('button').contains('Action').click();
});

it('can see Sort button and click it', () => {
cy.visit('/');
cy.get('button').contains('Sort').click();
});

it('can see Period button and click it', () => {
cy.visit('/');
cy.get('button').contains('Period').click();
});

it('can see New Meeting button and click it', () => {
cy.visit('/');
cy.get('button').contains('New Meeting').click();
});
});
6 changes: 6 additions & 0 deletions cypress/plugin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const injectDevServer = require('@cypress/react/plugins/react-scripts');

module.exports = (on, config) => {
injectDevServer(on, config);
return config;
};
37 changes: 37 additions & 0 deletions 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>
// }
// }
// }
1 change: 0 additions & 1 deletion functions/.env

This file was deleted.

Loading

0 comments on commit 385d182

Please sign in to comment.