forked from wevote/WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request wevote#4127 from lavishaGit/lavisha_WebApp_faq
Updated all instances of "Sign in with Twitter" to "Sign in with X" in SignIn Page TestScripts
- Loading branch information
Showing
4 changed files
with
491 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
252 changes: 130 additions & 122 deletions
252
tests/browserstack_automation/page_objects/signin.page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +1,152 @@ | ||
import { cardHeaderClasses } from '@mui/material'; | ||
import {$,$$} from '@wdio/globals'; | ||
/* eslint-disable no-restricted-syntax */ | ||
import { $, $$ } from '@wdio/globals'; | ||
import Page from './page'; | ||
|
||
class SignIn extends Page{ | ||
class SignIn extends Page { | ||
/* constructor(){ | ||
super().title= 'Ready to Vote? - WeVote'; | ||
}*/ | ||
|
||
get signInLinkElement(){ | ||
return $('.StyledButton-sc-1hu720d-1'); | ||
} | ||
get signInElement(){ | ||
return $('.u-f3'); | ||
} | ||
} */ | ||
|
||
get signInWithTwitterTextElement(){ | ||
return $('//span[text()="Sign in with Twitter"]'); | ||
} | ||
get signInWithAppleTextElement(){ | ||
return $('//span[text()="Sign in with Apple"]'); // #appleSignInText | ||
} | ||
get twitterBttnElement(){ | ||
return $('#twitterSignIn-splitIconButton'); | ||
} | ||
get appleBttnElement(){ | ||
return $('.AppleSignInButton-sc-1tt5cpk-2'); | ||
} | ||
|
||
|
||
get signInLinkBttn () { | ||
return $('#SignIn'); | ||
} | ||
|
||
get phoneNumberLabelElement(){ | ||
return $('#enterVoterPhone-label'); | ||
} | ||
get signInElement () { | ||
return $('#signIn'); | ||
} | ||
|
||
get phoneNumberFieldElement(){ | ||
return $('#enterVoterPhone'); | ||
} | ||
get signInWithXTextElement () { | ||
// return $('//span[text()="Sign in with X"]'); | ||
return $('#twitterSignIn-splitIconButton span:nth-of-type(2)'); | ||
|
||
get emailLabelElement(){ | ||
return $('#enterVoterEmailAddress-label'); | ||
} | ||
} | ||
|
||
get emailFieldElement(){ | ||
return $('#enterVoterEmailAddress'); | ||
} | ||
get iconElements(){ | ||
return $$('#SignInOptionsMain-undefined svg'); | ||
} | ||
get cancelPhoneBttnElement(){ | ||
return $('#cancelVoterPhoneSendSMS'); | ||
} | ||
get cancelEmailBttnElement(){ | ||
return $('#cancelEmailButton'); | ||
} | ||
get signInWithAppleTextElement () { | ||
// return $('//span[text()="Sign in with Apple"]'); // #appleSignInText | ||
return $('#appleSignInText'); | ||
} | ||
|
||
get sendVerificationPhoneBttnElement(){ | ||
return $('#voterPhoneSendSMS'); | ||
} | ||
get sendVerificationEmailBttnElement(){ | ||
return $('#voterEmailAddressEntrySendCode'); | ||
} | ||
get closeBttnElement(){ | ||
return $('#signInModalSimpleCloseIcon'); | ||
} | ||
get codeVerifyElement(){ | ||
return $('.Title-sc-27qyt7-4'); | ||
} | ||
get backButtonElement(){ | ||
return $('#emailVerificationBackButton'); | ||
} | ||
get sendVeificationAgainElement(){ | ||
return $('//*[text()="Send verification again"]'); | ||
} | ||
async getIcons(){ | ||
const iconList= await this.iconElements; | ||
const visibilityList = []; | ||
for(const icon of iconList){ | ||
const isIconVisible =await icon.isDisplayed()// call isDisplayed | ||
visibilityList.push(isIconVisible); | ||
} | ||
return visibilityList; | ||
} | ||
get xBttnElement () { | ||
return $('#twitterSignIn-splitIconButton'); | ||
} | ||
|
||
|
||
async getText1(element) { | ||
try { | ||
const text = await element.getText(); | ||
console.log(`Element extracted text is: ${text}`); | ||
return text; | ||
} catch (error) { | ||
console.error('Error extracting text:', error); | ||
return ''; | ||
} | ||
} | ||
get appleBttnElement () { | ||
return $('.AppleSignInButton-sc-1tt5cpk-2'); | ||
// return $('#appleLogo'); | ||
} | ||
|
||
randomString(length,withNum=false,withDecimal=false,withUnderscore=false,withDash=false){ | ||
|
||
let chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
let result=''; | ||
let genresult='0123456789'; | ||
if (withNum==true) { | ||
chars = chars+'0123456789'; | ||
} | ||
|
||
// if (withDecimal==true) { | ||
// chars =chars+ '.'; | ||
// } | ||
|
||
// if (withUnderscore==true) { | ||
// chars = chars+'_'; | ||
// } | ||
// if(withDash==true){ | ||
// chars=chars+'-' | ||
// } | ||
//console.log('Available characters:', chars); | ||
for(let i=0;i<length;i++) | ||
{ | ||
|
||
result=result+chars.charAt(Math.floor(Math.random() * chars.length)); | ||
// console.log('Generated string:', result); | ||
|
||
} | ||
if(withNum){ | ||
if (!result.split('').some(char => '0123456789'.includes(char ))) { | ||
// const randomIndex = Math.floor(Math.random() * chars.length); // Use parentheses for Math.random | ||
// result = result + chars.charAt(randomIndex); | ||
//for(let i=0;i<2;i++) | ||
//{ | ||
result=result+genresult.charAt(Math.floor(Math.random() * genresult.length)); | ||
//} | ||
}} | ||
|
||
return result; | ||
get phoneNumberLabelElement () { | ||
return $('#enterVoterPhone-label'); | ||
} | ||
|
||
get phoneNumberFieldElement () { | ||
return $('#enterVoterPhone'); | ||
} | ||
|
||
get emailLabelElement () { | ||
return $('#enterVoterEmailAddress-label'); | ||
} | ||
|
||
get emailFieldElement () { | ||
return $('#enterVoterEmailAddress'); | ||
} | ||
|
||
get iconElements () { | ||
return $$('#SignInOptionsMain-undefined svg'); | ||
} | ||
|
||
get cancelPhoneBttnElement () { | ||
return $('#cancelVoterPhoneSendSMS'); | ||
} | ||
|
||
|
||
get cancelEmailBttnElement () { | ||
return $('#cancelEmailButton'); | ||
} | ||
|
||
get sendVerificationPhoneBttnElement () { | ||
return $('#voterPhoneSendSMS'); | ||
} | ||
|
||
} | ||
get sendVerificationEmailBttnElement () { | ||
return $('#voterEmailAddressEntrySendCode'); | ||
} | ||
|
||
get closeBttnElement () { | ||
return $('#signInModalSimpleCloseIcon'); | ||
} | ||
|
||
get codeVerifyElement () { | ||
return $('.Title-sc-27qyt7-4'); | ||
} | ||
|
||
get backButtonElement () { | ||
return $('#emailVerificationBackButton'); | ||
} | ||
|
||
get sendVeificationAgainElement () { | ||
return $('//*[text()="Send verification again"]'); | ||
} | ||
|
||
async getIcons () { | ||
const iconList = await this.iconElements; | ||
const visibilityList = []; | ||
for (const icon of iconList) { | ||
// eslint-disable-next-line no-await-in-loop | ||
const isIconVisible = await icon.isDisplayed();// call isDisplayed | ||
visibilityList.push(isIconVisible); | ||
} | ||
return visibilityList; | ||
} | ||
|
||
|
||
async getText1 (element) { | ||
try { | ||
const text = await element.getText(); | ||
console.log(`Element extracted text is: ${text}`); | ||
return text; | ||
} catch (error) { | ||
console.error('Error extracting text:', error); | ||
return ''; | ||
} | ||
} | ||
|
||
randomString (length, withNum = false, withDecimal = false, withUnderscore = false, withDash = false) { | ||
let chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
let result = ''; | ||
const genresult = '0123456789'; | ||
if (withNum == true) { | ||
chars += '0123456789'; | ||
} | ||
|
||
// if (withDecimal==true) { | ||
// chars =chars+ '.'; | ||
// } | ||
|
||
// if (withUnderscore==true) { | ||
// chars = chars+'_'; | ||
// } | ||
// if(withDash==true){ | ||
// chars=chars+'-' | ||
// } | ||
// console.log('Available characters:', chars); | ||
for (let i = 0; i < length; i++) { | ||
result += chars.charAt(Math.floor(Math.random() * chars.length)); | ||
// console.log('Generated string:', result); | ||
} | ||
if (withNum) { | ||
if (!result.split('').some((char) => '0123456789'.includes(char))) { | ||
// const randomIndex = Math.floor(Math.random() * chars.length); // Use parentheses for Math.random | ||
// result = result + chars.charAt(randomIndex); | ||
// for(let i=0;i<2;i++) | ||
// { | ||
result += genresult.charAt(Math.floor(Math.random() * genresult.length)); | ||
// } | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
export default new SignIn(); |
Oops, something went wrong.