Git Product home page Git Product logo

monorepo-testing-workshop's Introduction

Monorepo testing with Vercel

Prerequisites

Make sure to have the following installed:

For part 2 of the workshop with Vercel, it's best to fork this repository

Installation

pnpm install

Running the application

pnpm dev

Workshop part 1

Task 1 (turbo.json)

  • Expand the turbo.json with a test script.
  • Ensure that caching is enabled.
  • Specify that changes in a .tsx or .ts file should result in a cache miss.
  • Run the pipeline using pnpm test.
  • Run the pipeline again; it should be much faster, indicating a FULL TURBO mode.
  • Make a modification in a .tsx or .ts file.
  • Run the pipeline again; this should result in a cache miss, causing the test to run again.

https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks

Task 2 (Playwright)

  • The monorepo contains 2 applications:
    • pizza-shop
    • test-automation
  • The test-automation application contains a contact page that is not present in the other application.
  • Write an E2E Playwright test to navigate to the contact page and click on the button.
  • Execute this test only for the test-automation application.
  • Run the test by running pnpm dev and pnpm e2e in separate terminal screens.

Task 3 (Bonus - Filtering)

Task 4 (Bonus - Atomic design)

  • Extract the button element from apps/test-automation/src/app/contact/page.tsx into a shared atoms UI element.

Task 5 (Bonus - Vitest)

  • Write a Vitest / react-testing-library component test for the other UI elements.

Workshop part 2

Task 6 (Setup Vercel / GitHub)

  • Make sure you have the base repository forked, or pushed to your personal GitHub.
  • Create a Vercel account and log in to the dashboard via GitHub.
  • Add a new project from the top right.
  • If you logged in via GitHub and you have the repository on that account you can simply import monorepo-testing-workshop
  • Vercel will recognize its a NextJS application, deploy it
  • Import / deploy both the pizza-shop as the test-automation application
  • Make a code change, and push it to the main branch, notice how both applications on Vercel getting a new deployment automatically.

Task 7 (Github actions Vercel preview)

  • Uncomment the GitHub pipeline in .github/workflows/playwright-ta.yml
  • Complete the pipeline by waiting for the deployment of the test-automation app
  • Use the following action

https://github.com/patrickedqvist/wait-for-vercel-preview

Task 8 (Bonus - Github actions Vercel preview)

  • Create a pipeline for the pizza-shop app

monorepo-testing-workshop's People

Contributors

tlolkema avatar turbobot-temp avatar mvdevries avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.