Skip to content

Commit

Permalink
Some updated for e2e tests (airbytehq#9091)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamakase authored Jan 6, 2022
1 parent 954929a commit 5ffc880
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 12 deletions.
11 changes: 11 additions & 0 deletions airbyte-webapp-e2e-tests/cypress/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare global {
namespace Cypress {
interface Chainable {
clearApp(): Chainable<Element>;

// sidebar

openSettings(): Chainable<Element>;
}
}
}
6 changes: 6 additions & 0 deletions airbyte-webapp-e2e-tests/cypress/support/commands/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ Cypress.Commands.add("deleteEntity", () => {
cy.get("button[data-id='open-delete-modal']").click();
cy.get("button[data-id='delete']").click();
})

Cypress.Commands.add("clearApp", () => {
indexedDB.deleteDatabase("firebaseLocalStorageDb");
cy.clearLocalStorage();
cy.clearCookies();
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "./common";
import "./sidebar";
import "./source";
import "./destination";
import "./connection";
3 changes: 3 additions & 0 deletions airbyte-webapp-e2e-tests/cypress/support/commands/sidebar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cypress.Commands.add("openSettings", () => {
cy.get("nav a[href*='settings']").click();
});
22 changes: 21 additions & 1 deletion airbyte-webapp-e2e-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions airbyte-webapp-e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"devDependencies": {
"cypress": "^9.2.0",
"typescript": "^4.5.4",
"eslint-plugin-cypress": "^2.12.1"
}
}
23 changes: 23 additions & 0 deletions airbyte-webapp-e2e-tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"include": ["./**/*.ts"],
"exclude": [],
"compilerOptions": {
"baseUrl": "src",
"target": "es5",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "react-jsx",
"noFallthroughCasesInSwitch": true,
"types": ["cypress"],
"lib": ["es2015", "dom"],
"isolatedModules": false,
"allowJs": true,
"noEmit": true
}
}
4 changes: 2 additions & 2 deletions airbyte-webapp/src/components/SideMenu/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type SideMenuItem = {
name: string | React.ReactNode;
indicatorCount?: number;
component: React.ComponentType<any>;
testId?: string;
id?: string;
};

export type CategoryItem = {
Expand Down Expand Up @@ -49,7 +49,7 @@ const SideMenu: React.FC<SideMenuProps> = ({ data, onSelect, activeItem }) => {
)}
{categoryItem.routes.map((route) => (
<MenuItem
testId={route.testId}
id={route.id}
key={route.path}
name={route.name}
isActive={activeItem?.endsWith(route.path)}
Expand Down
12 changes: 3 additions & 9 deletions airbyte-webapp/src/components/SideMenu/components/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type IProps = {
name: string | React.ReactNode;
isActive?: boolean;
count?: number;
testId?: string;
id?: string;
onClick: () => void;
};

Expand Down Expand Up @@ -40,15 +40,9 @@ const Counter = styled.div`
margin-left: 5px;
`;

const MenuItem: React.FC<IProps> = ({
count,
isActive,
name,
testId,
onClick,
}) => {
const MenuItem: React.FC<IProps> = ({ count, isActive, name, id, onClick }) => {
return (
<Item data-testid={testId} isActive={isActive} onClick={onClick}>
<Item data-testid={id} isActive={isActive} onClick={onClick}>
{name}
{count ? <Counter>{count}</Counter> : null}
</Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const CloudSettingsPage: React.FC = () => {
path: CloudSettingsRoutes.AccessManagement,
name: <FormattedMessage id="settings.accessManagementSettings" />,
component: UsersSettingsView,
id: "workspaceSettings.accessManagementSettings",
},
{
path: CloudSettingsRoutes.Notifications,
Expand Down

0 comments on commit 5ffc880

Please sign in to comment.