Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(deployment): e2e testing create deployment #392

Merged
merged 10 commits into from
Oct 4, 2024
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
Loading