Add test-ids to product feed (#669)
* add test-ids to product feed * add dynamic google form * Update .changeset/poor-hounds-move.md Co-authored-by: Adrian Pilarczyk <admin@peelar.dev> --------- Co-authored-by: Adrian Pilarczyk <admin@peelar.dev>
This commit is contained in:
parent
57fea9166e
commit
e4497b9ba4
7 changed files with 39 additions and 7 deletions
5
.changeset/ninety-plums-look.md
Normal file
5
.changeset/ninety-plums-look.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"saleor-app-products-feed": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Added test-id attributes to several meaningful elements. Now quering in automated tests are more stable
|
5
.changeset/poor-hounds-move.md
Normal file
5
.changeset/poor-hounds-move.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"saleor-app-products-feed": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Make Google Categories mapping lazy loaded, so the page loads immediately and forms add with a delay. Previously the page was stuck due to large chunk size
|
|
@ -11,7 +11,7 @@ export const CategoryBreadcrumbs = (props: { category: CategoryWithMappingFragme
|
||||||
const breadcrumbs = constructCategoryBreadcrumbs(props.category);
|
const breadcrumbs = constructCategoryBreadcrumbs(props.category);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box display={"flex"} marginBottom={1}>
|
<Box display={"flex"} marginBottom={1} data-testid={"category-breadcrumb"}>
|
||||||
{breadcrumbs.map((category, index) => {
|
{breadcrumbs.map((category, index) => {
|
||||||
const isLast = index === breadcrumbs.length - 1;
|
const isLast = index === breadcrumbs.length - 1;
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ export const CategoryMappingForm = ({
|
||||||
render={({ field: { value, onChange } }) => {
|
render={({ field: { value, onChange } }) => {
|
||||||
return (
|
return (
|
||||||
<select
|
<select
|
||||||
|
data-testid={"google-category-select"}
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
|
@ -75,7 +76,12 @@ export const CategoryMappingForm = ({
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button type="submit" variant="primary" disabled={isLoading || !formState.isDirty}>
|
<Button
|
||||||
|
data-testid={"google-category-submit"}
|
||||||
|
type="submit"
|
||||||
|
variant="primary"
|
||||||
|
disabled={isLoading || !formState.isDirty}
|
||||||
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -16,7 +16,7 @@ export const CategoryMapping = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box data-testid="categories-mapping-container">
|
||||||
{categories!.map((category) => (
|
{categories!.map((category) => (
|
||||||
<CategoryMappingForm category={category} key={category.id} marginBottom={5} />
|
<CategoryMappingForm category={category} key={category.id} marginBottom={5} />
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
import { NextPage } from "next";
|
import { NextPage } from "next";
|
||||||
import { CategoryMapping } from "../modules/category-mapping/ui/category-mapping";
|
|
||||||
import { Breadcrumbs } from "@saleor/apps-ui";
|
import { Breadcrumbs } from "@saleor/apps-ui";
|
||||||
import { Box } from "@saleor/macaw-ui/next";
|
import { Box, Text } from "@saleor/macaw-ui/next";
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
|
|
||||||
|
const DynamicCategoryMapping = dynamic(
|
||||||
|
() => import("../modules/category-mapping/ui/category-mapping").then((m) => m.CategoryMapping),
|
||||||
|
{
|
||||||
|
loading: () => <Text>Loading...</Text>,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const CategoriesPage: NextPage = () => {
|
const CategoriesPage: NextPage = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -10,7 +17,7 @@ const CategoriesPage: NextPage = () => {
|
||||||
<Breadcrumbs.Item href={"/"}>Configuration</Breadcrumbs.Item>
|
<Breadcrumbs.Item href={"/"}>Configuration</Breadcrumbs.Item>
|
||||||
<Breadcrumbs.Item>Categories Mapping</Breadcrumbs.Item>
|
<Breadcrumbs.Item>Categories Mapping</Breadcrumbs.Item>
|
||||||
</Breadcrumbs>
|
</Breadcrumbs>
|
||||||
<CategoryMapping />
|
<DynamicCategoryMapping />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,13 @@ const ConfigurationPage: NextPage = () => {
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Box __marginBottom="100px">
|
<Box __marginBottom="100px">
|
||||||
<Text variant={"hero"} size={"medium"} as={"h1"} marginBottom={5}>
|
<Text
|
||||||
|
variant={"hero"}
|
||||||
|
size={"medium"}
|
||||||
|
as={"h1"}
|
||||||
|
marginBottom={5}
|
||||||
|
data-testid={"root-heading"}
|
||||||
|
>
|
||||||
Configuration
|
Configuration
|
||||||
</Text>
|
</Text>
|
||||||
<Paragraph>
|
<Paragraph>
|
||||||
|
@ -39,6 +45,7 @@ const ConfigurationPage: NextPage = () => {
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<AppSection
|
<AppSection
|
||||||
|
data-testid={"s3-configuration-section"}
|
||||||
__marginBottom="100px"
|
__marginBottom="100px"
|
||||||
includePadding
|
includePadding
|
||||||
heading={"AWS S3 Bucket"}
|
heading={"AWS S3 Bucket"}
|
||||||
|
@ -69,6 +76,7 @@ const ConfigurationPage: NextPage = () => {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<AppSection
|
<AppSection
|
||||||
|
data-testid={"channels-configuration-section"}
|
||||||
__marginBottom="100px"
|
__marginBottom="100px"
|
||||||
includePadding
|
includePadding
|
||||||
heading={"Channels configuration"}
|
heading={"Channels configuration"}
|
||||||
|
@ -112,6 +120,7 @@ const ConfigurationPage: NextPage = () => {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<AppSection
|
<AppSection
|
||||||
|
data-testid={"categories-mapping-section"}
|
||||||
__marginBottom="100px"
|
__marginBottom="100px"
|
||||||
includePadding
|
includePadding
|
||||||
heading={"Categories mapping"}
|
heading={"Categories mapping"}
|
||||||
|
|
Loading…
Reference in a new issue