Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion connect-automation/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"notificationsUrl": "https://connect.topcoder-dev.com/notifications",
"allProjectsUrl": "https://connect.topcoder-dev.com/projects",
"givenProjectUrl": "https://connect.topcoder-dev.com/projects/18013",
"expiredProjectUrl": "https://connect.topcoder-dev.com/projects/17236"
"expiredProjectUrl": "https://connect.topcoder-dev.com/projects/17236",
"platformUrl": "https://platform.topcoder-dev.com/taas/myteams"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BrowserHelper } from 'topcoder-testing-lib';
import { ConfigHelper } from '../../../utils/config-helper';
import { CommonHelper } from '../../common-page/common.helper';
import { IAnswers, IProjectData } from './create-project.model';
import { IAnswers, IProjectData, ITaasData } from './create-project.model';
import { CreateProjectPageObject } from './create-project.po';

export class CreateProjectPageHelper {
Expand Down Expand Up @@ -29,8 +30,8 @@ export class CreateProjectPageHelper {

await this.clickNewProjectButton();
await this.navigateToViewSolutions();
await this.clickOnDesignDevelopmentDeploymentButton();
await this.fillBeforeWeStartForm(projectData.answers);
await this.clickOnSelectButton();
await this.fillBeforeWeStartForm(projectData.answers, 'Basic Details');
await this.fillBasicDetailsForm(
appNameWithDate,
projectData.appDescription
Expand All @@ -40,6 +41,29 @@ export class CreateProjectPageHelper {
await this.goToYourProject(appNameWithDate);
}

/**
* verify whether the current user can create a TAAS project
*/
public static async verifyTaasProject(taasData: ITaasData) {
await this.clickNewProjectButton();
await this.navigateToTopTalent();
await this.clickOnSelectButton();
await this.fillBeforeWeStartForm(taasData.answers, 'Talent as a Service: Getting Started');
await this.fillTaasProjectTitleForm(taasData.title);
await this.verifyAddJobItem();
await this.verifyDeleteJobItem();
await this.fillJobForm(taasData);
await this.fillTalentRequirementForm(taasData.answers, 'Your Talent Requirements');
await this.fillRequirementForm(taasData.answers, taasData.email);

await this.createProjectPageObject.submitJobRequest.click();
await CommonHelper.verifySuccessAlert(`PROJECT '${taasData.title.toUpperCase()}' CREATED`);

await this.createProjectPageObject.viewTalentRequestButton.click();
await BrowserHelper.sleep(10000);
await CommonHelper.verifyPageUrl(ConfigHelper.getPlatformUrl());
}

private static createProjectPageObject: CreateProjectPageObject;

/**
Expand Down Expand Up @@ -100,10 +124,19 @@ export class CreateProjectPageHelper {
expect(title).toBe('TOPCODER SOLUTIONS');
}

/**
* Click on "Tap Into Top Talen" under "TAAS" section
*/
private static async navigateToTopTalent() {
await this.createProjectPageObject.tapIntoTopTalent.click();
const title = await this.createProjectPageObject.solutionCatalogTitle.getText();
expect(title).toBe('ENGAGE TALENT');
}

/**
* Click on "Select" button under Design, Development and Deployment.
*/
private static async clickOnDesignDevelopmentDeploymentButton() {
private static async clickOnSelectButton() {
const selectButton = await this.createProjectPageObject.selectButton();
await selectButton.click();
await this.verifyFormDisplayed('Before we start');
Expand All @@ -112,14 +145,29 @@ export class CreateProjectPageHelper {
/**
* Fill Before We Start form
* @param answers answers object defined by test data
* @param formTitle form title to be expected
*/
private static async fillBeforeWeStartForm(answers: IAnswers) {
private static async fillBeforeWeStartForm(answers: IAnswers, formTitle: string) {
const { beforeWeStart } = answers;
await CommonHelper.selectInputByContainingText(beforeWeStart);

await this.createProjectPageObject.nextButton.click();

await this.verifyFormDisplayed('Basic Details');
await this.verifyFormDisplayed(formTitle);
}

/**
* Fill Before We Start form
* @param answers answers object defined by test data
* @param formTitle form title to be expected
*/
private static async fillTalentRequirementForm(answers: IAnswers, formTitle: string) {
const { startDate } = answers;
await CommonHelper.selectInputByContainingText(startDate);

await this.createProjectPageObject.nextButton.click();

await this.verifyFormDisplayed(formTitle);
}

/**
Expand All @@ -138,6 +186,69 @@ export class CreateProjectPageHelper {
await this.verifyFormDisplayed('App Definition');
}

/**
* Fill Taas Project title, then click next
* @param title taas application title
*/
private static async fillTaasProjectTitleForm(title: string) {
const name = this.createProjectPageObject.appNameInput;
await CommonHelper.fillInputField(name, title);
await this.createProjectPageObject.nextButton.click();

await this.verifyFormDisplayed('Your Talent Requirements');
}

/**
* Fill Requirement Form, then click next
* @param title taas application title
* @param email
*/
private static async fillRequirementForm(answers: IAnswers, email: string) {
const { requirement } = answers;
await CommonHelper.selectInputByContainingText(requirement);

await this.createProjectPageObject.emailInput.click();
await this.createProjectPageObject.emailInput.sendKeys(email);

await this.createProjectPageObject.nextButton.click();
}

/**
* Fill Taas Job Form
* @param taasData
*/
private static async fillJobForm(taasData: ITaasData) {
const { jobTitle, numOfPeople, duration, description } = taasData;

const titleEl = this.createProjectPageObject.titleInput;
await CommonHelper.fillInputField(titleEl, jobTitle);

const numberInputs = await this.createProjectPageObject.numberInputEls();
await CommonHelper.fillInputField(numberInputs[0], numOfPeople + '');
await CommonHelper.fillInputField(numberInputs[1], duration + '');

const dropdownInputs = await this.createProjectPageObject.dropdownEls();
await dropdownInputs[0].click();
let dropdownOptions = await this.createProjectPageObject.dropdownOptions();
await dropdownOptions[1].click();

await dropdownInputs[1].click();
dropdownOptions = await this.createProjectPageObject.dropdownOptions();
await BrowserHelper.sleep(200);
await dropdownOptions[6].click();

await this.createProjectPageObject.editorTextarea.click();
await this.createProjectPageObject.editorTextareaInput.sendKeys(description);

await this.createProjectPageObject.skillsInput.click();
await BrowserHelper.sleep(2500);
await this.createProjectPageObject.multiSelectOption.click();

await this.createProjectPageObject.nextButton.click();

await this.verifyFormDisplayed('Your Talent Requirements');
}

/**
* Fill App Definition Form, then click next
* @param projectData project data from test data
Expand Down Expand Up @@ -191,4 +302,22 @@ export class CreateProjectPageHelper {

expect(await CommonHelper.projectTitle().getText()).toBe(appName);
}

/**
* Add job item and verify Add Job Item
*/
private static async verifyAddJobItem() {
await this.createProjectPageObject.plusIcon.click();
let jobFormNumber = await this.createProjectPageObject.taasJobForm();
expect(jobFormNumber.length).toBe(2);
}

/**
* Delete job item and verify Deletion of Job Item
*/
private static async verifyDeleteJobItem() {
await this.createProjectPageObject.deleteIcon.click();
const jobFormNumber = await this.createProjectPageObject.taasJobForm();
expect(jobFormNumber.length).toBe(1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ export interface IProjectData {
notes: string;
}

export interface ITaasData {
title: string;
jobTitle: string;
numOfPeople: number;
duration: number;
description: string;
email: string;
answers: IAnswers;
}

export interface IAnswers {
beforeWeStart: string;
whatDoYouNeed: string;
willYourAppNeedMoreScreen: string;
howManyScreens: string;
whereShouldAppWork: string;
howShouldAppWorks: string;
whatDoYouNeed?: string;
willYourAppNeedMoreScreen?: string;
howManyScreens?: string;
whereShouldAppWork?: string;
howShouldAppWorks?: string;
startDate?: string;
requirement?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export class CreateProjectPageObject {
return ElementHelper.getElementByButtonText('View Solutions');
}

/**
* Get Tap Into Top Talent button from Create Project Page
*/
public get tapIntoTopTalent() {
return ElementHelper.getElementByButtonText('Tap Into Top Talent');
}

/**
* Get Solution Catalog Page's title element
*/
Expand Down Expand Up @@ -74,6 +81,20 @@ export class CreateProjectPageObject {
return ElementHelper.getElementByButtonText('Save my project');
}

/**
* Get Submit Job Request button
*/
public get submitJobRequest() {
return ElementHelper.getElementByButtonText('Submit job request');
}

/**
* Get view Talent Request button
*/
public get viewTalentRequestButton() {
return ElementHelper.getElementByCss('.go-to-project-dashboard-btn');
}

/**
* Get Current Form Page's title element
*/
Expand Down Expand Up @@ -104,6 +125,20 @@ export class CreateProjectPageObject {
return ElementHelper.getElementByName('description');
}

/**
* Get job title element
*/
public get titleInput() {
return ElementHelper.getElementByName('title');
}

/**
* Get email input element
*/
public get emailInput() {
return ElementHelper.getElementByName('details.taasDefinition.hiringManager');
}

/**
* Get Draft Project title
*/
Expand All @@ -125,6 +160,27 @@ export class CreateProjectPageObject {
return ElementHelper.getElementByName('details.apiDefinition.notes');
}

/**
* Get plus icon
*/
public get plusIcon() {
return ElementHelper.getElementByClassName('ZALPRV');
}

/**
* Get delete icon
*/
public get deleteIcon() {
return ElementHelper.getElementByCss('.ZALPRV._1SfKng');
}

/**
* Get taas job form
*/
public async taasJobForm() {
return ElementHelper.getAllElementsByClassName('_3mAtc-');
}

/**
* Get sub title
*/
Expand All @@ -134,6 +190,58 @@ export class CreateProjectPageObject {
);
}

/**
* Get number input elements
*/
public async numberInputEls() {
const els = await ElementHelper.getAllElementsByCss('.tc-file-field__inputs.trlMaU');
return els;
}

/**
* Get dropdown elements
*/
public async dropdownEls() {
const els = await ElementHelper.getAllElementsByCss('.dropdown-wrap.SelectDropdown.default');
return els;
}

/**
* Get dropdown options
*/
public async dropdownOptions() {
const els = await ElementHelper.getAllElementsByClassName('dropdown-menu-list-item');
return els;
}

/**
* Get editor textarea
*/
public get editorTextarea() {
return ElementHelper.getElementByClassName('te-editor-section');
}

/**
* Get editor textarea input
*/
public get editorTextareaInput() {
return ElementHelper.getElementByCss('.tui-editor-contents.tui-editor-contents-placeholder');
}

/**
* Get skills input
*/
public get skillsInput() {
return ElementHelper.getElementByCss('.css-1hwfws3.react-select__value-container.react-select__value-container--is-multi');
}

/**
* Get multi select option
*/
public get multiSelectOption() {
return ElementHelper.getElementByCss('.css-fk865s-option.react-select__option');
}

/**
* Wait for subtitle to show
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ProjectsHelper {
* @param searchProject object for search
*/
public static async verifyProjectSearch(searchProject: ISearchProject) {
await BrowserHelper.sleep(8000);
await BrowserHelper.sleep(3000);
const allProjectsBeforeSearch = await this.projectsPageObject.projectTitles();
const beforeSearchLength = allProjectsBeforeSearch.length;
const firstProjectBeforeSearch = await allProjectsBeforeSearch[0].getText();
Expand Down Expand Up @@ -129,6 +129,7 @@ export class ProjectsHelper {
* @param searchTerm search term
*/
private static async verifyProjectWithRef(searchTerm: string) {
await BrowserHelper.sleep(5000);
const ref = await this.projectsPageObject.refText.getText();
expect(ref).toBe(searchTerm);

Expand Down
Loading