Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge conflicts #20

Merged
merged 3 commits into from
Nov 17, 2024
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
94 changes: 47 additions & 47 deletions run/test/specs/locators/browsers.ts
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
import { LocatorsInterface } from ".";
import { LocatorsInterface } from '.';

// SHARED LOCATORS
export class URLInputField extends LocatorsInterface {
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'com.android.chrome:id/url_bar'
} as const;
case 'ios':
return {
strategy: 'accessibility id',
selector: 'URL'
} as const;
}
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'com.android.chrome:id/url_bar',
} as const;
case 'ios':
return {
strategy: 'accessibility id',
selector: 'URL',
} as const;
}
}
}

// ANDROID ONLY
// ANDROID ONLY
export class ChromeUseWithoutAnAccount extends LocatorsInterface {
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'com.android.chrome:id/signin_fre_dismiss_button',
maxWait: 500,
} as const;
case 'ios':
throw new Error('Unsupported platform')
}
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'com.android.chrome:id/signin_fre_dismiss_button',
maxWait: 500,
} as const;
case 'ios':
throw new Error('Unsupported platform');
}
}
}

export class ChromeNotificationsNegativeButton extends LocatorsInterface {
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'com.android.chrome:id/negative_button',
} as const;
case 'ios':
throw new Error('Unsupported platform')
}
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'com.android.chrome:id/negative_button',
} as const;
case 'ios':
throw new Error('Unsupported platform');
}
}
}

// iOS ONLY
export class SafariAddressBar extends LocatorsInterface {
public build() {
switch (this.platform) {
case 'android':
throw new Error('Unsupported platform')
case 'ios':
return {
strategy: 'accessibility id',
selector: 'TabBarItemTitle'
} as const;
}
public build() {
switch (this.platform) {
case 'android':
throw new Error('Unsupported platform');
case 'ios':
return {
strategy: 'accessibility id',
selector: 'TabBarItemTitle',
} as const;
}
}
}
}
76 changes: 38 additions & 38 deletions run/test/specs/locators/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,55 +31,55 @@ export class CreateAccountButton extends LocatorsInterface {
}

export class AccountRestoreButton extends LocatorsInterface {
public build() {
return {
strategy: 'accessibility id',
selector: 'Restore your session button',
} as const;
}
public build() {
return {
strategy: 'accessibility id',
selector: 'Restore your session button',
} as const;
}
}

export class SplashScreenLinks extends LocatorsInterface {
public build() {
return {
strategy: 'accessibility id',
selector: 'Open URL',
} as const;
}
public build() {
return {
strategy: 'accessibility id',
selector: 'Open URL',
} as const;
}
}

export class TermsOfServiceButton extends LocatorsInterface {
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'Terms of Service',
} as const;
case 'ios':
return {
strategy: 'accessibility id',
selector: 'Terms of Service',
} as const;
}
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'Terms of Service',
} as const;
case 'ios':
return {
strategy: 'accessibility id',
selector: 'Terms of Service',
} as const;
}
}
}

export class PrivacyPolicyButton extends LocatorsInterface {
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'Privacy Policy',
} as const;
case 'ios':
return {
strategy: 'accessibility id',
selector: 'Privacy Policy',
} as const;
}
public build() {
switch (this.platform) {
case 'android':
return {
strategy: 'id',
selector: 'Privacy Policy',
} as const;
case 'ios':
return {
strategy: 'accessibility id',
selector: 'Privacy Policy',
} as const;
}
}
}

// CREATE ACCOUNT FLOW
Expand Down
67 changes: 35 additions & 32 deletions run/test/specs/onboarding_pp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,40 @@ import { runOnlyOnAndroid, runOnlyOnIOS } from './utils';
import { isChromeFirstTimeOpen } from './utils/chrome_first_time_open';
import { closeApp, openAppOnPlatformSingleDevice, SupportedPlatformsType } from './utils/open_app';

bothPlatformsIt('Onboarding privacy policy', 'high', onboardingPP)
bothPlatformsIt('Onboarding privacy policy', 'high', onboardingPP);

