Fix tests after changes (#1149)

* fix

* fix
This commit is contained in:
Karolina Rakoczy 2021-06-10 10:13:31 +02:00 committed by GitHub
parent 4e65418c51
commit 2c5b0feeb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 10 deletions

View file

@ -190,13 +190,17 @@ export function createTypeProduct({
slug = name, slug = name,
shippable = true shippable = true
}) { }) {
const variantAttributesLine = getValueWithDefault(
hasVariants,
`variantAttributes: "${attributeId}"`
);
const mutation = `mutation{ const mutation = `mutation{
productTypeCreate(input: { productTypeCreate(input: {
name: "${name}" name: "${name}"
slug: "${slug}" slug: "${slug}"
productAttributes: "${attributeId}" productAttributes: "${attributeId}"
variantAttributes: "${attributeId}"
hasVariants: ${hasVariants} hasVariants: ${hasVariants}
${variantAttributesLine}
isShippingRequired:${shippable} isShippingRequired:${shippable}
}){ }){
productErrors{ productErrors{

View file

@ -2,5 +2,6 @@ export const ASSIGN_PRODUCTS_SELECTORS = {
searchInput: "[name='query']", searchInput: "[name='query']",
tableRow: "[class*='MuiTableRow']", tableRow: "[class*='MuiTableRow']",
checkbox: "[type='checkbox']", checkbox: "[type='checkbox']",
submitButton: "[type='submit']" submitButton: "[type='submit']",
dialogContent: '[data-test-id="searchQuery"]'
}; };

View file

@ -17,12 +17,9 @@ export function variantsShouldBeVisible({ name, price }) {
export function createFirstVariant({ sku, warehouseId, price, attribute }) { export function createFirstVariant({ sku, warehouseId, price, attribute }) {
cy.get(PRODUCT_DETAILS.addVariantsButton).click(); cy.get(PRODUCT_DETAILS.addVariantsButton).click();
cy.get(VARIANTS_SELECTORS.valueContainer) cy.get(VARIANTS_SELECTORS.valueContainer)
.contains(attribute)
.find(VARIANTS_SELECTORS.attributeCheckbox)
.click() .click()
.get(VARIANTS_SELECTORS.valueContainer) .contains(attribute)
.find(BUTTON_SELECTORS.checked) .click()
.should("exist")
.get(VARIANTS_SELECTORS.nextButton) .get(VARIANTS_SELECTORS.nextButton)
.click(); .click();
fillUpPriceList(price); fillUpPriceList(price);

View file

@ -9,8 +9,9 @@ export function finalizeDraftOrder(name, address) {
.click() .click()
.get(ASSIGN_PRODUCTS_SELECTORS.searchInput) .get(ASSIGN_PRODUCTS_SELECTORS.searchInput)
.type(name) .type(name)
.get(SHARED_ELEMENTS.progressBar) .get(ASSIGN_PRODUCTS_SELECTORS.dialogContent)
.should("not.be.visible"); .find(SHARED_ELEMENTS.progressBar)
.should("not.exist");
cy.contains(ASSIGN_PRODUCTS_SELECTORS.tableRow, name) cy.contains(ASSIGN_PRODUCTS_SELECTORS.tableRow, name)
.find(ASSIGN_PRODUCTS_SELECTORS.checkbox) .find(ASSIGN_PRODUCTS_SELECTORS.checkbox)
.click() .click()

View file

@ -248,7 +248,7 @@ const OrderProductAddDialog: React.FC<OrderProductAddDialogProps> = props => {
description="dialog header" description="dialog header"
/> />
</DialogTitle> </DialogTitle>
<DialogContent className={classes.overflow}> <DialogContent className={classes.overflow} data-test-id="searchQuery">
<TextField <TextField
name="query" name="query"
value={query} value={query}