-
Notifications
You must be signed in to change notification settings - Fork 38
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
Update react & react-dom to 18.3.0 and fix playwright flakiness #1807
Changes from 18 commits
0b6ce07
3010797
b6eb3a5
6d6a005
2873b26
7ef42c4
ebd0f49
00c834a
d3c7007
d0a5b9a
c7e7fe8
964ab3a
4e2d8db
8eab52d
be0defc
a30f8c1
d156b92
8dc2578
aba1c20
1b40c75
b5ab00e
d5d7c50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,13 @@ test.describe('Campaigns list page ', () => { | |
WelcomeNewMembers, | ||
]); | ||
|
||
await page.goto(appUri + '/organize/1/projects'); | ||
const campaignCards = page.locator('data-testid=campaign-card'); | ||
await Promise.all([ | ||
page.goto(appUri + '/organize/1/projects'), | ||
campaignCards.first().waitFor({ state: 'visible' }), | ||
]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really necessary though? I've used the But in this situation, and others in this PR, I feel like the Here's what the documentation on
That makes me think that if If I'm right, it means we don't have to use the |
||
|
||
const numCampaignCards = await page.$$eval( | ||
'data-testid=campaign-card', | ||
(items) => items.length | ||
); | ||
const numCampaignCards = await campaignCards.count(); | ||
expect(numCampaignCards).toEqual(2); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,24 +27,23 @@ test.describe('Journey instance detail page', () => { | |
ClarasOnboarding | ||
); | ||
|
||
await page.goto(appUri + '/organize/1/journeys/1/1'); | ||
|
||
// Check that the title is visible in the right place | ||
expect( | ||
await page | ||
.locator( | ||
`[data-testid=page-title]:has-text("${ClarasOnboarding.title}")` | ||
) | ||
.count() | ||
).toEqual(1); | ||
|
||
// Check that the title is also in the breadcrumbs | ||
expect( | ||
await page | ||
.locator( | ||
`[aria-label=breadcrumb]:has-text("${ClarasOnboarding.title}")` | ||
) | ||
.count() | ||
).toEqual(1); | ||
const title = page.locator( | ||
`[data-testid=page-title]:has-text("${ClarasOnboarding.title}")` | ||
); | ||
const breadcrumbTitle = page.locator( | ||
`[aria-label=breadcrumb]:has-text("${ClarasOnboarding.title}")` | ||
); | ||
|
||
await Promise.all([ | ||
page.goto(appUri + '/organize/1/journeys/1/1'), | ||
title.waitFor({ state: 'visible' }), | ||
breadcrumbTitle.waitFor({ state: 'visible' }), | ||
]); | ||
|
||
const numTitles = await title.count(); | ||
const numBreadcrumbTitles = await breadcrumbTitle.count(); | ||
|
||
expect(numTitles).toEqual(1); | ||
expect(numBreadcrumbTitles).toEqual(1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As an example, I think the important part of the fix here is the added uses of await page.goto(appUri + '/organize/1/journeys/1/1');
await title.waitFor({ state: 'visible' });
await breadcrumbTitle.waitFor({ state: 'visible' });
const numTitles = await title.count();
const numBreadcrumbTitles = await breadcrumbTitle.count();
expect(numTitles).toEqual(1);
expect(numBreadcrumbTitles).toEqual(1); Do you agree that this pattern would make the code more readable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're 100% correct here I think. Reckon I've accidentally picked this up from those other ones you mentioned and not really thought much about it. Crossed my mind briefly at one point I think, but guess I got a little lost in the fun here. Will make this change real quick, thanks for raising this! |
||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,16 +37,28 @@ test.describe('Tags manager', () => { | |
'delete' | ||
); | ||
|
||
await page.goto(appUri + `/organize/1/people/${ClaraZetkin.id}`); | ||
const tagToDelete = page.locator(`text="${ActivistTag.title}"`); | ||
const deleteButton = page.locator('[data-testid=TagChip-deleteButton]'); | ||
|
||
await Promise.all([ | ||
page.goto(appUri + `/organize/1/people/${ClaraZetkin.id}`), | ||
tagToDelete.waitFor({ state: 'visible' }), | ||
]); | ||
|
||
await Promise.all([ | ||
tagToDelete.hover(), | ||
deleteButton.waitFor({ state: 'visible' }), | ||
]); | ||
|
||
await page.locator(`text="${ActivistTag.title}"`).hover(); | ||
await Promise.all([ | ||
page.waitForRequest((req) => req.method() == 'DELETE'), | ||
page.locator('[data-testid=TagChip-deleteButton]').click(), | ||
deleteButton.click(), | ||
]); | ||
|
||
moxy.setZetkinApiMock(`/orgs/1/people/${ClaraZetkin.id}/tags`, 'get', []); | ||
|
||
await tagToDelete.nth(2).waitFor({ state: 'hidden' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now |
||
|
||
// Expect to have made request to delete tag | ||
expect(deleteTagLog().length).toEqual(1); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (using locators instead of
$$eval
) is a clear improvement IMO.