Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mirao opened this issue Sep 26, 2023 · 0 comments · Fixed by #3892
Closed

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

mirao opened this issue Sep 26, 2023 · 0 comments · Fixed by #3892

Comments

@mirao
Copy link
Contributor

mirao commented Sep 26, 2023

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",
};
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 a pull request may close this issue.

1 participant