Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Fixed the login tests

Matt Roberts20795c55ee63
diff --git a/Makefile b/Makefile
index 2be0e4d7a..63591484f 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,15 @@ test-e2e-server: ## Run all E2E tests
test-e2e-ui: ## Run all E2E tests
npx cucumber-js e2e/features/ui/**/*.feature --require-module ts-node/register --require 'e2e/**/*.ts' --publish-quiet
+test-e2e-ui-headed: ## Run all E2E tests with visible browser
+ HEADED=true npx cucumber-js e2e/features/ui/**/*.feature --require-module ts-node/register --require 'e2e/**/*.ts' --publish-quiet
+
+test-e2e-ui-scenario: ## Run specific E2E test scenario (use NAME="scenario name")
+ npx cucumber-js e2e/features/ui/**/*.feature --require-module ts-node/register --require 'e2e/**/*.ts' --publish-quiet --name "$(NAME)"
+
+test-e2e-ui-scenario-headed: ## Run specific E2E test scenario with visible browser (use NAME="scenario name")
+ HEADED=true npx cucumber-js e2e/features/ui/**/*.feature --require-module ts-node/register --require 'e2e/**/*.ts' --publish-quiet --name "$(NAME)"
+
##@ Running (Watch Mode)
diff --git a/e2e/setup.ts b/e2e/setup.ts
index 4ff69bc9d..a14f4e767 100644
--- a/e2e/setup.ts
+++ b/e2e/setup.ts
@@ -11,8 +11,8 @@ type BrowserName = "chromium" | "firefox" | "webkit"
BeforeAll({ timeout: 30 * 1000 }, async function () {
const name = (process.env.BROWSER || "chromium") as BrowserName
browser = await playwright[name].launch({
- headless: true,
- slowMo: 10,
+ headless: process.env.HEADED !== "true",
+ slowMo: process.env.HEADED === "true" ? 100 : 10,
})
if (!tenantName) {
diff --git a/e2e/step_definitions/home.steps.ts b/e2e/step_definitions/home.steps.ts
index e03eca7c0..ac5f6dead 100644
--- a/e2e/step_definitions/home.steps.ts
+++ b/e2e/step_definitions/home.steps.ts
@@ -52,7 +52,7 @@ Then("I should see the name field", async function (this: FiderWorld) {
})
Given("I click continue", async function () {
- await this.page.click("button[type='submit']")
+ await this.page.getByRole("button", { name: "Sign up" }).click()
})
Given("I click submit your feedback", async function () {
@@ -72,8 +72,8 @@ Given("I enter the confirmation code", async function (this: FiderWorld) {
const code = await getLatestCodeSentTo(userEmail)
// Enter the code in the UI
- await this.page.type("#input-code", code)
- await this.page.click("button[type='submit']")
+ await this.page.fill("#input-code", code)
+ await this.page.getByRole("button", { name: "submit" }).click()
// Wait for navigation after successful code verification
await this.page.waitForLoadState("networkidle")
@@ -85,11 +85,11 @@ Then("I should see the new post modal", async function (this: FiderWorld) {
})
Given("I enter my name as {string}", async function (this: FiderWorld, name: string) {
- await this.page.type("#input-name", name)
+ await this.page.fill("#input-name", name)
})
Given("I click submit", async function () {
- await this.page.click("button[type='submit']")
+ await this.page.getByRole("button", { name: "submit" }).click()
})
Then("I should see {string} as the draft post title", async function (this: FiderWorld, title: string) {
diff --git a/e2e/step_definitions/user.steps.ts b/e2e/step_definitions/user.steps.ts
index 7efe85103..83469fce2 100644
--- a/e2e/step_definitions/user.steps.ts
+++ b/e2e/step_definitions/user.steps.ts
@@ -14,13 +14,13 @@ Given("I sign in as {string}", async function (this: FiderWorld, userName: strin
const userEmail = `${userName}-${this.tenantName}@fider.io`
await this.page.click(".c-menu .uppercase.text-sm")
- await this.page.type(".c-signin-control #input-email", userEmail)
+ await this.page.fill(".c-signin-control #input-email", userEmail)
await this.page.click(".c-signin-control .c-button--primary")
// Get the code from email and enter it
const code = await getLatestCodeSentTo(userEmail)
- await this.page.type("#input-code", code)
- await this.page.click("button[type='submit']")
+ await this.page.fill("#input-code", code)
+ await this.page.getByRole("button", { name: "submit" }).click()
// Wait for navigation after successful code verification
await this.page.waitForLoadState("networkidle")