Skip to content

Commit

Permalink
CRW-3566: Empty workspace project export API test: added CloneGitRepo…
Browse files Browse the repository at this point in the history
…API.spec.ts, OpenshiftHelper (eclipse-che#22129)

* added CloneGitRepoAPI.spec.ts, OpenshiftClientExecutor

Signed-off-by: mdolhalo <mdolhalo@redhat.com>

* README.md updated

Signed-off-by: mdolhalo <mdolhalo@redhat.com>

* package.json, package-lock.json updated

Signed-off-by: mdolhalo <mdolhalo@redhat.com>

---------

Signed-off-by: mdolhalo <mdolhalo@redhat.com>
Co-authored-by: Maryna Dolhalova <mdolhalo@redhat.com>
  • Loading branch information
nallikaea and Maryna Dolhalova authored Apr 12, 2023
1 parent bb0dffc commit 6e179e6
Show file tree
Hide file tree
Showing 18 changed files with 2,225 additions and 22 deletions.
1 change: 1 addition & 0 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Note: If there is any modifications in package.json, manually execute the `npm i
- Use environment variables which described in the **```'TestConstants.ts'```** file
- Use environment variables for setting timeouts if needed. You can see the list in **```'TimeoutConstants.ts'```**. You can see the list of those variables and their value if you set the ```'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'```
- To test one specification export file name as ```export USERSTORY=<spec-file-name-without-extension> && npm run test``` (example: ```-e USERSTORY=Quarkus```)
- To run test without Selenium WebDriver (API tests etc.) use ```export USERSTORY=<spec-file-name-without-extension> && npm run driver-less-test``` (example: ```-e USERSTORY=CloneGitRepoAPI```)

## Docker launch

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/configs/sh-scripts/initDevfileTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
########################################

launchUserstories(){
export MOCHA_DIRECTORY=${MOCHA_DIRECTORY:-"devfiles"}
export MOCHA_DIRECTORY=${MOCHA_DIRECTORY:-"dashboard-samples"}
echo "MOCHA_DIRECTORY = ${MOCHA_DIRECTORY}"
npm run lint && npm run tsc && mocha --config dist/configs/mocharc.js
}
Expand Down
16 changes: 12 additions & 4 deletions tests/e2e/constants/TestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ export const TestConstants: any = {
TS_SELENIUM_BASE_URL: getBaseUrl(),

/**
* Run browser in "Headless" (hiden) mode, "false" by default.
* Run browser in "Headless" (hidden) mode, "false" by default.
*/
TS_SELENIUM_HEADLESS: process.env.TS_SELENIUM_HEADLESS === 'true',

/**
* Create instance of chromedriver, "true" by default. Should be "false" to run only API tests.
*/
TS_USE_WEB_DRIVER_FOR_TEST: process.env.TS_USE_WEB_DRIVER_FOR_TEST !== 'false',

/**
* Run browser in "Fullscreen" (kiosk) mode.
* Default to true if undefined
Expand Down Expand Up @@ -203,7 +208,7 @@ export const TestConstants: any = {

TS_SELENIUM_FACTORY_GIT_REPO_URL: process.env.TS_SELENIUM_FACTORY_GIT_REPO_URL || '',

TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO: true,
TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO: process.env.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO === 'true',

TS_SELENIUM_FACTORY_GIT_REPO_BRANCH: process.env.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH || 'master',

Expand All @@ -215,10 +220,13 @@ export const TestConstants: any = {

TS_SELENIUM_GIT_PROVIDER_PASSWORD: process.env.TS_SELENIUM_GIT_PROVIDER_PASSWORD || '',

TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN: process.env.TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN || false,
TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN: process.env.TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN === 'true',

TS_SELENIUM_GIT_PROVIDER_OAUTH: process.env.TS_SELENIUM_GIT_PROVIDER_OAUTH || false,
TS_SELENIUM_GIT_PROVIDER_OAUTH: process.env.TS_SELENIUM_GIT_PROVIDER_OAUTH === 'true',

TS_SELENIUM_PROJECT_ROOT_FILE_NAME: process.env.TS_SELENIUM_PROJECT_ROOT_FILE_NAME || 'devfile.yaml',

TS_API_TEST_UDI_IMAGE: process.env.TS_API_TEST_UDI_IMAGE || 'quay.io/devfile/universal-developer-image:latest',

TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI: process.env.TS_API_TEST_CHE_CODE_EDITOR_DEVFILE_URI || `https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml`
};
10 changes: 6 additions & 4 deletions tests/e2e/driver/ChromeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ import { TestConstants } from '../constants/TestConstants';

@injectable()
export class ChromeDriver implements IDriver {
private readonly driver: ThenableWebDriver;
private readonly driver: ThenableWebDriver | undefined;

constructor() {
const options: Options = this.getDriverOptions();
this.driver = this.getDriverBuilder(options).build();
if (TestConstants.TS_USE_WEB_DRIVER_FOR_TEST) {
this.driver = this.getDriverBuilder(options).build();
}
}

get(): ThenableWebDriver {
return this.driver;
return this.driver as ThenableWebDriver;
}

async setWindowSize(): Promise<void> {
await this.driver
await (this.driver as ThenableWebDriver)
.manage()
.window()
.setSize(TestConstants.TS_SELENIUM_RESOLUTION_WIDTH, TestConstants.TS_SELENIUM_RESOLUTION_HEIGHT);
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './driver/IDriver';
export * from './utils/BrowserTabsUtil';
export * from './utils/DriverHelper';
export * from './utils/Logger';
export * from './utils/OpenshiftClientExecutor';
export * from './utils/request-handlers/CheApiRequestHandler';
export * from './utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler';
export * from './utils/request-handlers/headers/IAuthorizationHeaderHandler';
Expand Down
Loading

0 comments on commit 6e179e6

Please sign in to comment.