VOOZH about

URL: https://thenewstack.io/building-a-to-do-app-using-github-actions-playwright-next-js/

⇱ Building a To-Do App using GitHub Actions, Playwright, Next.js - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2022-12-12 13:00:37
Building a To-Do App using GitHub Actions, Playwright, Next.js
sponsor-thundra,sponsored-post-contributed,
CI/CD / DevOps / Serverless / Software Development

Building a To-Do App using GitHub Actions, Playwright, Next.js

A guide to building a modern web application with a continuous integration pipeline and monitoring it to catch potential errors before production.
Dec 12th, 2022 1:00pm by Burak Kantarci
👁 Featued image for: Building a To-Do App using GitHub Actions, Playwright, Next.js
Image via Pixabay.
Thundra sponsored this post.
In this article, we will build a comprehensive “to-do app” with APIs and end-to-end (E2E) tests using some of the modern stacks together. It will demonstrate how to build a modern web application by using a continuous integration (CI) pipeline and monitor the CI process to catch potential errors before introducing them to production. Here’s the modern stack used in this project:
  • Next.js to-do app for building the web application
  • Playwright for end-to-end testing
  • GitHub Actions for building the CI pipeline
  • Foresight for CI and test monitoring

Purpose of this Project

The need to create production applications blazingly fast is rapidly increasing in the tech world. Our motivation while creating this project was to contribute to the developer community with an end-to-end stack for a web application. We picked free tools so no one has to pay.

Expected Outcomes

We wanted to create a production-ready serverless sample web application in the simplest possible way. That’s why we chose Upstash to create a Next.js-based application. In the testing phase, we went with the Playwright framework because it makes it pretty easy to work in any browser and platform. We implemented JUnit and generated a test report with it. Deciding on a platform for building a CI pipeline was one of the least challenging decisions for us because GitHub Actions does that pretty well. And finally monitoring both our tests and CI pipelines was something we found pretty challenging. Although there are some tools in the market like Allure for test monitoring and Meercode for CI monitoring, these seemed not so useful at the end of the day. We decided to go with Foresight because it provides deep analytics for both tests and CI pipelines.
Foresight lets you monitor your GitHub Actions workflows, tests, and untested code changes on a single dashboard. It visualizes your GitHub Actions workflows by status, duration, and cost. It helps optimize build duration, enable more frequent deployments, boost productivity, and lower CI costs.
Learn More
The latest from Foresight

Setting up the To-Do App with Next.js

This project requires a Next.js application. If you already have Next.js configured in your system, you can use that. If not, we recommend using the example below. This guide was created by the Upstash team, and it is very minimalistic and easy to understand.

Setting up Tests with Playwright

Run the following command and initialize the Playwright. After quick configurations, you are ready to get started. `npm init playwright@latest`
  • You can either choose JavaScript or TypeScript.
  • Give a name to your tests folder.
  • To run tests on CI, just add a GitHub Actions workflow.
You will have the base Playwright setup after the installation is completed. You will see your test under the tests folder and under the .github folder you will see your GitHub Action `playwright.yml`.

Creating the E2E test

We want to ensure our APIs and user interactions are working properly. So we will add an E2E test, which will add a to-do item and complete it. Under the tests folder, you should create `add.spec.js` file and paste the following code:
// @ts-check
const { test, expect } = require('@playwright/test');
 
const TODO_ITEMS = [
 'buy some cheese',
 'feed the cat',
 'book a doctors appointment'
];
 
test.beforeEach(async ({ page }) => {
 await page.goto('https://localhost:3000/');
});
 
test('add a todo item', async ({ page }) => {
 
 var todoName = TODO_ITEMS[0];
 
 // Text input
 await page.locator('#todo').fill(todoName);
 await page.locator('#todo').press('Enter');
 
 // Make sure the list only has one todo item.
 await expect(page.locator('.Home_card__2SdtB')).toHaveText([
 todoName
 ]);
 
});
 
test('complete a todo item', async ({ page }) => {
 
 var todoName = TODO_ITEMS[0];
 
 // Text input
 await page.click(`.Home_card__2SdtB:has-text("buy some cheese")`);
 // Make sure the list only has one todo item.
 await expect(page.locator('.Home_card__2SdtB')).not.toHaveText([todoName]);
});

