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
8 changes: 4 additions & 4 deletions app/test/pageobjects/base/footer.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class FooterPage extends BasePage {
return $(selectors.byAccessibilityId('nav-tab-spotlight'));
}

get ordersTab() {
return $(selectors.byAccessibilityId('nav-tab-orders'));
get chatTab() {
return $(selectors.byAccessibilityId('nav-tab-chat'));
}

get subscriptionsTab() {
Expand All @@ -25,8 +25,8 @@ class FooterPage extends BasePage {
await this.click(this.spotlightsTab);
}

async clickOrdersTab() {
await this.click(this.ordersTab);
async clickChatTab() {
await this.click(this.chatTab);
}

async clickSubscriptionsTab() {
Expand Down
18 changes: 18 additions & 0 deletions app/test/pageobjects/more.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ class MorePage extends BasePage {
);
}

get ordersMenuItem() {
return $(
getSelector({
ios: '~nav-menu-orders',
android: '//*[@resource-id="nav-menu-orders"]',
}),
);
}

get creditMemosMenuItem() {
return $(
getSelector({
Expand Down Expand Up @@ -163,6 +172,15 @@ class MorePage extends BasePage {
await browser.pause(PAUSE.NAVIGATION);
}

/**
* Navigate to Orders page
*/
async navigateToOrders() {
await this.ensureMorePage();
await this.ordersMenuItem.click();
await browser.pause(PAUSE.NAVIGATION);
}

/**
* Navigate to Credit Memos page
*/
Expand Down
9 changes: 5 additions & 4 deletions app/test/pageobjects/orders.page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { selectors } = require('./utils/selectors');
const { PAUSE, RETRY } = require('./utils/constants');
const morePage = require('./more.page');

const ListPage = require('./base/list.page');

Expand Down Expand Up @@ -119,7 +120,7 @@ class OrdersPage extends ListPage {

/**
* Ensures the app is on the Orders page, navigating there if needed
* Uses the footer navigation to get to Orders from any page with visible footer
* Uses More -> Orders navigation to get to Orders from any page with visible footer
*/
async ensureOrdersPage() {
// Check if already on Orders page
Expand All @@ -130,7 +131,7 @@ class OrdersPage extends ListPage {

// Try to navigate back until footer is visible
for (let i = 0; i < RETRY.MAX_BACK_ATTEMPTS; i++) {
const isFooterVisible = await this.footer.ordersTab.isDisplayed().catch(() => false);
const isFooterVisible = await this.footer.chatTab.isDisplayed().catch(() => false);
if (isFooterVisible) {
break;
}
Expand All @@ -140,8 +141,8 @@ class OrdersPage extends ListPage {
await browser.pause(PAUSE.NAVIGATION);
}

// Click Orders tab from footer
await this.footer.clickOrdersTab();
// Navigate through More menu to Orders
await morePage.navigateToOrders();
await this.waitForScreenReady();
}

Expand Down
8 changes: 4 additions & 4 deletions app/test/pageobjects/spotlights.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ class SpotlightsPage extends BasePage {
return $(selectors.byContentDesc('nav-tab-spotlight'));
}

get navTabOrders() {
return $(selectors.byContentDesc('nav-tab-orders'));
get navTabChat() {
return $(selectors.byContentDesc('nav-tab-chat'));
}

get navTabSubscriptions() {
Expand Down Expand Up @@ -728,12 +728,12 @@ class SpotlightsPage extends BasePage {
// ========== Navigation Methods ==========
/**
* Navigate to a tab
* @param {string} tabName - 'spotlight', 'orders', 'subscriptions', 'more'
* @param {string} tabName - 'spotlight', 'chat', 'subscriptions', 'more'
*/
async navigateToTab(tabName) {
const tabMap = {
spotlight: this.navTabSpotlight,
orders: this.navTabOrders,
chat: this.navTabChat,
subscriptions: this.navTabSubscriptions,
more: this.navTabMore,
};
Expand Down
2 changes: 1 addition & 1 deletion app/test/specs/agreements.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Agreements Page', () => {

it('should display all footer navigation tabs', async () => {
await expect(agreementsPage.footer.spotlightsTab).toBeDisplayed();
await expect(agreementsPage.footer.ordersTab).toBeDisplayed();
await expect(agreementsPage.footer.chatTab).toBeDisplayed();
await expect(agreementsPage.footer.subscriptionsTab).toBeDisplayed();
await expect(agreementsPage.footer.moreTab).toBeDisplayed();
});
Expand Down
2 changes: 1 addition & 1 deletion app/test/specs/buyers.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Buyers Page', () => {

it('should display all footer navigation tabs', async () => {
await expect(buyersPage.footer.spotlightsTab).toBeDisplayed();
await expect(buyersPage.footer.ordersTab).toBeDisplayed();
await expect(buyersPage.footer.chatTab).toBeDisplayed();
await expect(buyersPage.footer.subscriptionsTab).toBeDisplayed();
await expect(buyersPage.footer.moreTab).toBeDisplayed();
});
Expand Down
2 changes: 1 addition & 1 deletion app/test/specs/enrollments.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Enrollments Page', () => {

it('should display all footer navigation tabs', async () => {
await expect(enrollmentsPage.footer.spotlightsTab).toBeDisplayed();
await expect(enrollmentsPage.footer.ordersTab).toBeDisplayed();
await expect(enrollmentsPage.footer.chatTab).toBeDisplayed();
await expect(enrollmentsPage.footer.subscriptionsTab).toBeDisplayed();
await expect(enrollmentsPage.footer.moreTab).toBeDisplayed();
});
Expand Down
2 changes: 1 addition & 1 deletion app/test/specs/licensees.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Licensees Page', () => {

it('should display all footer navigation tabs', async () => {
await expect(licenseesPage.footer.spotlightsTab).toBeDisplayed();
await expect(licenseesPage.footer.ordersTab).toBeDisplayed();
await expect(licenseesPage.footer.chatTab).toBeDisplayed();
await expect(licenseesPage.footer.subscriptionsTab).toBeDisplayed();
await expect(licenseesPage.footer.moreTab).toBeDisplayed();
});
Expand Down
22 changes: 16 additions & 6 deletions app/test/specs/navigation.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ describe('Navigation via footer', () => {
await navigation.ensureHomePage({ resetFilters: false });
});

it('click on Orders button to load Orders page', async () => {
await expect(homePage.footer.ordersTab).toBeDisplayed();
await homePage.footer.clickOrdersTab();
it('click on Chat button to load Chat page', async () => {
await expect(homePage.footer.chatTab).toBeDisplayed();
await homePage.footer.clickChatTab();
const chatHeader = await $('//*[@name="Chat" or @text="Chat"]');
await expect(chatHeader).toBeDisplayed();
await expect(homePage.footer.chatTab).toBeDisplayed();
});

it('click on Orders in More to load Orders page', async () => {
await expect(homePage.footer.moreTab).toBeDisplayed();
await homePage.footer.clickMoreTab();
await expect(morePage.ordersMenuItem).toBeDisplayed();
await morePage.navigateToOrders();
await ordersPage.waitForScreenReady();
// Verify we navigated by checking the Orders tab is still accessible (we're on orders screen)
await expect(ordersPage.footer.ordersTab).toBeDisplayed();
await expect(ordersPage.headerTitle).toBeDisplayed();
});

it('click on Subscriptions button to load Subscriptions page', async () => {
Expand Down Expand Up @@ -84,7 +93,8 @@ describe('Navigation via footer', () => {

it('navigate from Orders page to Profile via account button', async () => {
// Navigate to Orders page first
await homePage.footer.clickOrdersTab();
await homePage.footer.clickMoreTab();
await morePage.navigateToOrders();
await ordersPage.waitForScreenReady();

// Tap account button from Orders page
Expand Down
10 changes: 5 additions & 5 deletions app/test/specs/order-details-navigation.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ describe('Order Details Navigation', () => {
await orderDetailsPage.waitForPageReady();

await expect(orderDetailsPage.footer.spotlightsTab).toBeDisplayed();
await expect(orderDetailsPage.footer.ordersTab).toBeDisplayed();
await expect(orderDetailsPage.footer.chatTab).toBeDisplayed();
await expect(orderDetailsPage.footer.subscriptionsTab).toBeDisplayed();
await expect(orderDetailsPage.footer.moreTab).toBeDisplayed();
});

it('should have Orders tab selected on details page', async function () {
it('should have More tab selected on details page', async function () {
if (!hasOrdersData) {
this.skip();
return;
Expand All @@ -126,12 +126,12 @@ describe('Order Details Navigation', () => {
await ordersPage.tapFirstOrder();
await orderDetailsPage.waitForPageReady();

const ordersTab = orderDetailsPage.footer.ordersTab;
const moreTab = orderDetailsPage.footer.moreTab;
if (isAndroid()) {
const selected = await ordersTab.getAttribute('selected');
const selected = await moreTab.getAttribute('selected');
expect(selected).toBe('true');
} else {
const value = await ordersTab.getAttribute('value');
const value = await moreTab.getAttribute('value');
expect(value).toBe('1');
}
});
Expand Down
34 changes: 29 additions & 5 deletions app/test/specs/orders.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,45 @@ describe('Orders Page', () => {
});

it('should display all footer navigation tabs', async () => {
const hasSpotlightsTab = await ordersPage.footer.spotlightsTab.isDisplayed().catch(() => false);
const hasChatTab = await ordersPage.footer.chatTab.isDisplayed().catch(() => false);
const hasSubscriptionsTab = await ordersPage.footer.subscriptionsTab
.isDisplayed()
.catch(() => false);
const hasMoreTab = await ordersPage.footer.moreTab.isDisplayed().catch(() => false);

const hasPrimaryFooterTabs =
hasSpotlightsTab || hasChatTab || hasSubscriptionsTab || hasMoreTab;

// When Orders is opened from More menu as a secondary screen, root footer tabs are hidden.
if (!hasPrimaryFooterTabs) {
await expect(ordersPage.goBackButton).toBeDisplayed();
return;
}

await expect(ordersPage.footer.spotlightsTab).toBeDisplayed();
await expect(ordersPage.footer.ordersTab).toBeDisplayed();
await expect(ordersPage.footer.chatTab).toBeDisplayed();
await expect(ordersPage.footer.subscriptionsTab).toBeDisplayed();
await expect(ordersPage.footer.moreTab).toBeDisplayed();
});

it('should have Orders tab selected', async () => {
const ordersTab = ordersPage.footer.ordersTab;
it('should have More tab selected', async () => {
const moreTab = ordersPage.footer.moreTab;
const isMoreTabVisible = await moreTab.isDisplayed().catch(() => false);

// Secondary-screen navigation path: Orders is in More menu and footer tabs are hidden.
if (!isMoreTabVisible) {
await expect(ordersPage.goBackButton).toBeDisplayed();
return;
}

if (isAndroid()) {
// Android uses 'selected' attribute
const selected = await ordersTab.getAttribute('selected');
const selected = await moreTab.getAttribute('selected');
expect(selected).toBe('true');
} else {
// iOS uses 'value' attribute
const value = await ordersTab.getAttribute('value');
const value = await moreTab.getAttribute('value');
expect(value).toBe('1');
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/test/specs/programs.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Programs Page', () => {

it('should display all footer navigation tabs', async () => {
await expect(programsPage.footer.spotlightsTab).toBeDisplayed();
await expect(programsPage.footer.ordersTab).toBeDisplayed();
await expect(programsPage.footer.chatTab).toBeDisplayed();
await expect(programsPage.footer.subscriptionsTab).toBeDisplayed();
await expect(programsPage.footer.moreTab).toBeDisplayed();
});
Expand Down
2 changes: 1 addition & 1 deletion app/test/specs/subscriptions.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Subscriptions Page', () => {

it('should display all footer navigation tabs', async () => {
await expect(subscriptionsPage.footer.spotlightsTab).toBeDisplayed();
await expect(subscriptionsPage.footer.ordersTab).toBeDisplayed();
await expect(subscriptionsPage.footer.chatTab).toBeDisplayed();
await expect(subscriptionsPage.footer.subscriptionsTab).toBeDisplayed();
await expect(subscriptionsPage.footer.moreTab).toBeDisplayed();
});
Expand Down
2 changes: 1 addition & 1 deletion app/test/specs/users.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('Users Page', () => {

it('should display all footer navigation tabs', async () => {
await expect(usersPage.footer.spotlightsTab).toBeDisplayed();
await expect(usersPage.footer.ordersTab).toBeDisplayed();
await expect(usersPage.footer.chatTab).toBeDisplayed();
await expect(usersPage.footer.subscriptionsTab).toBeDisplayed();
await expect(usersPage.footer.moreTab).toBeDisplayed();
});
Expand Down
Loading