-
Notifications
You must be signed in to change notification settings - Fork 50k
Proof of Concept for E2E tests using playwright #22754
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fac814e
Proof of Concept for E2E tests using playwright
akgupta0777 f52ecf4
Merge branch 'main' of https://github.com/akgupta0777/react into Play…
akgupta0777 5bdcd71
Renamed folder structure
akgupta0777 e52e4f5
Modified test script
akgupta0777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
packages/react-devtools-inline/__tests__/__e2e__/inspecting-props.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| 'use strict'; | ||
|
|
||
| const {test, expect} = require('@playwright/test'); | ||
| const config = require('../../playwright.config'); | ||
| test.use(config); | ||
|
|
||
| test.describe('Testing Todo-List App', () => { | ||
| let page, frameElementHandle, frame; | ||
| test.beforeAll(async ({browser}) => { | ||
| page = await browser.newPage(); | ||
| await page.goto('http://localhost:8080/', {waitUntil: 'domcontentloaded'}); | ||
| await page.waitForSelector('iframe#target'); | ||
| frameElementHandle = await page.$('#target'); | ||
| frame = await frameElementHandle.contentFrame(); | ||
| }); | ||
|
|
||
| test('The Todo List should contain 3 items by default', async () => { | ||
| const list = frame.locator('.listitem'); | ||
| await expect(list).toHaveCount(3); | ||
| }); | ||
|
|
||
| test('Add another item Fourth to list', async () => { | ||
| await frame.type('.input', 'Fourth'); | ||
| await frame.click('button.iconbutton'); | ||
| const listItems = await frame.locator('.label'); | ||
| await expect(listItems).toHaveText(['First', 'Second', 'Third', 'Fourth']); | ||
| }); | ||
|
|
||
| test('Inspecting list elements with devtools', async () => { | ||
| // Component props are used as string in devtools. | ||
| const listItemsProps = [ | ||
| '', | ||
| '{id: 1, isComplete: true, text: "First"}', | ||
| '{id: 2, isComplete: true, text: "Second"}', | ||
| '{id: 3, isComplete: false, text: "Third"}', | ||
| '{id: 4, isComplete: false, text: "Fourth"}', | ||
| ]; | ||
| const countOfItems = await frame.$$eval('.listitem', el => el.length); | ||
| // For every item in list click on devtools inspect icon | ||
| // click on the list item to quickly navigate to the list item component in devtools | ||
| // comparing displayed props with the array of props. | ||
| for (let i = 1; i <= countOfItems; ++i) { | ||
| await page.click('[class^=ToggleContent]', {delay: 100}); | ||
| await frame.click(`.listitem:nth-child(${i})`, {delay: 50}); | ||
| await page.waitForSelector('span.Value___tNzum'); | ||
| const text = await page.innerText('span[class^=Value]'); | ||
| await expect(text).toEqual(listItemsProps[i]); | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| const config = { | ||
| use: { | ||
| headless: false, | ||
| browserName: 'chromium', | ||
| launchOptions: { | ||
| slowMo: 100, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| module.exports = config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.