async function onboardingPP(platform: SupportedPlatformsType) {
const { device } = await openAppOnPlatformSingleDevice(platform);
const ppURL = 'https://getsession.org/privacy-policy';
// Tap the text at the bottom of the splash screen to bring up the TOS/PP links modal
await device.clickOnElementAll(new SplashScreenLinks(device));
// Tap Privacy Policy
await device.clickOnElementAll(new PrivacyPolicyButton(device));
// Identifying the URL field works differently in Safari and Chrome
if (platform === 'ios') {
// Tap the Safari address bar to reveal the URL
await device.clickOnElementAll(new SafariAddressBar(device));
}
else {
// Chrome can throw some modals on first open
await isChromeFirstTimeOpen(device);
}
// Retrieve URL
const urlField = await device.waitForTextElementToBePresent(new URLInputField(device))
const retrievedURL = await device.getTextFromElement(urlField)
// Add https:// to the retrieved URL if the UI doesn't show it (Chrome doesn't, Safari does)
const fullRetrievedURL = retrievedURL.startsWith('https://') ? retrievedURL : `https://${retrievedURL}`;
// Verify that it's the correct URL
if (fullRetrievedURL !== ppURL) {
throw new Error(`The retrieved URL does not match the expected. The retrieved URL is ${fullRetrievedURL}`);
} else {
console.log("The URLs match.");
}
// Close browser and app
await runOnlyOnIOS(platform, () => device.clickOnCoordinates(42,42)); // I don't like this but nothing else works
await runOnlyOnAndroid(platform, () => device.back());
await closeApp(device);
}
const { device } = await openAppOnPlatformSingleDevice(platform);
const ppURL = 'https://getsession.org/privacy-policy';
// Tap the text at the bottom of the splash screen to bring up the TOS/PP links modal
await device.clickOnElementAll(new SplashScreenLinks(device));
// Tap Privacy Policy
await device.clickOnElementAll(new PrivacyPolicyButton(device));
// Identifying the URL field works differently in Safari and Chrome
if (platform === 'ios') {
// Tap the Safari address bar to reveal the URL
await device.clickOnElementAll(new SafariAddressBar(device));
} else {
// Chrome can throw some modals on first open
await isChromeFirstTimeOpen(device);
}
// Retrieve URL
const urlField = await device.waitForTextElementToBePresent(new URLInputField(device));
const retrievedURL = await device.getTextFromElement(urlField);
// Add https:// to the retrieved URL if the UI doesn't show it (Chrome doesn't, Safari does)
const fullRetrievedURL = retrievedURL.startsWith('https://')
? retrievedURL
: `https://${retrievedURL}`;
// Verify that it's the correct URL
if (fullRetrievedURL !== ppURL) {
throw new Error(
`The retrieved URL does not match the expected. The retrieved URL is ${fullRetrievedURL}`
);
} else {
console.log('The URLs match.');
}
// Close browser and app
await runOnlyOnIOS(platform, () => device.clickOnCoordinates(42, 42)); // I don't like this but nothing else works
await runOnlyOnAndroid(platform, () => device.back());
await closeApp(device);
}
67 changes: 35 additions & 32 deletions run/test/specs/onboarding_tos.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,40 @@ import { closeApp, openAppOnPlatformSingleDevice, SupportedPlatformsType } from
import { isChromeFirstTimeOpen } from './utils/chrome_first_time_open';
import { URLInputField, SafariAddressBar } from './locators/browsers';

bothPlatformsIt('Onboarding terms of service', 'high', onboardingTOS)
bothPlatformsIt('Onboarding terms of service', 'high', onboardingTOS);

