saleor-dashboard/cypress/support/pages/userPage.js
Karolina Rakoczy 2c64a966cc
Saleor 4437 refactor tests (#1389)
* reference type cypress working

* refactor

* remove screenshots

* add reference

* add slash marker

* run tests based on shop version

* fix run tests based on shop version

* fix run tests based on shop version

* change base url to localhost

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix plugins

* fix yml

* fix yml

* chage file names

* fix files names

* fix broken imports add checking for errors in grpah responses

* fix broken imports add checking for errors in grpah responses

* update jest

* fix snapshot
2021-09-27 12:04:21 +02:00

43 lines
1.6 KiB
JavaScript

import { SET_PASSWORD } from "../../elements/account/setPassword";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { INVITE_STAFF_MEMBER_FORM } from "../../elements/staffMembers/inviteStaffMemberForm";
import { STAFF_MEMBER_DETAILS } from "../../elements/staffMembers/staffMemberDetails";
import { userDetailsUrl } from "../../fixtures/urlList";
export function fillUpSetPassword(password) {
cy.get(SET_PASSWORD.confirmPasswordInput)
.type(password)
.get(SET_PASSWORD.passwordInput)
.type(password)
.addAliasToGraphRequest("SetPassword")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@SetPassword");
}
export function fillUpUserDetails(firstName, lastName, email) {
cy.get(INVITE_STAFF_MEMBER_FORM.firstNameInput)
.type(firstName)
.get(INVITE_STAFF_MEMBER_FORM.lastNameInput)
.type(lastName)
.get(INVITE_STAFF_MEMBER_FORM.emailInput)
.type(email)
.get(BUTTON_SELECTORS.submit)
.click()
.confirmationMessageShouldDisappear()
.fillAutocompleteSelect(STAFF_MEMBER_DETAILS.permissionsSelect)
.addAliasToGraphRequest("StaffMemberUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate");
}
export function updateUserActiveFlag(userId) {
cy.visitAndWaitForProgressBarToDisappear(userDetailsUrl(userId))
.get(STAFF_MEMBER_DETAILS.isActiveCheckBox)
.click()
.addAliasToGraphRequest("StaffMemberUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@StaffMemberUpdate");
}