Skip to content

Commit e0da8f2

Browse files
committed
check only project clonning for pulic GitHub repos
1 parent 8ca713c commit e0da8f2

File tree

1 file changed

+105
-102
lines changed

1 file changed

+105
-102
lines changed

tests/e2e/specs/factory/NoSetupRepoFactory.spec.ts

Lines changed: 105 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -137,118 +137,121 @@ suite(
137137
).not.undefined;
138138
});
139139

140-
test('Make changes to the file', async function (): Promise<void> {
141-
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
142-
await projectSection.openItem(testRepoProjectName, fileToChange);
143-
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
144-
await driverHelper.getDriver().findElement(webCheCodeLocators.Editor.inputArea).click();
140+
// skip change/push tests for public GitHub repos without OAuth/PAT - only verify project was cloned
141+
if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER !== GitProviderType.GITHUB) {
142+
test('Make changes to the file', async function (): Promise<void> {
143+
Logger.debug(`projectSection.openItem: "${fileToChange}"`);
144+
await projectSection.openItem(testRepoProjectName, fileToChange);
145+
await driverHelper.waitVisibility(webCheCodeLocators.Editor.inputArea);
146+
await driverHelper.getDriver().findElement(webCheCodeLocators.Editor.inputArea).click();
145147

146-
Logger.debug('Clearing the editor with Ctrl+A');
147-
await driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys('a').keyUp(Key.CONTROL).perform();
148-
await driverHelper.wait(500);
149-
Logger.debug('Deleting selected text');
150-
await driverHelper.getDriver().actions().sendKeys(Key.DELETE).perform();
151-
await driverHelper.wait(500);
152-
Logger.debug(`Entering text: "${changesToCommit}"`);
153-
await driverHelper.getDriver().actions().sendKeys(changesToCommit).perform();
154-
});
148+
Logger.debug('Clearing the editor with Ctrl+A');
149+
await driverHelper.getDriver().actions().keyDown(Key.CONTROL).sendKeys('a').keyUp(Key.CONTROL).perform();
150+
await driverHelper.wait(500);
151+
Logger.debug('Deleting selected text');
152+
await driverHelper.getDriver().actions().sendKeys(Key.DELETE).perform();
153+
await driverHelper.wait(500);
154+
Logger.debug(`Entering text: "${changesToCommit}"`);
155+
await driverHelper.getDriver().actions().sendKeys(changesToCommit).perform();
156+
});
155157

156-
test('Open a source control manager', async function (): Promise<void> {
157-
const viewSourceControl: string = 'Source Control';
158-
const sourceControl: ViewControl = (await new ActivityBar().getViewControl(viewSourceControl)) as ViewControl;
159-
Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
160-
await sourceControl.openView();
161-
const scmView: NewScmView = new NewScmView();
162-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.inputField);
163-
let rest: SingleScmProvider[];
164-
[scmProvider, ...rest] = await scmView.getProviders();
165-
Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
166-
});
158+
test('Open a source control manager', async function (): Promise<void> {
159+
const viewSourceControl: string = 'Source Control';
160+
const sourceControl: ViewControl = (await new ActivityBar().getViewControl(viewSourceControl)) as ViewControl;
161+
Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
162+
await sourceControl.openView();
163+
const scmView: NewScmView = new NewScmView();
164+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.inputField);
165+
let rest: SingleScmProvider[];
166+
[scmProvider, ...rest] = await scmView.getProviders();
167+
Logger.debug(`scmView.getProviders: "${JSON.stringify(scmProvider)}, ${rest}"`);
168+
});
167169

168-
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
169-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
170-
await driverHelper.wait(timeToRefresh);
171-
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
172-
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
173-
// wait while changes counter will be refreshed
174-
await driverHelper.wait(timeToRefresh);
175-
const changes: number = await scmProvider.getChangeCount();
176-
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
177-
expect(changes).eql(1);
178-
});
170+
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
171+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
172+
await driverHelper.wait(timeToRefresh);
173+
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
174+
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
175+
// wait while changes counter will be refreshed
176+
await driverHelper.wait(timeToRefresh);
177+
const changes: number = await scmProvider.getChangeCount();
178+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
179+
expect(changes).eql(1);
180+
});
179181

180-
test('Stage the changes', async function (): Promise<void> {
181-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
182-
viewsActionsButton = await viewsMoreActionsButton.viewsAndMoreActionsButtonIsVisible();
183-
if (viewsActionsButton) {
184-
await viewsMoreActionsButton.closeSourceControlGraph();
185-
}
186-
scmContextMenu = await scmProvider.openMoreActions();
187-
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
188-
Logger.debug('scmContextMenu.select: "Changes" -> "Stage All Changes"');
189-
await scmContextMenu.select('Changes', 'Stage All Changes');
190-
});
182+
test('Stage the changes', async function (): Promise<void> {
183+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
184+
viewsActionsButton = await viewsMoreActionsButton.viewsAndMoreActionsButtonIsVisible();
185+
if (viewsActionsButton) {
186+
await viewsMoreActionsButton.closeSourceControlGraph();
187+
}
188+
scmContextMenu = await scmProvider.openMoreActions();
189+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.contextView);
190+
Logger.debug('scmContextMenu.select: "Changes" -> "Stage All Changes"');
191+
await scmContextMenu.select('Changes', 'Stage All Changes');
192+
});
191193