async function onboardingTOS(platform: SupportedPlatformsType) {
const { device } = await openAppOnPlatformSingleDevice(platform);
const tosURL = 'https://getsession.org/terms-of-service';
// Tap the text at the bottom of the splash screen to bring up the TOS/PP links modal
await device.clickOnElementAll(new SplashScreenLinks(device));
// Tap Privacy Policy
await device.clickOnElementAll(new TermsOfServiceButton(device));
// Identifying the URL field works differently in Safari and Chrome
if (platform === 'ios') {
// Tap the Safari address bar to reveal the URL
await device.clickOnElementAll(new SafariAddressBar(device));
}
else {
// Chrome can throw some modals on first open
await isChromeFirstTimeOpen(device);
}
// Retrieve URL
const urlField = await device.waitForTextElementToBePresent(new URLInputField(device))
const retrievedURL = await device.getTextFromElement(urlField)
// Add https:// to the retrieved URL if the UI doesn't show it (Chrome doesn't, Safari does)
const fullRetrievedURL = retrievedURL.startsWith('https://') ? retrievedURL : `https://${retrievedURL}`;
// Verify that it's the correct URL
if (fullRetrievedURL !== tosURL) {
throw new Error(`The retrieved URL does not match the expected. The retrieved URL is ${fullRetrievedURL}`);
} else {
console.log("The URLs match.");
}
// Close browser and app
await runOnlyOnIOS(platform, () => device.clickOnCoordinates(42,42)); // I don't like this but nothing else works
await runOnlyOnAndroid(platform, () => device.back());
await closeApp(device);
}
const { device } = await openAppOnPlatformSingleDevice(platform);
const tosURL = 'https://getsession.org/terms-of-service';
// Tap the text at the bottom of the splash screen to bring up the TOS/PP links modal
await device.clickOnElementAll(new SplashScreenLinks(device));
// Tap Privacy Policy
await device.clickOnElementAll(new TermsOfServiceButton(device));
// Identifying the URL field works differently in Safari and Chrome
if (platform === 'ios') {
// Tap the Safari address bar to reveal the URL
await device.clickOnElementAll(new SafariAddressBar(device));
} else {
// Chrome can throw some modals on first open
await isChromeFirstTimeOpen(device);
}
// Retrieve URL
const urlField = await device.waitForTextElementToBePresent(new URLInputField(device));
const retrievedURL = await device.getTextFromElement(urlField);
// Add https:// to the retrieved URL if the UI doesn't show it (Chrome doesn't, Safari does)
const fullRetrievedURL = retrievedURL.startsWith('https://')
? retrievedURL
: `https://${retrievedURL}`;
// Verify that it's the correct URL
if (fullRetrievedURL !== tosURL) {
throw new Error(
`The retrieved URL does not match the expected. The retrieved URL is ${fullRetrievedURL}`
);
} else {
console.log('The URLs match.');
}
// Close browser and app
await runOnlyOnIOS(platform, () => device.clickOnCoordinates(42, 42)); // I don't like this but nothing else works
await runOnlyOnAndroid(platform, () => device.back());
await closeApp(device);
}
1 change: 1 addition & 0 deletions run/test/specs/user_actions_hide_recovery_password.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { englishStripped } from '../../localizer/i18n/localizedString';
import { bothPlatformsIt } from '../../types/sessionIt';
import { USERNAME } from '../../types/testing';
import { ContinueButton } from './locators/global';
Expand Down
24 changes: 14 additions & 10 deletions run/test/specs/utils/chrome_first_time_open.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { DeviceWrapper } from "../../../types/DeviceWrapper";
import { ChromeNotificationsNegativeButton, ChromeUseWithoutAnAccount } from "../locators/browsers";
import { DeviceWrapper } from '../../../types/DeviceWrapper';
import { ChromeNotificationsNegativeButton, ChromeUseWithoutAnAccount } from '../locators/browsers';

// First time open of Chrome triggers an account check and a notifications modal
// First time open of Chrome triggers an account check and a notifications modal
export async function isChromeFirstTimeOpen(device: DeviceWrapper) {
const chromeUseWithoutAnAccount = await device.doesElementExist(new ChromeUseWithoutAnAccount(device))
if (!chromeUseWithoutAnAccount) {
console.log("Chrome opened without an account check, proceeding");
} else {
console.log("Chrome has been opened for the first time, dismissing account use and notifications");
const chromeUseWithoutAnAccount = await device.doesElementExist(
new ChromeUseWithoutAnAccount(device)
);
if (!chromeUseWithoutAnAccount) {
console.log('Chrome opened without an account check, proceeding');
} else {
console.log(
'Chrome has been opened for the first time, dismissing account use and notifications'
);
await device.clickOnElementAll(new ChromeUseWithoutAnAccount(device));
await device.clickOnElementAll(new ChromeNotificationsNegativeButton(device));
}
}
}
}
Loading
Loading