Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/e2e/pageobjects/ide/CheCodeLocatorLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class CheCodeLocatorLoader extends LocatorLoader {
return {
locators: {
WelcomeContent: {
text: By.xpath('//*[@class="dialog-message-text" and contains(text(), "trust")]'),
text: By.xpath('//*[@class="dialog-message-text" and contains(text(), "trust the authors")]'),
button: By.xpath('//div[@class="monaco-dialog-box"]//a[@class="monaco-button monaco-text-button"]')
},
ScmView: {
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/specs/SmokeTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ suite(`The SmokeTest userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, functio
expect(await projectAndFileTests.getProjectTreeItem(projectSection, projectName), 'Project folder was not imported').not
.undefined;
});
test('Accept the project as a trusted one', async function (): Promise<void> {
await projectAndFileTests.performTrustAuthorDialog();
});
test('Check the project files was imported', async function (): Promise<void> {
expect(
await projectAndFileTests.getProjectTreeItem(projectSection, BASE_TEST_CONSTANTS.TS_SELENIUM_PROJECT_ROOT_FILE_NAME),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ oc logs test-hello-pod

test('Check the project files were imported', async function (): Promise<void> {
const projectSection: ViewSection = await projectAndFileTests.getProjectViewSession();
expect(await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile.x86_64'), 'Dockerfile not found in the project tree').not.undefined;
expect(
await projectAndFileTests.getProjectTreeItem(projectSection, 'Dockerfile.x86_64'),
'Dockerfile not found in the project tree'
).not.undefined;
});

test('Build and push container image from workspace', function (): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/dashboard-samples/Quarkus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ suite(`The ${stackName} userstory ${BASE_TEST_CONSTANTS.TEST_ENVIRONMENT}`, func
});

test('Accept the project as a trusted one', async function (): Promise<void> {
await projectAndFileTests.performTrustAuthorDialog();
await projectAndFileTests.performTrustAuthorAndPublisherDialog();
});

test('Check the project files was imported', async function (): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ for (const sample of samples) {
});

test('Accept the project as a trusted one', async function (): Promise<void> {
await projectAndFileTests.performTrustAuthorDialog();
await projectAndFileTests.performTrustAuthorAndPublisherDialog();
});

test('Check the project files were imported', async function (): Promise<void> {
Expand Down
34 changes: 34 additions & 0 deletions tests/e2e/tests-library/ProjectAndFileTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { RestrictedModeButton } from '../pageobjects/ide/RestrictedModeButton';
@injectable()
export class ProjectAndFileTests {
private static BRANCH_NAME_XPATH: By = By.xpath('//a[contains(@aria-label,"Checkout Branch/Tag...")]');
private static TRUST_PUBLISHER_BOX: By = By.xpath('//*[@class="dialog-message-text" and contains(text(), "trust the publisher")]');

constructor(
@inject(CLASSES.DriverHelper)
Expand Down Expand Up @@ -93,6 +94,39 @@ export class ProjectAndFileTests {
}
}

/**
* perform to 'Trust Publisher' dialog box, when it appears
*/
async performTrustPublisherDialog(): Promise<void> {
Logger.debug();

try {
// add TS_IDE_LOAD_TIMEOUT timeout for waiting for appearing the box
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_IDE_LOAD_TIMEOUT);
await this.driverHelper.waitVisibility(
ProjectAndFileTests.TRUST_PUBLISHER_BOX,
TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
);
await this.driverHelper.waitAndClick(
this.cheCodeLocatorLoader.webCheCodeLocators.WelcomeContent.button,
TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
);
} catch (e) {
Logger.info('"Do you trust the publisher?" dialog box was not shown');
}
}

/**
* perform to 'Trust Authors' dialog box, when it appears
* perform to 'Trust Publisher' dialog box, when it appears
*/
async performTrustAuthorAndPublisherDialog(): Promise<void> {
Logger.debug();
await this.performTrustAuthorDialog();
await this.performTrustPublisherDialog();
await this.performTrustAuthorDialog();
}

/**
* find an ViewSection with project tree.
* @returns Promise resolving to ViewSection object
Expand Down