-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[E2E][TEST] Add tests for thirdparty apps (#4708)
* changeset * add tests for installing and removing app * add test ids
- Loading branch information
Showing
9 changed files
with
163 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": patch | ||
--- | ||
|
||
Add tests for thirdparty apps |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Page } from "@playwright/test"; | ||
|
||
export class AppInstallationPage { | ||
readonly page: Page; | ||
|
||
constructor( | ||
page: Page, | ||
readonly appInstallationPageHeader = page.getByTestId("app-installation-page-header"), | ||
readonly installAppButton = page.getByTestId("install-app-button"), | ||
) { | ||
this.page = page; | ||
} | ||
} |
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,28 @@ | ||
import type { Page } from "@playwright/test"; | ||
import { BasePage } from "@pages/basePage"; | ||
import { URL_LIST } from "@data/url"; | ||
import { DeleteDialog } from "./dialogs/deleteDialog"; | ||
|
||
|
||
export class AppPage extends BasePage { | ||
readonly page: Page; | ||
readonly basePage: BasePage; | ||
readonly deleteAppDialog: DeleteDialog; | ||
|
||
|
||
constructor( | ||
page: Page, | ||
readonly deleteButton = page.getByText("Delete"), | ||
) { | ||
super(page); | ||
this.page = page; | ||
this.basePage = new BasePage(page); | ||
this.deleteAppDialog = new DeleteDialog(page); | ||
} | ||
|
||
async goToExistingAppPage(appId: string) { | ||
const appUrl = URL_LIST.apps + appId; | ||
await this.page.goto(appUrl); | ||
} | ||
|
||
} |
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,15 +1,36 @@ | ||
import type { Page } from "@playwright/test"; | ||
import { URL_LIST } from "@data/url"; | ||
import { BasePage } from "@pages/basePage"; | ||
|
||
export class AppsPage { | ||
export class AppsPage extends BasePage { | ||
readonly page: Page; | ||
readonly basePage: BasePage; | ||
|
||
constructor( | ||
page: Page, | ||
readonly installExternalAppButton = page.getByTestId( | ||
"add-app-from-manifest", | ||
), | ||
readonly appsLogosList = page.getByTestId("app-logo"), | ||
readonly appManifestUrlInput = page | ||
.getByTestId("manifest-url-input") | ||
.locator("input"), | ||
readonly installAppFromManifestButton = page.getByTestId("install-app-from-manifest"), | ||
readonly installedAppRow = page.getByTestId("apps:installed-app-row"), | ||
readonly appKlaviyo = page.getByTestId("app-klaviyo"), | ||
readonly appAdyen = page.getByTestId("app-adyen"), | ||
) { | ||
super(page); | ||
this.page = page; | ||
this.basePage = new BasePage(page); | ||
} | ||
|
||
async gotoAppsList() { | ||
await this.page.goto(URL_LIST.apps); | ||
} | ||
|
||
async typeManifestUrl(manifestUrl: string) { | ||
await this.appManifestUrlInput.fill(manifestUrl); | ||
} | ||
|
||
} |
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,53 @@ | ||
import { AppsPage } from "@pages/appsPage"; | ||
import { AppInstallationPage } from "@pages/appInstallationPage"; | ||
import { expect, test } from "@playwright/test"; | ||
import { AppPage } from "@pages/appPageThirdparty"; | ||
import { APPS } from "@data/e2eTestData"; | ||
|
||
test.use({ storageState: "playwright/.auth/admin.json" }); | ||
let appsPage: AppsPage; | ||
let installationPage: AppInstallationPage; | ||
let appPage: AppPage; | ||
|
||
test("TC: SALEOR_119 User should be able to install and configure app from manifest @e2e", async ({ | ||
page, | ||
}) => { | ||
const appsPage = new AppsPage(page); | ||
const installationPage = new AppInstallationPage(page); | ||
|
||
await appsPage.gotoAppsList(); | ||
await expect(appsPage.installExternalAppButton).toBeVisible(); | ||
await appsPage.installExternalAppButton.click(); | ||
await appsPage.typeManifestUrl("https://klaviyo.saleor.app/api/manifest"); | ||
await appsPage.installAppFromManifestButton.click(); | ||
await expect(installationPage.appInstallationPageHeader).toHaveText("You are about to install Klaviyo"); | ||
await installationPage.installAppButton.click(); | ||
await appsPage.expectSuccessBanner(); | ||
await expect(appsPage.installedAppRow.first()).toBeVisible(); | ||
await expect(appsPage.appKlaviyo).toContainText("Klaviyo"); | ||
await appsPage.appKlaviyo.click(); | ||
|
||
const iframeLocator = page.frameLocator("iframe"); | ||
|
||
await expect(iframeLocator.getByLabel("PUBLIC_TOKEN")).toBeVisible(); | ||
await iframeLocator.getByLabel("PUBLIC_TOKEN").fill("test_token"); | ||
await iframeLocator.getByText("Save").click(); | ||
await appsPage.expectSuccessBanner(); | ||
|
||
}); | ||
|
||
test("TC: SALEOR_120 User should be able to delete thirdparty app @e2e", async ({ | ||
page, | ||
}) => { | ||
const appsPage = new AppsPage(page); | ||
const appPage = new AppPage(page); | ||
|
||
await appPage.goToExistingAppPage(APPS.appToBeDeleted.id); | ||
await expect(appPage.pageHeader).toContainText("Adyen"); | ||
await appPage.deleteButton.click(); | ||
await appPage.deleteAppDialog.clickDeleteButton(); | ||
await appsPage.expectSuccessBanner(); | ||
await expect(appsPage.installedAppRow.first()).toBeVisible(); | ||
await expect(appsPage.appAdyen).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
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