Skip to content

within()/I.switchTo() fails in specific case: Either name or url matcher should be specified #3880

@mirao

Description

@mirao

It works well in 3.5.3
It's related to #3846, CC: @kobenguyent
In 3.5.4 I'm getting ERROR locator.toLowerCase is not a function and in 3.5.5 I'm getting Either name or url matcher should be specified

What are you trying to achieve?

The scenario should pass. Unfortunately I don't have a simplistic case, so I used a scenario from our production tests.

What do you get instead?

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

  Teacher: Verify the kit's content
 › [Dir] /home/mirao/workspace/codeceptjs/tests/s4e
    I click #LESSON_MENU_KIT_CONTENT
  › <screenshotOnFail> Test failed, try to save a screenshot
  › Screenshot is saving to /home/mirao/workspace/codeceptjs/tests/s4e/output/Teacher__V_1695287237.failed.png
  ✖ FAILED in 2623ms
...
1) KitLesson
       Teacher: Verify the kit's content:
     Either name or url matcher should be specified
      at assert (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]/node_modules/playwright-core/lib/utils/debug.js:29:21)
      at Page.frame (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]/node_modules/playwright-core/lib/client/page.js:195:23)
      at Playwright.switchTo (/home/mirao/workspace/codeceptjs/node_modules/.pnpm/[email protected]_e6w65ce3sp4lg2q5fzcoe2hnqu/node_modules/codeceptjs/lib/helper/Playwright.js:2573:32)

Provide test source code if related

function verifyKitLessonGlossary() {
    within(
        {
            frame: HtmlBodyPage.iFrame, // "(//iframe)[last()]"
        },
        () => {
            I.see(glossaryName, kitContentFragment.glossaryTerm); // locate(".glossary-term")
            // Open glossary popup
            I.click(kitContentFragment.glossaryTerm);
            // Verify content of popup
            I.see(glossaryName, glossaryTermInfoFragment.glossaryTermInfo);
            I.see(glossaryText, glossaryTermInfoFragment.glossaryTermInfo);
        }
    );
}

Scenario("Teacher: Verify the kit's content", () => {
    I.click(iPlannerPage.kitView.kitContent);

    verifyKitLessonGlossary();
});

Details

  • CodeceptJS version: 3.5.5
  • NodeJS Version: 18.15
  • Operating System: Ubuntu 22.04
  • Playwright 1.37.1

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