Skip to content

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

Open
realkamran wants to merge 1 commit into
mainfrom
e2e-migrating-challenges-saas-tests
Open

feat(e2e): Migrating e2e playwright tests for challeges/saas#15
realkamran wants to merge 1 commit into
mainfrom
e2e-migrating-challenges-saas-tests

Conversation

@realkamran

@realkamran realkamran commented Sep 25, 2023

Copy link
Copy Markdown
Collaborator

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
Copy Markdown

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?

Comment thread e2e/saas.spec.ts
});

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

Copy link
Copy Markdown
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)

Comment thread e2e/saas.spec.ts
await frame.isVisible('.text-2');
await frame.isVisible('.text-3');
await frame.isVisible('.text-4');
await frame.isVisible('.text-5');

Copy link
Copy Markdown
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