Skip to content

Conversation

@realkamran
Copy link
Collaborator

@realkamran realkamran commented Sep 25, 2023

Checklist:

Page URL: https://www.freecodecamp.org/learn/front-end-development-libraries/sass/use-for-to-create-a-sass-loop

Closes #XXXXX

@realkamran realkamran self-assigned this Sep 25, 2023
@Ahmadkashif
Copy link
Member

Solid attempt @realkamran

Can you please help us understand this better by identifying the page URL and the source code for the DOM element you are testing here?

});

test('should render the sass preview', async () => {
const frame = await Promise.resolve(page.mainFrame());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this line we are using Promise.resolve() to avoid the TS error Unexpected 'await' of a non-Promise (non-"Thenable") value. and page.mainFrame() gets the iframe, here is the doc reference for that https://playwright.dev/docs/api/class-frame#:~:text=%3B%0A%20%20dumpFrameTree(-,page.mainFrame(),-%2C%20%27%27)

await frame.isVisible('.text-2');
await frame.isVisible('.text-3');
await frame.isVisible('.text-4');
await frame.isVisible('.text-5');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After getting the iframe, here we are checking five paragraphs of the containing some text (i.e "Hello") is visible in the page.

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 this pull request may close these issues.

3 participants