· 6 years ago · Feb 08, 2020, 08:58 AM
1
2import { browser, element, By, $, $$, Key, ExpectedConditions as EC } from 'protractor'
3import { loginPage } from '../../../pages/login'
4import { helpers } from '../../../helpers/activagehelpers'
5import { healthAndHome } from '../../../pages/healthAndHome'
6import { apiTest } from '../../../APIrequests/basicRequests'
7import moment = require("moment")
8import { setTargetsFor } from '../../../reusableFunctions/setGoals'
9const registerNewUser = require('../../../reusableFunctions/registerNewUser')
10const removeUser = require('../../../reusableFunctions/removeUser')
11let userEmail
12import {usersPage} from '../../../pages/usersAdmin'
13
14
15 fdescribe('Change user status to active' , function () {
16
17 it('Login as Just created user by admin', async function () {
18
19 // await apiTest.loginAsUser("gl.manchester.user@gmail.com", "8RL9_wH^Hp(97kw}")
20
21 /** This is API calls for Sending data to sHealth */
22 // await apiTest.sendStepsAndKcalValuesShealth(6000, 300)
23 // await apiTest.sendFloorsClaimed(3)
24 // await apiTest.sendSleepAmount(2)
25 // await apiTest.sendHydrationAmount(2)
26 // await apiTest.sendHeartRateValue(100)
27 // await apiTest.sendBloodPressure(150, 90)
28 // await apiTest.sendBloodGlucose(3.2)
29 // await apiTest.sendWeight(75)
30 // await apiTest.sendCaffeineAmount(4)
31
32 // await browser.get('https://www.atptour.com/',10)
33 // await browser.sleep(2000)
34 // console.log(await browser.getTitle(), "!!!!!!!!!")
35 // console.log (await element(By.tagName("title")).isPresent())
36 // console.log(await element(By.tagName("title")).getAttribute('text'), "???")
37 // console.log(await element(By.tagName("title")).getText(), "???")
38 await loginPage.loginAs("admin")
39 await usersPage.navigateToUsersPage()
40 // await element(By.cssContainingText('option', 'GROUP ADMIN')).click();
41 // await browser.sleep(2000)
42 // try{
43 // expect(true).toBe(false)
44 // } catch{
45 // console.log("value is not valid")
46 // }
47
48 var selectDropdownbyNum = function ( element, optionNum ) {
49 if (optionNum){
50 var options = element.all(By.tagName('option'))
51 .then(function(options){
52 options[optionNum].click();
53 });
54 }
55 };
56 let selectDropdownbyNum2 = async function ( element, optionNum ) {
57 if (optionNum){
58 let options = await element.all(By.tagName('option'))
59 options[optionNum].click()
60 }
61 }
62
63
64 // await selectDropdownbyNum($$('.form-control.trial-select').first(), 1)
65 await selectDropdownbyNum2($$('.form-control.trial-select').first(), 1)
66 await browser.sleep(3000)
67
68 });
69
70
71 })