Skip to content

Commit

Permalink
fix: data test ids
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanAgarwal041 committed Dec 26, 2024
1 parent d9defc9 commit e5ed096
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
13 changes: 12 additions & 1 deletion app/client/cypress/limited-tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# To run only limited tests - give the spec names in below format:
cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js
# cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js
cypress/e2e/Regression/ClientSide/BugTests/DS_Bug26716_Spec.ts
cypress/e2e/Regression/ClientSide/BugTests/DS_Bug28750_Spec.ts
cypress/e2e/Regression/ClientSide/BugTests/DatasourceSchema_spec.ts
cypress/e2e/Regression/ClientSide/Google/EnableGoogle_spec.js
cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionFlow_Generated_App_spec.ts
cypress/e2e/Regression/ClientSide/OneClickBinding/PropertyControl_spec.ts
cypress/e2e/Regression/ClientSide/OtherUIFeatures/EntityBottomBar_spec.ts
cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts
cypress/e2e/Sanity/Datasources/Styles_spec.js
cypress/e2e/Smoke/GenerateCRUD/Generate_Crud_New_Page_spec.ts
# For running all specs - uncomment below:
#cypress/e2e/**/**/*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function NewApiScreen(props: CreateAPIOrSaasPluginsProps) {
{props.restAPIVisible && (
<DatasourceItem
className="t--createBlankApiCard create-new-api"
dataCardWrapperTestId="newapi-datasource-content-wrapper"
handleOnClick={() => handleOnClick(API_ACTION.CREATE_NEW_API)}
icon={getAssetUrl(`${ASSETS_CDN_URL}/plus.png`)}
name={createMessage(CREATE_NEW_DATASOURCE_REST_API)}
Expand All @@ -185,6 +186,7 @@ function NewApiScreen(props: CreateAPIOrSaasPluginsProps) {
{props.graphQLAPIVisible && (
<DatasourceItem
className="t--createBlankApiGraphqlCard"
dataCardWrapperTestId="graphqlapi-datasource-content-wrapper"
handleOnClick={() => handleOnClick(API_ACTION.CREATE_NEW_GRAPHQL_API)}
icon={getAssetUrl(`${ASSETS_CDN_URL}/GraphQL.png`)}
name={createMessage(CREATE_NEW_DATASOURCE_GRAPHQL_API)}
Expand All @@ -193,6 +195,7 @@ function NewApiScreen(props: CreateAPIOrSaasPluginsProps) {
{authApiPlugin && (
<DatasourceItem
className="t--createAuthApiDatasource"
dataCardWrapperTestId="authapi-datasource-content-wrapper"
handleOnClick={() => handleOnClick(API_ACTION.AUTH_API)}
icon={getAssetUrl(authApiPlugin.iconLocation)}
name={createMessage(CREATE_NEW_DATASOURCE_AUTHENTICATED_REST_API)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class DBOrMostPopularPlugins extends React.Component<Props> {
!!showMostPopularPlugins ? (
<DatasourceItem
className="t--createBlankApiCard create-new-api"
dataCardWrapperTestId="newapi-datasource-content-wrapper"
handleOnClick={this.handleOnClick}
icon={getAssetUrl(`${ASSETS_CDN_URL}/plus.png`)}
key={`${plugin.id}_${idx}`}
Expand All @@ -228,6 +229,9 @@ class DBOrMostPopularPlugins extends React.Component<Props> {
) : null
) : (
<DatasourceItem
dataCardImageTestId="database-datasource-image"
dataCardTestId="database-datasource-card"
dataCardWrapperTestId="database-datasource-content-wrapper"
handleOnClick={() => {
AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_CLICK", {
appName: currentApplication?.name,
Expand Down
27 changes: 23 additions & 4 deletions app/client/src/pages/Editor/IntegrationEditor/DatasourceItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ interface DatasourceItem {
description?: string;
handleOnClick: () => unknown;
rightSibling?: ReactNode;
dataNameTestId?: string;
dataCardTestId?: string;
dataCardWrapperTestId?: string;
dataCardDescriptionTestId?: string;
dataCardImageTestId?: string;
}

export default function DatasourceItem({
className,
dataCardDescriptionTestId = "datasource-description",
dataCardImageTestId = "datasource-image",
dataCardTestId = "datasource-card",
dataCardWrapperTestId = "datasource-content-wrapper",
dataNameTestId = "datasource-name",
description,
handleOnClick,
icon,
Expand All @@ -27,14 +37,23 @@ export default function DatasourceItem({
return (
<DatasourceCard
className={`t--create-${name} ${className}`}
data-testid={dataCardTestId}
onClick={handleOnClick}
>
<DatasourceImage alt={name} src={icon} />
<DatasourceNameWrapper>
<DatasourceName className="t--plugin-name" renderAs="p">
<DatasourceImage
alt={name}
data-testid={dataCardImageTestId}
src={icon}
/>
<DatasourceNameWrapper data-testid={dataCardWrapperTestId}>
<DatasourceName
className="t--plugin-name"
data-testid={dataNameTestId}
renderAs="p"
>
{name}
</DatasourceName>
<DatasourceDescription data-testid="mockdatasource-description">
<DatasourceDescription data-testid={dataCardDescriptionTestId}>
{description}
</DatasourceDescription>
</DatasourceNameWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function MockDatasourceCard(props: MockDatasourceCardProps) {
return (
<DatasourceItem
className="t--mock-datasource"
dataCardDescriptionTestId="mockdatasource-description"
dataCardImageTestId="mock-datasource-image"
dataCardWrapperTestId="mock-datasource-name-wrapper"
dataNameTestId="mockdatasource-name"
description={datasource.description}
handleOnClick={addMockDataSource}
icon={getAssetUrl(pluginImages[currentPlugin.id])}
Expand Down

0 comments on commit e5ed096

Please sign in to comment.