Skip to content

Commit dc4fb9e

Browse files
nursoltan-stc_user
andauthored
Add taas test (#4403)
* fix tc_004 test * add taas project creation test Co-authored-by: tc_user <vijay.86@wipro.com>
1 parent 6d779da commit dc4fb9e

File tree

7 files changed

+286
-12
lines changed

7 files changed

+286
-12
lines changed

connect-automation/config/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
"notificationsUrl": "https://connect.topcoder-dev.com/notifications",
2525
"allProjectsUrl": "https://connect.topcoder-dev.com/projects",
2626
"givenProjectUrl": "https://connect.topcoder-dev.com/projects/18013",
27-
"expiredProjectUrl": "https://connect.topcoder-dev.com/projects/17236"
27+
"expiredProjectUrl": "https://connect.topcoder-dev.com/projects/17236",
28+
"platformUrl": "https://platform.topcoder-dev.com/taas/myteams"
2829
}

connect-automation/page-objects/project-creation-flow/create-project/create-project.helper.ts

Lines changed: 135 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BrowserHelper } from 'topcoder-testing-lib';
2+
import { ConfigHelper } from '../../../utils/config-helper';
23
import { CommonHelper } from '../../common-page/common.helper';
3-
import { IAnswers, IProjectData } from './create-project.model';
4+
import { IAnswers, IProjectData, ITaasData } from './create-project.model';
45
import { CreateProjectPageObject } from './create-project.po';
56

