-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes approach for create e2e group, adds clean old e2e groups #1809
Merged
Merged
Changes from all commits
Commits
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
This file contains 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 |
---|---|---|
@@ -1,14 +1,19 @@ | ||
import { test as base } from '@playwright/test'; | ||
import { LostChangesConfirmationModal } from 'e2e/common/pages/lost-changes-confirmation-modal'; | ||
import { Toast } from 'e2e/common/pages/toast'; | ||
import { test as groupFixtures } from '../groups/create-group-fixture'; | ||
|
||
interface CommonFixtures { | ||
lostChangesConfirmationModal: LostChangesConfirmationModal, | ||
toast: Toast, | ||
} | ||
|
||
export const test = base.extend<CommonFixtures>({ | ||
export const test = groupFixtures.extend<CommonFixtures>({ | ||
lostChangesConfirmationModal: async ({ page }, use) => { | ||
await use(new LostChangesConfirmationModal(page)); | ||
}, | ||
toast: async ({ page }, use) => { | ||
await use(new Toast(page)); | ||
}, | ||
}); | ||
|
||
export { expect, Page } from '@playwright/test'; |
This file contains 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,15 @@ | ||
import { expect, Page } from '@playwright/test'; | ||
|
||
export class Toast { | ||
constructor(private page: Page) { | ||
} | ||
|
||
async checksIsMessageVisible(message: string): Promise<void> { | ||
const toastLocator = this.page.locator('p-toast'); | ||
const successfulLocator = toastLocator.getByText(message); | ||
await expect.soft(successfulLocator).toBeVisible(); | ||
await expect.soft(toastLocator.getByLabel('Close')).toBeVisible(); | ||
await toastLocator.getByLabel('Close').click(); | ||
await expect.soft(successfulLocator).not.toBeVisible(); | ||
} | ||
} |
This file contains 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,56 @@ | ||
import { test, expect } from 'e2e/common/fixture'; | ||
import { initAsTesterUser } from 'e2e/helpers/e2e_auth'; | ||
import { HOURS } from 'src/app/utils/duration'; | ||
import { apiUrl } from 'e2e/helpers/e2e_http'; | ||
import { isNotNull } from 'src/app/utils/null-undefined-predicates'; | ||
|
||
const rootGroupId = '7035186126723551198'; | ||
const rootGroupName = 'E2E-generated-groups'; | ||
|
||
test('checks old e2e groups and remove it', { tag: '@no-parallelism' }, async ({ | ||
page, | ||
groupMembersPage, | ||
groupSettingsPage, | ||
toast, | ||
}) => { | ||
await initAsTesterUser(page); | ||
await Promise.all([ | ||
page.goto(`groups/by-id/${rootGroupId};p=/members`), | ||
page.waitForResponse(`${apiUrl}/groups/${rootGroupId}/navigation`), | ||
]); | ||
await groupMembersPage.checksIsHeaderVisible(rootGroupName); | ||
const leftNavRootGroup = page.locator('p-treenode').filter({ has: page.getByText(rootGroupName) }); | ||
await expect.soft(leftNavRootGroup).toBeVisible(); | ||
const regExpGroup = /E2E_\d{13}/; | ||
const leftNavFirstChild = leftNavRootGroup.getByText(regExpGroup).first(); | ||
if (!(await leftNavFirstChild.isVisible())) return; | ||
|
||
const groupNamesForRemove = (await Promise.all((await leftNavRootGroup.getByText(regExpGroup).all()) | ||
.map(item => item.textContent()))) | ||
.filter(isNotNull) | ||
.filter(itemName => { | ||
const createdAtResult = itemName.match(/\d{13}/); | ||
if (!createdAtResult) throw new Error('Unexpected: Missed createdAtResult'); | ||
const [ createdAt ] = createdAtResult; | ||
return Date.now() - Number(createdAt) > HOURS; | ||
}); | ||
|
||
await leftNavFirstChild.click(); | ||
|
||
for (const groupName of groupNamesForRemove) { | ||
const leftNavGroupLocator = page.locator('p-tree').getByText(groupName).first(); | ||
await expect.soft(leftNavGroupLocator).toBeVisible(); | ||
await leftNavGroupLocator.click(); | ||
const settingsTabLocator = page.getByRole('link', { name: 'Settings' }); | ||
await expect.soft(settingsTabLocator).toBeVisible(); | ||
await settingsTabLocator.click(); | ||
await groupSettingsPage.checksIsDeleteButtonVisible(); | ||
await groupSettingsPage.checksIsDeleteButtonEnabled(); | ||
await groupSettingsPage.deleteGroup(); | ||
await groupSettingsPage.checksIsDeleteButtonDisabled(); | ||
await Promise.all([ | ||
toast.checksIsMessageVisible(`You have deleted "${ groupName }"`), | ||
page.waitForResponse(`${apiUrl}/groups/${rootGroupId}/navigation`), | ||
]); | ||
} | ||
}); |
This file contains 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 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 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 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.
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.
The reason I'm not using group locator from collection is that the collection keeps position of element (nth(n)), and so if new group will be created during process (so left menu is updated with new positions) it will be failed. That's why need to get locator by name again