192-
test('Commit the changes', async function (): Promise<void> {
193-
Logger.info(`ScmView inputField locator: "${(webCheCodeLocators.ScmView as any).scmEditor}"`);
194-
Logger.debug('Click on the Scm Editor');
195-
await driverHelper
196-
.getDriver()
197-
.findElement((webCheCodeLocators.ScmView as any).scmEditor)
198-
.click();
199-
await sourceControlView.typeCommitMessage(changesToCommit);
200-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
201-
await driverHelper.wait(timeToRefresh);
202-
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
203-
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
204-
// wait while changes counter will be refreshed
205-
await driverHelper.wait(timeToRefresh);
206-
const changes: number = await scmProvider.getChangeCount();
207-
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
208-
expect(changes).eql(0);
209-
});
194+
test('Commit the changes', async function (): Promise<void> {
195+
Logger.info(`ScmView inputField locator: "${(webCheCodeLocators.ScmView as any).scmEditor}"`);
196+
Logger.debug('Click on the Scm Editor');
197+
await driverHelper
198+
.getDriver()
199+
.findElement((webCheCodeLocators.ScmView as any).scmEditor)
200+
.click();
201+
await sourceControlView.typeCommitMessage(changesToCommit);
202+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
203+
await driverHelper.wait(timeToRefresh);
204+
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
205+
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
206+
// wait while changes counter will be refreshed
207+
await driverHelper.wait(timeToRefresh);
208+
const changes: number = await scmProvider.getChangeCount();
209+
Logger.debug(`scmProvider.getChangeCount: number of changes is "${changes}"`);
210+
expect(changes).eql(0);
211+
});
210212

211-
test('Push the changes', async function (): Promise<void> {
212-
await driverHelper.waitVisibility(webCheCodeLocators.Notification.action);
213-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
214-
Logger.debug('scmProvider.openMoreActions');
215-
scmContextMenu = await scmProvider.openMoreActions();
216-
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
217-
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
218-
await scmContextMenu.select(pushItemLabel);
213+
test('Push the changes', async function (): Promise<void> {
214+
await driverHelper.waitVisibility(webCheCodeLocators.Notification.action);
215+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
216+
Logger.debug('scmProvider.openMoreActions');
217+
scmContextMenu = await scmProvider.openMoreActions();
218+
await driverHelper.waitVisibility(webCheCodeLocators.ContextMenu.itemConstructor(pushItemLabel));
219+
Logger.debug(`scmContextMenu.select: "${pushItemLabel}"`);
220+
await scmContextMenu.select(pushItemLabel);
219221

220-
if (await gitHubExtensionDialog.isDialogVisible()) {
221-
await gitHubExtensionDialog.closeDialog();
222-
}
222+
if (await gitHubExtensionDialog.isDialogVisible()) {
223+
await gitHubExtensionDialog.closeDialog();
224+
}
223225

224-
if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER !== GitProviderType.BITBUCKET_CLOUD_OAUTH2) {
225-
// wait for the user name input to appear and create an InputBox to enter the user name
226-
Logger.debug('Waiting for username input to appear');
227-
const inputUsername: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
228-
Logger.debug(`Setting username: "${OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME}"`);
229-
await inputUsername.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME);
230-
await inputUsername.confirm();
231-
}
226+
if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER !== GitProviderType.BITBUCKET_CLOUD_OAUTH2) {
227+
// wait for the user name input to appear and create an InputBox to enter the user name
228+
Logger.debug('Waiting for username input to appear');
229+
const inputUsername: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
230+
Logger.debug(`Setting username: "${OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME}"`);
231+
await inputUsername.setText(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME);
232+
await inputUsername.confirm();
233+
}
232234

233-
// wait for password input to appear after username confirmation
234-
Logger.debug('Waiting for password input to appear');
235-
const inputPassword: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
236-
Logger.debug('Setting password');
237-
await inputPassword.setText(FACTORY_TEST_CONSTANTS.TS_GIT_PERSONAL_ACCESS_TOKEN);
238-
await inputPassword.confirm();
239-
});
235+
// wait for password input to appear after username confirmation
236+
Logger.debug('Waiting for password input to appear');
237+
const inputPassword: InputBox = await InputBox.create(TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
238+
Logger.debug('Setting password');
239+
await inputPassword.setText(FACTORY_TEST_CONSTANTS.TS_GIT_PERSONAL_ACCESS_TOKEN);
240+
await inputPassword.confirm();
241+
});
240242

241-
test('Check if the changes were pushed', async function (): Promise<void> {
242-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
243-
await driverHelper.wait(timeToRefresh);
244-
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
245-
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
246-
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
247-
webCheCodeLocators.Notification.action,
248-
'aria-disabled'
249-
);
250-
expect(isCommitButtonDisabled).to.equal('true');
251-
});
243+
test('Check if the changes were pushed', async function (): Promise<void> {
244+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
245+
await driverHelper.wait(timeToRefresh);
246+
Logger.debug(`wait and click on: "${refreshButtonLabel}"`);
247+
await driverHelper.waitAndClick(webCheCodeLocators.ScmView.actionConstructor(refreshButtonLabel));
248+
const isCommitButtonDisabled: string = await driverHelper.waitAndGetElementAttribute(
249+
webCheCodeLocators.Notification.action,
250+
'aria-disabled'
251+
);
252+
expect(isCommitButtonDisabled).to.equal('true');
253+
});
254+
}
252255
}
253256

254257
suiteTeardown('Open dashboard and close all other tabs', async function (): Promise<void> {

0 commit comments

Comments
 (0)