67
export class CreateProjectPageHelper {
@@ -29,8 +30,8 @@ export class CreateProjectPageHelper {
2930

3031
await this.clickNewProjectButton();
3132
await this.navigateToViewSolutions();
32-
await this.clickOnDesignDevelopmentDeploymentButton();
33-
await this.fillBeforeWeStartForm(projectData.answers);
33+
await this.clickOnSelectButton();
34+
await this.fillBeforeWeStartForm(projectData.answers, 'Basic Details');
3435
await this.fillBasicDetailsForm(
3536
appNameWithDate,
3637
projectData.appDescription
@@ -40,6 +41,29 @@ export class CreateProjectPageHelper {
4041
await this.goToYourProject(appNameWithDate);
4142
}
4243

44+
/**
45+
* verify whether the current user can create a TAAS project
46+
*/
47+
public static async verifyTaasProject(taasData: ITaasData) {
48+
await this.clickNewProjectButton();
49+
await this.navigateToTopTalent();
50+
await this.clickOnSelectButton();
51+
await this.fillBeforeWeStartForm(taasData.answers, 'Talent as a Service: Getting Started');
52+
await this.fillTaasProjectTitleForm(taasData.title);
53+
await this.verifyAddJobItem();
54+
await this.verifyDeleteJobItem();
55+
await this.fillJobForm(taasData);
56+
await this.fillTalentRequirementForm(taasData.answers, 'Your Talent Requirements');
57+
await this.fillRequirementForm(taasData.answers, taasData.email);
58+
59+
await this.createProjectPageObject.submitJobRequest.click();
60+
await CommonHelper.verifySuccessAlert(`PROJECT '${taasData.title.toUpperCase()}' CREATED`);
61+
62+
await this.createProjectPageObject.viewTalentRequestButton.click();
63+
await BrowserHelper.sleep(10000);
64+
await CommonHelper.verifyPageUrl(ConfigHelper.getPlatformUrl());
65+
}
66+
4367
private static createProjectPageObject: CreateProjectPageObject;
4468

4569
/**
@@ -100,10 +124,19 @@ export class CreateProjectPageHelper {
100124
expect(title).toBe('TOPCODER SOLUTIONS');
101125
}
102126

127+
/**
128+
* Click on "Tap Into Top Talen" under "TAAS" section
129+
*/
130+
private static async navigateToTopTalent() {
131+
await this.createProjectPageObject.tapIntoTopTalent.click();
132+
const title = await this.createProjectPageObject.solutionCatalogTitle.getText();
133+
expect(title).toBe('ENGAGE TALENT');
134+
}
135+
103136
/**
104137
* Click on "Select" button under Design, Development and Deployment.
105138
*/
106-
private static async clickOnDesignDevelopmentDeploymentButton() {
139+
private static async clickOnSelectButton() {
107140
const selectButton = await this.createProjectPageObject.selectButton();
108141
await selectButton.click();
109142
await this.verifyFormDisplayed('Before we start');
@@ -112,14 +145,29 @@ export class CreateProjectPageHelper {
112145
/**
113146
* Fill Before We Start form
114147
* @param answers answers object defined by test data
148+
* @param formTitle form title to be expected
115149
*/
116-
private static async fillBeforeWeStartForm(answers: IAnswers) {
150+
private static async fillBeforeWeStartForm(answers: IAnswers, formTitle: string) {
117151
const { beforeWeStart } = answers;
118152
await CommonHelper.selectInputByContainingText(beforeWeStart);
119153

120154
await this.createProjectPageObject.nextButton.click();
121155

122-
await this.verifyFormDisplayed('Basic Details');
156+
await this.verifyFormDisplayed(formTitle);
157+
}
158+
159+
/**
160+
* Fill Before We Start form
161+
* @param answers answers object defined by test data
162+
* @param formTitle form title to be expected
163+
*/
164+
private static async fillTalentRequirementForm(answers: IAnswers, formTitle: string) {
165+
const { startDate } = answers;
166+
await CommonHelper.selectInputByContainingText(startDate);
167+
168+
await this.createProjectPageObject.nextButton.click();
169+
170+
await this.verifyFormDisplayed(formTitle);
123171
}
124172

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

189+
/**
190+
* Fill Taas Project title, then click next
191+
* @param title taas application title
192+
*/
193+
private static async fillTaasProjectTitleForm(title: string) {
194+
const name = this.createProjectPageObject.appNameInput;
195+
await CommonHelper.fillInputField(name, title);
196+
await this.createProjectPageObject.nextButton.click();
197+
198+
await this.verifyFormDisplayed('Your Talent Requirements');
199+
}
200+
201+
/**
202+
* Fill Requirement Form, then click next
203+
* @param title taas application title
204+
* @param email
205+
*/
206+
private static async fillRequirementForm(answers: IAnswers, email: string) {
207+
const { requirement } = answers;
208+
await CommonHelper.selectInputByContainingText(requirement);
209+
210+
await this.createProjectPageObject.emailInput.click();
211+
await this.createProjectPageObject.emailInput.sendKeys(email);
212+
213+
await this.createProjectPageObject.nextButton.click();
214+
}
215+
216+
/**
217+
* Fill Taas Job Form
218+
* @param taasData
219+
*/
220+
private static async fillJobForm(taasData: ITaasData) {
221+
const { jobTitle, numOfPeople, duration, description } = taasData;
222+
223+
const titleEl = this.createProjectPageObject.titleInput;
224+
await CommonHelper.fillInputField(titleEl, jobTitle);
225+
226+
const numberInputs = await this.createProjectPageObject.numberInputEls();
227+
await CommonHelper.fillInputField(numberInputs[0], numOfPeople + '');
228+
await CommonHelper.fillInputField(numberInputs[1], duration + '');
229+
230+
const dropdownInputs = await this.createProjectPageObject.dropdownEls();
231+
await dropdownInputs[0].click();
232+
let dropdownOptions = await this.createProjectPageObject.dropdownOptions();
233+
await dropdownOptions[1].click();
234+
235+
await dropdownInputs[1].click();
236+
dropdownOptions = await this.createProjectPageObject.dropdownOptions();
237+
await BrowserHelper.sleep(200);
238+
await dropdownOptions[6].click();
239+
240+
await this.createProjectPageObject.editorTextarea.click();
241+
await this.createProjectPageObject.editorTextareaInput.sendKeys(description);
242+
243+
await this.createProjectPageObject.skillsInput.click();
244+
await BrowserHelper.sleep(2500);
245+
await this.createProjectPageObject.multiSelectOption.click();
246+
247+
await this.createProjectPageObject.nextButton.click();
248+
249+
await this.verifyFormDisplayed('Your Talent Requirements');
250+
}
251+
141252
/**
142253
* Fill App Definition Form, then click next
143254
* @param projectData project data from test data
@@ -191,4 +302,22 @@ export class CreateProjectPageHelper {
191302

192303
expect(await CommonHelper.projectTitle().getText()).toBe(appName);
193304
}
305+
306+
/**
307+
* Add job item and verify Add Job Item
308+
*/
309+
private static async verifyAddJobItem() {
310+
await this.createProjectPageObject.plusIcon.click();
311+
let jobFormNumber = await this.createProjectPageObject.taasJobForm();
312+
expect(jobFormNumber.length).toBe(2);
313+
}
314+
315+
/**
316+
* Delete job item and verify Deletion of Job Item
317+
*/
318+
private static async verifyDeleteJobItem() {
319+
await this.createProjectPageObject.deleteIcon.click();
320+
const jobFormNumber = await this.createProjectPageObject.taasJobForm();
321+
expect(jobFormNumber.length).toBe(1);
322+
}
194323
}

connect-automation/page-objects/project-creation-flow/create-project/create-project.model.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@ export interface IProjectData {
55
notes: string;
66
}
77

8+
export interface ITaasData {
9+
title: string;
10+
jobTitle: string;
11+
numOfPeople: number;
12+
duration: number;
13+
description: string;
14+
email: string;
15+
answers: IAnswers;
16+
}
17+
818
export interface IAnswers {
919
beforeWeStart: string;
10-
whatDoYouNeed: string;
11-
willYourAppNeedMoreScreen: string;
12-
howManyScreens: string;
13-
whereShouldAppWork: string;
14-
howShouldAppWorks: string;
20+
whatDoYouNeed?: string;
21+
willYourAppNeedMoreScreen?: string;
22+
howManyScreens?: string;
23+
whereShouldAppWork?: string;
24+
howShouldAppWorks?: string;
25+
startDate?: string;
26+
requirement?: string;
1527
}

connect-automation/page-objects/project-creation-flow/create-project/create-project.po.ts

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ export class CreateProjectPageObject {
3333
return ElementHelper.getElementByButtonText('View Solutions');
3434
}
3535

36+
/**
37+
* Get Tap Into Top Talent button from Create Project Page
38+
*/
39+
public get tapIntoTopTalent() {
40+
return ElementHelper.getElementByButtonText('Tap Into Top Talent');
41+
}
42+
3643
/**
3744
* Get Solution Catalog Page's title element
3845
*/
@@ -74,6 +81,20 @@ export class CreateProjectPageObject {
7481
return ElementHelper.getElementByButtonText('Save my project');
7582
}
7683

84+
/**
85+
* Get Submit Job Request button
86+
*/
87+
public get submitJobRequest() {
88+
return ElementHelper.getElementByButtonText('Submit job request');
89+
}
90+
91+
/**
92+
* Get view Talent Request button
93+
*/
94+
public get viewTalentRequestButton() {
95+
return ElementHelper.getElementByCss('.go-to-project-dashboard-btn');
96+
}
97+
7798
/**
7899
* Get Current Form Page's title element
79100
*/
@@ -104,6 +125,20 @@ export class CreateProjectPageObject {
104125
return ElementHelper.getElementByName('description');
105126
}
106127

128+
/**
129+
* Get job title element
130+
*/
131+
public get titleInput() {
132+
return ElementHelper.getElementByName('title');
133+
}
134+
135+
/**
136+
* Get email input element
137+
*/
138+
public get emailInput() {
139+
return ElementHelper.getElementByName('details.taasDefinition.hiringManager');
140+
}
141+
107142
/**
108143
* Get Draft Project title
109144
*/
@@ -125,6 +160,27 @@ export class CreateProjectPageObject {
125160
return ElementHelper.getElementByName('details.apiDefinition.notes');
126161
}
127162

163+
/**
164+
* Get plus icon
165+
*/
166+
public get plusIcon() {
167+
return ElementHelper.getElementByClassName('ZALPRV');
168+
}
169+
170+
/**
171+
* Get delete icon
172+
*/
173+
public get deleteIcon() {
174+
return ElementHelper.getElementByCss('.ZALPRV._1SfKng');
175+
}
176+
177+
/**
178+
* Get taas job form
179+
*/
180+
public async taasJobForm() {
181+
return ElementHelper.getAllElementsByClassName('_3mAtc-');
182+
}
183+
128184
/**
129185
* Get sub title
130186
*/
@@ -134,6 +190,58 @@ export class CreateProjectPageObject {
134190
);
135191
}
136192

193+
/**
194+
* Get number input elements
195+
*/
196+
public async numberInputEls() {
197+
const els = await ElementHelper.getAllElementsByCss('.tc-file-field__inputs.trlMaU');
198+
return els;
199+
}
200+
201+
/**
202+
* Get dropdown elements
203+
*/
204+
public async dropdownEls() {
205+
const els = await ElementHelper.getAllElementsByCss('.dropdown-wrap.SelectDropdown.default');
206+
return els;
207+
}
208+
209+
/**
210+
* Get dropdown options
211+
*/
212+
public async dropdownOptions() {
213+
const els = await ElementHelper.getAllElementsByClassName('dropdown-menu-list-item');
214+
return els;
215+
}
216+
217+
/**
218+
* Get editor textarea
219+
*/
220+
public get editorTextarea() {
221+
return ElementHelper.getElementByClassName('te-editor-section');
222+
}
223+
224+
/**
225+
* Get editor textarea input
226+
*/
227+
public get editorTextareaInput() {
228+
return ElementHelper.getElementByCss('.tui-editor-contents.tui-editor-contents-placeholder');
229+
}
230+
231+
/**
232+
* Get skills input
233+
*/
234+
public get skillsInput() {
235+
return ElementHelper.getElementByCss('.css-1hwfws3.react-select__value-container.react-select__value-container--is-multi');
236+
}
237+
238+
/**
239+
* Get multi select option
240+
*/
241+
public get multiSelectOption() {
242+
return ElementHelper.getElementByCss('.css-fk865s-option.react-select__option');
243+
}
244+
137245
/**
138246
* Wait for subtitle to show
139247
*/

connect-automation/test-data/test-data.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@
2626
},
2727
"notes": "Notes from test"
2828
},
29+
"taas": {
30+
"title": "test Taas Project",
31+
"jobTitle": "Test Job Title",
32+
"email": "mailmemakar@gmail.com",
33+
"numOfPeople": 4,
34+
"duration": 10,
35+
"description": "test description",
36+
"answers": {
37+
"beforeWeStart": "I need work done",
38+
"startDate": "As soon as possible",
39+
"requirement": "No additional onboarding processes are required"
40+
}
41+
},
2942
"inviteCopilot": {
3043
"copilotHandle": "TCConnCopilot"
3144
},

0 commit comments

Comments
 (0)