diff --git a/.github/workflows/e2eTests.yml b/.github/workflows/e2eTests.yml new file mode 100644 index 00000000..a5d67c4b --- /dev/null +++ b/.github/workflows/e2eTests.yml @@ -0,0 +1,29 @@ +name: E2E Tests - Playwright +on: + pull_request: + branches: [main, master] +jobs: + tests: + timeout-minutes: 600 + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./packages/view + steps: + - uses: actions/checkout@v2 # v3 is not available as of my last update in January 2022 + - uses: actions/setup-node@v3 + with: + node-version: 18.16.0 + + # Add Playwright GitHub Action + - name: Setup Playwright + uses: microsoft/playwright-github-action@v1 + + - name: Install dependencies + run: npm i + + - name: npx playwright install + run: npx playwright install + + - name: Run Playwright tests + run: npm run test:e2e diff --git a/package-lock.json b/package-lock.json index 9e0e1cc4..9de92fed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30434,7 +30434,7 @@ "typescript": "^4.7.4", "webpack": "^5.74.0", "webpack-cli": "^4.10.0", - "webpack-dev-server": "*", + "webpack-dev-server": "^4.15.1", "webpack-merge": "^5.8.0", "yarn": "^1.22.19" }, diff --git a/packages/view/src/App.tsx b/packages/view/src/App.tsx index ee75c9b7..29e5da71 100644 --- a/packages/view/src/App.tsx +++ b/packages/view/src/App.tsx @@ -20,24 +20,24 @@ import type { IDESentEvents } from "types/IDESentEvents"; const App = () => { const initRef = useRef(false); - const { filteredData, fetchAnalyzedData, fetchBranchList, loading, setLoading } = useGlobalData(); + const { filteredData, handleChangeAnalyzedData, handleChangeBranchList, loading, setLoading } = useGlobalData(); const ideAdapter = container.resolve("IDEAdapter"); useEffect(() => { if (initRef.current === false) { const callbacks: IDESentEvents = { - fetchAnalyzedData, - fetchBranchList, + handleChangeAnalyzedData, + handleChangeBranchList, }; setLoading(true); ideAdapter.addIDESentEventListener(callbacks); ideAdapter.sendFetchAnalyzedDataMessage(); - ideAdapter.sendGetBranchListMessage(); + ideAdapter.sendFetchBranchListMessage(); initRef.current = true; } - }, [fetchBranchList, fetchAnalyzedData, ideAdapter, setLoading]); + }, [handleChangeAnalyzedData, handleChangeBranchList, ideAdapter, setLoading]); if (loading) { return ( diff --git a/packages/view/src/components/BranchSelector/BranchSelector.tsx b/packages/view/src/components/BranchSelector/BranchSelector.tsx index 1d9d45fb..bb58d927 100644 --- a/packages/view/src/components/BranchSelector/BranchSelector.tsx +++ b/packages/view/src/components/BranchSelector/BranchSelector.tsx @@ -2,12 +2,15 @@ import { type ChangeEventHandler } from "react"; import "./BranchSelector.scss"; import { useGlobalData } from "hooks"; +import { sendFetchAnalyzedDataCommand } from "services"; const BranchSelector = () => { - const { branchList, selectedBranch } = useGlobalData(); + const { branchList, selectedBranch, setSelectedBranch, setLoading } = useGlobalData(); + const handleChangeSelect: ChangeEventHandler = (e) => { - // TODO - webview로 선택된 branch을 payload에 실어 sendFetchAnalyzedDataCommand 호출 - console.log(e.target.value); + setSelectedBranch(e.target.value); + setLoading(true); + sendFetchAnalyzedDataCommand(e.target.value); }; return ( @@ -18,7 +21,7 @@ const BranchSelector = () => { onChange={handleChangeSelect} value={selectedBranch} > - {branchList.map((option) => ( + {branchList?.map((option) => (