In order to run our tests one by one, disable the parallelization in `playwright.config.js`.
 /* Run tests in files in parallel */
 fullyParallel: false,
Then go to `package.json` and add a test script.
 "test": "playwright test"
You will be able to run the test by the `npm run test` command in your terminal and in the GitHub Actions. Run your test and check whether your configuration works correctly so far.

Creating a JUnit Report

To make sure of the health of our tests, we use test reports. JUnit reporter produces a JUnit-style XML report. This is essential for ensuring our to-do web app achieves an acceptable quality level. Add the following in the `playwright.config.js` file:
 reporter: [ ['junit', { outputFile: 'results.xml' }] ],
A file named as `results.xml` will be generated when you run your tests. The test reporter includes the error logs and messages when there is an error.

GitHub Actions Configuration

Push your code to a GitHub repository. The initial `playwright.yml` action will help us to run our test in every commit and pull request. Your configuration should look like this:
on:
 push:
 branches: [ main, master ]
 pull_request:
 branches: [ main, master ]
jobs:
 test:
 timeout-minutes: 60
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v2
 - uses: actions/setup-node@v2
 with:
 node-version: '14.x'
 - name: Install dependencies
 run: npm ci
 - name: Install Playwright Browsers
 run: npx playwright install --with-deps
 - name: Run Playwright tests
 run: npx playwright test
 - uses: actions/upload-artifact@v2
 if: always()
 with:
 name: playwright-report
 path: playwright-report/
 retention-days: 30
You will be able to see your workflow runs if your Action works. GitHub Action works flawlessly to automate the works you have done manually. You don’t need to run `npm run test` by yourself; GitHub Actions does it automatically when you commit a new code. However, GitHub Actions is not offering enough information about your tests and their performance. When they fail, you need to understand by finding them in a log pile in the workflow run details. We will use Foresight to monitor our tests. It is free for open source projects and requires a simple configuration to start.

Setting up Foresight for Monitoring

Configuring Foresight takes less than two minutes. All you need to do is set up an account, install Foresight’s GitHub app and watch the repository that you’ve initiated for this tutorial. After watching this repository, you need to update your YAML file. You can remove the last step and add Foresight’s test kit.
name: Playwright Tests
on:
 push:
 branches: [ main, master ]
 pull_request:
 branches: [ main, master ]
jobs:
 test:
 timeout-minutes: 60
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v2
 - uses: actions/setup-node@v2
 with:
 node-version: '14.x'
 - name: Install dependencies
 run: npm ci
 - name: Install Playwright Browsers
 run: npx playwright install --with-deps
 - name: Run Playwright tests
 run: npx playwright test
 - name: Foresight test kit
 if: success() || failure()
 uses: runforesight/foresight-test-kit-action@v1
 	with:
 api_key: ${{ secrets.FRS_PROD_API_KEY }}
 test_format: JUNIT
 test_framework: JEST
 test_path: ./results.xml
As you can see, we entered the format, framework and path fields by the configuration we’ve created above. This action will automatically send your test report to Foresight, and Foresight will analyze your tests in the most user-friendly way. After updating your YAML, your workflow will run automatically, and you will be able to see your workflow run results. The Foresight UI is similar to GitHub Actions. It gives you the ability to trace your CI workflow steps, gather all the metrics together, and monitor and debug your tests. You can learn more about Foresight from its documentation.

Summing up

That’s it! We created this project with the hope of helping the developer community by showcasing how easily and cost-free you can create a production-ready web application.
Thundra Foresight empowers developers to build successful CI pipelines by providing deep analytics and debugging capabilities. With observability into the CI process, Thundra Foresight helps optimize build duration, enable more frequent deployments, increase productivity, and lower CI costs.
Learn More
The latest from Thundra
TRENDING STORIES
Burak Kantarcic, director of product at Thundra, speaks and writes about DevOps, testing and product management.
Read more from Burak Kantarci
Thundra sponsored this post.
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: Pragma.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.