Skip to content

within()/I.switchTo(): Can't find text using "I.see(text)" in iframe #3891

@mirao

Description

@mirao

It's a regression. The test passes in 3.5.3 and fails in 3.5.5.

What are you trying to achieve?

The test should pass

What do you get instead?

Provide console output if related. Use --verbose mode for more details.

$ codeceptjs run My_test.ts --debug
CodeceptJS v3.5.5 #StandWithUkraine
Using test root "/home/mirao/workspace/codeceptjs/tests/my"
Helpers: Playwright
Plugins: screenshotOnFail

My --
 › [Session] Starting singleton browser session
  test something
    I am on page "https://csreis.github.io/tests/cross-site-iframe.html"
    › [Browser:Error] Failed to load resource: the server responded with a status of 404 ()
    I switch to "iframe#frame1"
    I see "Initial page", "body"
    I see "Initial page"<screenshotOnFail> Test failed, try to save a screenshot
 › Screenshot is saving to /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png
  ✖ FAILED in 481ms


-- FAILURES:

  1) My
       test something:

      expected web application to include "Initial page"
      + expected - actual

      -Cross-site iframe test Frame 1: Go cross-site (simple page) Go cross-site (complex page) Go same-site
      +Initial page
      
  
  
  Scenario Steps:
  - I.see("Initial page") at Test.<anonymous> (./My_test.ts:7:7)
  - I.see("Initial page", "body") at Test.<anonymous> (./My_test.ts:6:7)
  - I.switchTo("iframe#frame1") at Test.<anonymous> (./My_test.ts:5:7)
  - I.amOnPage("https://csreis.github.io/tests/cross-site-iframe.html") at Test.<anonymous> (./My_test.ts:4:7)
  
  Artifacts:
  - screenshot: /home/mirao/workspace/codeceptjs/tests/my/output/test_something.failed.png


  FAIL  | 0 passed, 1 failed   // 1s
Run with --verbose flag to see complete NodeJS stacktrace

It looks like the text is being searched outside the frame.
Searching using I.see(text, element) works well.

Provide test source code if related

Feature("My");

Scenario("test something", ({ I }) => {
    I.amOnPage("https://csreis.github.io/tests/cross-site-iframe.html");
    I.switchTo("iframe#frame1");
    I.see("Initial page", "body");
    I.see("Initial page");
});

Details

  • CodeceptJS version: 3.5.5
  • NodeJS Version: 18.15
  • Operating System: Ubuntu 22.04
  • Playwright 1.37.1
  • Configuration file:
export const config: CodeceptJS.MainConfig = {
    tests: "./*_test.ts",
    output: "./output",
    helpers: {
        Playwright: {
            browser: "chromium",
            url: "http://localhost",
            show: true,
        },
    },
    name: "my",
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions