-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Finish integration test and make it stable (#281)
Because - #270 This commit - Finish integration-test and make it stable
- Loading branch information
Showing
22 changed files
with
508 additions
and
557 deletions.
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
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ node_modules | |
|
||
# testing | ||
/coverage | ||
playwright-state.json | ||
|
||
# Build directories (next.js...) | ||
.next/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Page, expect } from "@playwright/test"; | ||
|
||
export const expectToDeleteConnector = async ( | ||
page: Page, | ||
type: "destination" | "source", | ||
id: string | ||
) => { | ||
await page.goto(`/${type}s/${id}`); | ||
|
||
// Should enable open delete model modal button | ||
const openDeleteDestinationModalButton = page.locator("button", { | ||
hasText: "Delete", | ||
}); | ||
expect(await openDeleteDestinationModalButton.isEnabled()).toBeTruthy(); | ||
|
||
// Should open delete destination modal | ||
await openDeleteDestinationModalButton.click(); | ||
const deleteResourceModal = page.locator("data-testid=delete-resource-modal"); | ||
await expect(deleteResourceModal).toHaveCount(1); | ||
|
||
// Should have proper modal title | ||
const modalTitle = deleteResourceModal.locator("h2", { | ||
hasText: `Delete This ${type === "destination" ? "Destination" : "Source"}`, | ||
}); | ||
await expect(modalTitle).toHaveCount(1); | ||
|
||
// Should have proper confirmation code hint | ||
const confirmationCodeHint = deleteResourceModal.locator("label", { | ||
hasText: `Please type "${id}" to confirm.`, | ||
}); | ||
await expect(confirmationCodeHint).toHaveCount(1); | ||
|
||
// Should disable delete button | ||
const deleteButton = deleteResourceModal.locator("button", { | ||
hasText: "Delete", | ||
}); | ||
expect(await deleteButton.isDisabled()).toBeTruthy(); | ||
|
||
// Should enable cancel button | ||
const cancelButton = deleteResourceModal.locator("button", { | ||
hasText: "Cancel", | ||
}); | ||
expect(await cancelButton.isEnabled()).toBeTruthy(); | ||
|
||
// Should input correcy confirmation code | ||
const confirmationCodeField = | ||
deleteResourceModal.locator("#confirmationCode"); | ||
await confirmationCodeField.type(id); | ||
expect(await deleteButton.isEnabled()).toBeTruthy(); | ||
|
||
// Should delete destination and navigate to destinations page | ||
await Promise.all([page.waitForNavigation(), deleteButton.click()]); | ||
expect(page.url()).toEqual(`${process.env.NEXT_PUBLIC_MAIN_URL}/${type}s`); | ||
|
||
// Should remove the destination from destination/source list | ||
const itemTitle = page.locator("h3", { hasText: id }); | ||
await expect(itemTitle).toHaveCount(0); | ||
}; |
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
Oops, something went wrong.