From 2ac4b192bb2a378821e71bf73bd762a90f1daa79 Mon Sep 17 00:00:00 2001 From: David Orozco Date: Thu, 24 Jul 2025 10:52:32 -0500 Subject: [PATCH] add gets --- playwright-e2e/.gitignore | 7 +++++++ playwright-e2e/package.json | 14 ++++++++++++++ playwright-e2e/playwright.config.ts | 29 +++++++++++++++++++++++++++++ playwright-e2e/tests/main.spec.ts | 29 +++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 playwright-e2e/.gitignore create mode 100644 playwright-e2e/package.json create mode 100644 playwright-e2e/playwright.config.ts create mode 100644 playwright-e2e/tests/main.spec.ts diff --git a/playwright-e2e/.gitignore b/playwright-e2e/.gitignore new file mode 100644 index 0000000..58786aa --- /dev/null +++ b/playwright-e2e/.gitignore @@ -0,0 +1,7 @@ + +# Playwright +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ diff --git a/playwright-e2e/package.json b/playwright-e2e/package.json new file mode 100644 index 0000000..693664f --- /dev/null +++ b/playwright-e2e/package.json @@ -0,0 +1,14 @@ +{ + "name": "playwright-e2e", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": {}, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@playwright/test": "^1.54.1", + "@types/node": "^24.1.0" + } +} diff --git a/playwright-e2e/playwright.config.ts b/playwright-e2e/playwright.config.ts new file mode 100644 index 0000000..e4ee5bd --- /dev/null +++ b/playwright-e2e/playwright.config.ts @@ -0,0 +1,29 @@ +import { defineConfig, devices } from "@playwright/test"; + +const BASE_URL = `http://frontend.${process.env.HOTROD_NAMESPACE}:8080`; + +export default defineConfig({ + testDir: "./tests", + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 0 : 0, + workers: process.env.CI ? 1 : undefined, + reporter: [["html", { open: "never" }]], + use: { + baseURL: BASE_URL, + trace: "on", + video: "on", + extraHTTPHeaders: { + baggage: `sd-routing-key=${process.env.SIGNADOT_ROUTING_KEY}`, + }, + }, + projects: [ + { + name: "chromium", + use: { + ...devices["Desktop Chrome"], + baseURL: BASE_URL, + }, + }, + ], +}); diff --git a/playwright-e2e/tests/main.spec.ts b/playwright-e2e/tests/main.spec.ts new file mode 100644 index 0000000..24f3c02 --- /dev/null +++ b/playwright-e2e/tests/main.spec.ts @@ -0,0 +1,29 @@ +import { test, expect } from "@playwright/test"; + +test.describe("Request a ride", () => { + test("check route resolve routes", async ({ page }) => { + await page.goto("/"); + await page.waitForLoadState(); + + await page.getByRole("combobox").first().selectOption("1"); + await page.getByRole("combobox").nth(1).selectOption("123"); + await page.getByRole("button", { name: "Request Ride" }).click(); + + await expect( + page.locator("//div[p[2][contains(text(), 'route')]]/p[4]"), + ).toHaveText("Resolving routes") + }); + + test("check driver series", async ({ page }) => { + await page.goto("/"); + await page.waitForLoadState(); + + await page.getByRole("combobox").first().selectOption("1"); + await page.getByRole("combobox").nth(1).selectOption("123"); + await page.getByRole("button", { name: "Request Ride" }).click(); + + await expect( + page.locator("//div[p[2][contains(text(), 'driver')]]/p[4]").last(), + ).toHaveText(/.*T7\d{5}C.*/); + }); +});