Skip to content

Commit

Permalink
test(deployment): e2e testing create deployment (#392)
Browse files Browse the repository at this point in the history
Co-authored-by: Maxime Cyr <[email protected]>
  • Loading branch information
baktun14 and Redm4x authored Oct 4, 2024
1 parent 654dbae commit f2effa8
Show file tree
Hide file tree
Showing 144 changed files with 12,272 additions and 438 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ apps/provider-proxy/.env
apps/stats-web/.env
.env.*.local
.env.local
.env.test

# IDE files
.idea
.vscode
.vscode-test

# Data Folder
data
data
testdata
test-results
27 changes: 3 additions & 24 deletions apps/deploy-web/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";
import path from "path";

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// dotenv.config({ path: path.resolve(__dirname, '.env') });
dotenv.config({ path: path.resolve(__dirname, "env/.env.test") });

/**
* See https://playwright.dev/docs/test-configuration.
Expand Down Expand Up @@ -36,34 +33,16 @@ export default defineConfig({
{
name: "chromium",
use: { ...devices["Desktop Chrome"] }
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] }
},

{
name: "webkit",
use: { ...devices["Desktop Safari"] }
}

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ export const DeploymentDepositModal: React.FunctionComponent<DeploymentDepositMo
side: "right",
disabled: !amount || isCheckingDepositor || (useDepositor && validGrants.length === 0) || !walletBalance,
isLoading: isCheckingDepositor,
onClick: onDepositClick
onClick: onDepositClick,
"data-testid": "deposit-modal-continue-button"
}
]}
onClose={onClose}
Expand Down
27 changes: 22 additions & 5 deletions apps/deploy-web/src/components/deployments/DeploymentDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,27 @@ export function DeploymentDetail({ dseq }: React.PropsWithChildren<{ dseq: strin

<Tabs value={activeTab} onValueChange={onChangeTab}>
<TabsList className="grid w-full grid-cols-5">
<TabsTrigger value="LEASES">Leases</TabsTrigger>
{isActive && <TabsTrigger value="LOGS">Logs</TabsTrigger>}
{isActive && <TabsTrigger value="SHELL">Shell</TabsTrigger>}
{isActive && <TabsTrigger value="EVENTS">Events</TabsTrigger>}
<TabsTrigger value="EDIT">Update</TabsTrigger>
<TabsTrigger value="LEASES" data-testid="deployment-tab-leases">
Leases
</TabsTrigger>
{isActive && (
<TabsTrigger value="LOGS" data-testid="deployment-tab-logs">
Logs
</TabsTrigger>
)}
{isActive && (
<TabsTrigger value="SHELL" data-testid="deployment-tab-shell">
Shell
</TabsTrigger>
)}
{isActive && (
<TabsTrigger value="EVENTS" data-testid="deployment-tab-events">
Events
</TabsTrigger>
)}
<TabsTrigger value="EDIT" data-testid="deployment-tab-update">
Update
</TabsTrigger>
</TabsList>

{activeTab === "EDIT" && deployment && leases && (
Expand Down Expand Up @@ -200,6 +216,7 @@ export function DeploymentDetail({ dseq }: React.PropsWithChildren<{ dseq: strin
leases.map((lease, i) => (
<LeaseRow
key={lease.id}
index={i}
lease={lease}
setActiveTab={setActiveTab}
ref={leaseRefs[i]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const DeploymentDetailTopBar: React.FunctionComponent<Props> = ({ address
<div className="flex items-center">
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<Button size="icon" variant="ghost" className="rounded-full">
<Button size="icon" variant="ghost" className="rounded-full" data-testid="deployment-detail-dropdown">
<MoreHoriz />
</Button>
</DropdownMenuTrigger>
Expand All @@ -119,7 +119,11 @@ export const DeploymentDetailTopBar: React.FunctionComponent<Props> = ({ address
Redeploy
</CustomDropdownLinkItem>
)}
<CustomDropdownLinkItem onClick={() => onCloseDeployment()} icon={<XmarkSquare fontSize="small" />}>
<CustomDropdownLinkItem
onClick={() => onCloseDeployment()}
icon={<XmarkSquare fontSize="small" />}
data-testid="deployment-detail-close-button"
>
Close
</CustomDropdownLinkItem>
</DropdownMenuContent>
Expand Down
Loading

0 comments on commit f2effa8

Please sign in to comment.