Skip to content
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

feat(e2e): Migrating e2e playwright tests for challeges/saas #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

2 participants