`I.waitForURL()` does not fail the test when its timeout happens

Abierto
#4,346 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
32/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
playwright, typescript
Área
testing-qa

Línea de trabajo

Reproduce el escenario de playground.ts con el healer de heal.ts y, después, sigue el punto de entrada I.waitForURL en el Playwright Helper y cómo se informa de su timeout. Se considera terminado cuando el timeout hace que falle el escenario, impide que se ejecuten el clic posterior y el healer, y conserva la salida de error relevante.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

stale
What are you trying to achieve?

Wait for the page to navigate to a certain URL and fail the test if it doesn't navigate within the defined timeout

What do you get instead?

The test does not fail. As per the source code, we should never get to I.click("#fake-id");, but we do. Also, In the below source code, the log after I.waitForURL() is never printed. Where does it disappear to? The log that's printed is the one that's within the healer, HEALING A FAILED CLICK STEP:#fake-id.

Provide test source code if related

# Playground.feature

Feature: Play around
  Scenario: Playground
    Given I want to test healers
// playground.ts

Given("I want to test healers", () => {
  I.amOnPage("https://github.com/codeceptjs/CodeceptJS/issues");
  I.say("before waitForURL");
  I.waitForURL("https://fake-url", {
    timeout: 10000,
    waitUntil: "load"
  });

  I.say("after waitForURL");
  I.click("#fake-id");
});
// heal.ts

const { heal, ai } = require("codeceptjs");

heal.addRecipe("waitForVisibleThenClick", {
  priority: 1,
  steps: [
    "click"
  ],
  fn: async ({ step }) => {
    const locator = step.args[0];

    return ({ I }) => {
      I.say("HEALING A FAILED CLICK STEP:" + locator);

      I.waitForVisible(locator, 9);
      I.click(locator);
    };
  },
});

This is what is displayed on the logs after the test run:

Play around --
  Playground
   Given I want to test healers ""
   before waitForURL <--------------------------------------------- see here
    I say "HEALING A FAILED CLICK STEP:#fake-id" <----------------- and here
   HEALING A FAILED CLICK STEP:#fake-id  <------------------------- and here
    I wait for visible "#fake-id", 9
  × FAILED in 29095ms


-- FAILURES:

  1) Play around
       Playground:
     element (#fake-id) still not visible after 9 sec
locator.waitFor: Timeout 9000ms exceeded.
Call log:
  - waiting for locator('#fake-id').first() to be visible

  Error: element (#fake-id) still not visible after 9 sec
  locator.waitFor: Timeout 9000ms exceeded.
  Call log:

  Scenario Steps:
  - I.waitForURL("https://fake-url", {"timeout":10000,"waitUntil":"load"}) at .\tests\steps\playground.ts:21:5
  - I.say("before waitForURL") at .\tests\steps\playground.ts:20:5
  - I.amOnPage("https://github.com/codeceptjs/CodeceptJS/issues") at .\tests\steps\playground.ts:19:5

Details
  • CodeceptJS version: 3.6.2
  • NodeJS Version: 20.12.2
  • Operating System: Windows 11
  • Helper: Playwright Helper
  • Configuration file:
require('./heal')

export const config: CodeceptJS.MainConfig = {
  output: './output',
  helpers: {
    Playwright: {
      url: "https://github.com/codeceptjs/CodeceptJS/issues",
      show: false,
      browser: 'chromium'
    }
  },
  gherkin: {
    features: ["./tests/**/features/Playground.feature"],
    steps: "./tests/**/steps/*.ts"
    // steps: ["./stock_take_service/steps/given.ts", "./stock_take_service/steps/when.ts", "./stock_take_service/steps/then.ts"]
  },
  include: {
    I: './steps_file',
  },
  plugins: {
    heal: {
      enabled: true
    }
  },
  name: 'playground'
}

Lenguaje dominante
JavaScript
Estrellas
4.2k
Forks
756
Merge medio
2 d 9 h
PR fusionados (30 d)
16

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codeceptjs/CodeceptJS

Todos los issues de codeceptjs/CodeceptJS

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.