-
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.
* Fix for TC: SALEOR_38 * Rename spec file * fix changesets --------- Co-authored-by: M.Graczyk <michalina.graczyk@saleor.io>
- Loading branch information
Showing
3 changed files
with
57 additions
and
30 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 | ||
--- | ||
|
||
Moving test cases for activation and deactivation staff members to other file and running it in serial mode to avoid login in two tests in the same time (it can cause error with code LOGIN_ATTEMPT_DELAYED) |
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,52 @@ | ||
import { BasicApiService } from "@api/basics"; | ||
import { USERS } from "@data/e2eTestData"; | ||
import { ConfigurationPage } from "@pages/configurationPage"; | ||
import { PermissionGroupsPage } from "@pages/permissionGroupsPage"; | ||
import { StaffMembersPage } from "@pages/staffMembersPage"; | ||
import { expect } from "@playwright/test"; | ||
import { test } from "utils/testWithPermission"; | ||
|
||
test.use({ permissionName: "admin" }); | ||
|
||
test.describe.configure({ mode: "serial" }); | ||
|
||
let staffMembersPage: StaffMembersPage; | ||
let config: ConfigurationPage; | ||
let permissionGroupsPage: PermissionGroupsPage; | ||
let basicApiService: BasicApiService; | ||
|
||
test.beforeEach(async ({ page, request }) => { | ||
staffMembersPage = new StaffMembersPage(page, request); | ||
config = new ConfigurationPage(page); | ||
permissionGroupsPage = new PermissionGroupsPage(page); | ||
basicApiService = new BasicApiService(request); | ||
}); | ||
test("TC: SALEOR_137 Admin User should be able to deactivate other user @e2e @staff-members", async () => { | ||
await staffMembersPage.goToStaffDetailsPage(USERS.userToBeDeactivated.id); | ||
await staffMembersPage.clickIsActiveCheckbox(); | ||
await staffMembersPage.clickSaveButton(); | ||
await staffMembersPage.basePage.expectSuccessBanner(); | ||
expect(await staffMembersPage.isActiveCheckbox.isChecked()).toEqual(false); | ||
|
||
const loginViaApiDeactivatedUserResponse = await basicApiService.logInUserViaApi({ | ||
email: USERS.userToBeDeactivated.email, | ||
password: process.env.E2E_PERMISSIONS_USERS_PASSWORD!, | ||
}); | ||
|
||
expect(loginViaApiDeactivatedUserResponse.data.tokenCreate.errors[0].code).toEqual("INACTIVE"); | ||
}); | ||
test("TC: SALEOR_38 Admin User should be able to activate other user @e2e @staff-members", async () => { | ||
await staffMembersPage.goToStaffDetailsPage(USERS.userToBeActivated.id); | ||
await staffMembersPage.clickIsActiveCheckbox(); | ||
await staffMembersPage.clickSaveButton(); | ||
await staffMembersPage.basePage.expectSuccessBanner(); | ||
expect(await staffMembersPage.isActiveCheckbox.isChecked()).toEqual(true); | ||
|
||
const loginViaApiDeactivatedUserResponse = await basicApiService.logInUserViaApi({ | ||
email: USERS.userToBeActivated.email, | ||
password: process.env.E2E_PERMISSIONS_USERS_PASSWORD!, | ||
}); | ||
|
||
expect(loginViaApiDeactivatedUserResponse.data.tokenCreate.errors).toEqual([]); | ||
expect(loginViaApiDeactivatedUserResponse.data.tokenCreate.token).not.toEqual(null); | ||
}); |
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