Skip to content

Add e2e test for building apps with Postgres datasource#177

Merged
kapicic merged 8 commits intomainfrom
stevan/eng-1046
Sep 26, 2025
Merged

Add e2e test for building apps with Postgres datasource#177
kapicic merged 8 commits intomainfrom
stevan/eng-1046

Conversation

@kapicic
Copy link
Contributor

@kapicic kapicic commented Sep 22, 2025

📋 Pull Request Summary

🔗 Related Issues

  • Fixes #
  • Relates to #

📝 Changes Made

🧪 Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Testing Details:

📚 Documentation

  • Code is self-documenting with clear variable/function names
  • Added/updated JSDoc comments for public APIs
  • Updated README.md if needed
  • Updated other documentation files
  • No documentation changes needed

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test improvements

🚨 Breaking Changes

  • This PR introduces breaking changes
  • Migration guide provided
  • Deprecation warnings added

Breaking Change Details:

📸 Screenshots/Videos

📋 Additional Notes

@kapicic kapicic self-assigned this Sep 22, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kapicic, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new end-to-end test to validate the functionality of building applications using a PostgreSQL data source. The test simulates the user journey from creating a new PostgreSQL data source with a connection string provided via environment variables, to generating a 'users dashboard' application based on that data source, and finally asserting that the application is correctly rendered within the UI. This ensures the core integration between the application builder and PostgreSQL data sources remains robust.

Highlights

  • New E2E Test for PostgreSQL Data Source: A new end-to-end test has been added to validate the complete flow of creating an application using a PostgreSQL data source. This test covers data source creation, selection, and app generation.
  • PostgreSQL App Creation Workflow Verified: The test specifically verifies that a 'users dashboard' application can be successfully built and rendered after configuring a PostgreSQL data source, ensuring core functionality.
  • Environment Variable Integration for Tests: The E2E test suite now uses dotenv to load environment variables, specifically requiring TEST_POSTGRES_URL for the PostgreSQL connection string, making the tests more configurable and secure.
  • Dependency Updates: The package.json and package-lock.json files in the E2E test directory have been updated to include dotenv and @types/node as development dependencies.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new end-to-end test for creating an application with a PostgreSQL data source. The changes include adding necessary dependencies (dotenv, @types/node), configuring Playwright to use environment variables, and implementing the test spec file. My review focuses on improving the new test's robustness, performance, and readability by suggesting changes to avoid anti-patterns like static waits, simplifying complex code, and optimizing element selection logic.

import { navigateToDataSourceForm, navigateToSettings, performInitialSetup } from '../helpers/setup';

test.describe('PostgreSQL Data Source App Creation Flow', () => {
test('Create PostgreSQL data source and build users dashboard app', async ({ page }: { page: Page }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The type annotation for the page object is redundant. Playwright's test runner automatically infers the type of page as Page from the test function's arguments. Removing the explicit type makes the code cleaner and easier to maintain.

Suggested change
test('Create PostgreSQL data source and build users dashboard app', async ({ page }: { page: Page }) => {
test('Create PostgreSQL data source and build users dashboard app', async ({ page }) => {

Comment on lines +131 to +133
const frame = await iframe
.elementHandle()
.then((handle: ElementHandle<SVGElement | HTMLElement> | null) => handle?.contentFrame());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The way the iframe's content frame is accessed is unnecessarily complex. The iframe.contentFrame() method already returns a promise that resolves to the frame. You can directly await it for cleaner and more readable code.

      const frame = await iframe.contentFrame();

Comment on lines +150 to +160
for (const selector of dashboardElements) {
try {
const element = frame.locator(selector);
await element.waitFor({ state: 'visible', timeout: 10000 });
console.log(`✅ Found dashboard element: ${selector}`);
foundDashboardElement = true;
break;
} catch {
// Continue to next selector
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation to find a dashboard element iterates through a list of selectors and waits for each one sequentially with a 10-second timeout. This can be inefficient and slow down the test. A better approach is to combine all selectors into a single locator and wait for the first matching element to become visible. This simplifies the code and can make the test faster. While this loses the log of which specific selector matched, the trade-off for performance and simplicity is worthwhile.

      const combinedSelector = dashboardElements.join(', ');
      try {
        await frame.locator(combinedSelector).first().waitFor({ state: 'visible', timeout: 30000 });
        console.log(`✅ Found a dashboard element.`);
        foundDashboardElement = true;
      } catch {
        // Continue to next selector
      }

@kapicic kapicic merged commit bf3d1d6 into main Sep 26, 2025
5 checks passed
@kapicic kapicic deleted the stevan/eng-1046 branch September 26, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants