-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add connect-to-nx-cloud command (#1375)
- Loading branch information
Showing
28 changed files
with
6,021 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
apps/vscode-e2e/specs/connect-to-nx-cloud/connect-to-nx-cloud-nx.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import e2eBase from './connect-to-nx-cloud.e2e-base'; | ||
|
||
describe('Connect to Nx Cloud button with Nx latest', e2eBase('nx')); |
3 changes: 3 additions & 0 deletions
3
apps/vscode-e2e/specs/connect-to-nx-cloud/connect-to-nx-cloud-nx11.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import e2eBase from './connect-to-nx-cloud.e2e-base'; | ||
|
||
describe('Connect to Nx Cloud button with Nx 11', e2eBase('nx11')); |
110 changes: 110 additions & 0 deletions
110
apps/vscode-e2e/specs/connect-to-nx-cloud/connect-to-nx-cloud.e2e-base.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { | ||
CustomTreeItem, | ||
SideBarView, | ||
ViewItemAction, | ||
ViewSection, | ||
} from 'wdio-vscode-service'; | ||
import { | ||
assertWorkspaceIsLoaded, | ||
closeAllSectionsExcept, | ||
openNxConsoleViewContainer, | ||
openWorkspace, | ||
TestWorkspaceKind, | ||
} from '../utils'; | ||
|
||
export default (workspaceKind: TestWorkspaceKind) => () => { | ||
let nxConsoleViewContainer: SideBarView<unknown>; | ||
let helpAndFeedbackSection: ViewSection; | ||
let helpAndFeedbackItems: CustomTreeItem[]; | ||
|
||
describe('Connect to Nx Cloud button', () => { | ||
before(async () => { | ||
await openWorkspace(workspaceKind); | ||
}); | ||
|
||
it('should load VSCode', assertWorkspaceIsLoaded('nx')); | ||
|
||
it('should show disconnected nx cloud status', async () => { | ||
nxConsoleViewContainer = await openNxConsoleViewContainer(); | ||
|
||
closeAllSectionsExcept(nxConsoleViewContainer, 'HELP AND FEEDBACK'); | ||
|
||
await browser.waitUntil(async () => { | ||
let view: ViewSection; | ||
try { | ||
view = await nxConsoleViewContainer | ||
.getContent() | ||
.getSection('HELP AND FEEDBACK'); | ||
} catch (error) { | ||
view = undefined; | ||
} | ||
if (view) { | ||
helpAndFeedbackSection = view; | ||
return true; | ||
} | ||
}); | ||
|
||
helpAndFeedbackItems = await getHelpAndFeedbackItems(); | ||
|
||
const labels = await Promise.all( | ||
helpAndFeedbackItems.map((i) => i.getLabel()) | ||
); | ||
expect(labels).toContain('Disconnected from Nx Cloud. Connect now?'); | ||
}); | ||
|
||
it('should connect to nx cloud via button', async () => { | ||
let connectToNxCloudTreeItem: CustomTreeItem; | ||
for (const item of helpAndFeedbackItems) { | ||
if ( | ||
(await item.getLabel()) === 'Disconnected from Nx Cloud. Connect now?' | ||
) { | ||
connectToNxCloudTreeItem = item; | ||
} | ||
} | ||
|
||
const treeItemElem = await connectToNxCloudTreeItem.elem; | ||
await treeItemElem.waitForClickable(); | ||
treeItemElem.click(); | ||
|
||
let actionButtons: ViewItemAction[]; | ||
await browser.waitUntil(async () => { | ||
const abs = await connectToNxCloudTreeItem.getActionButtons(); | ||
if (abs.length > 0) { | ||
actionButtons = abs; | ||
return true; | ||
} | ||
}); | ||
|
||
const launchButton = await actionButtons[0].elem; | ||
await launchButton.waitForClickable(); | ||
launchButton.click(); | ||
|
||
await browser.waitUntil( | ||
async () => { | ||
const hafItems = await getHelpAndFeedbackItems(); | ||
const labels = await Promise.all(hafItems.map((i) => i.getLabel())); | ||
if (labels.includes('You are connected to Nx Cloud!')) { | ||
return true; | ||
} | ||
}, | ||
{ | ||
timeout: 300000, | ||
timeoutMsg: 'Connection to Nx Cloud not established within 20s', | ||
interval: 1000, | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
async function getHelpAndFeedbackItems() { | ||
let hafItems: CustomTreeItem[]; | ||
await browser.waitUntil(async () => { | ||
const items = await helpAndFeedbackSection.getVisibleItems(); | ||
if (items.length > 0) { | ||
hafItems = items as CustomTreeItem[]; | ||
return true; | ||
} | ||
}); | ||
return hafItems; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
apps/vscode-e2e/testworkspaces/testworkspace-nx/migrations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"migrations": [ | ||
{ | ||
"version": "14.8.0-beta.0", | ||
"description": "Migrates from @nrwl/workspace:run-commands to nx:run-commands", | ||
"cli": "nx", | ||
"implementation": "./src/migrations/update-14-8-0/change-run-commands-executor", | ||
"package": "@nrwl/workspace", | ||
"name": "14-8-0-change-run-commands-executor" | ||
} | ||
] | ||
} |
Oops, something went wrong.