-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c595d95
commit a18f11e
Showing
12 changed files
with
661 additions
and
185 deletions.
There are no files selected for viewing
127 changes: 127 additions & 0 deletions
127
e2e/foodtech/checkout/customer__guest/failure__closed_restaurant/on_more_page.spec.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 |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { | ||
addProduct, | ||
chooseRestaurant, | ||
closeRestaurantForToday, | ||
connectToLocalInstance, | ||
connectToSandbox, | ||
launchApp, | ||
symfonyConsole, | ||
} from '../../../../support/commands'; | ||
import { describeif } from '../../../../utils'; | ||
|
||
//FIXME: run against local instance on iOS too (see https://github.com/coopcycle/coopcycle-ops/issues/97) | ||
describeif(device.getPlatform() === 'android')( | ||
'checkout for customer guest user; Time range changed modal', | ||
() => { | ||
beforeEach(async () => { | ||
await launchApp(); | ||
|
||
if (device.getPlatform() === 'android') { | ||
symfonyConsole( | ||
'coopcycle:fixtures:load -f cypress/fixtures/checkout.yml', | ||
); | ||
symfonyConsole( | ||
'craue:setting:create --section="general" --name="guest_checkout_enabled" --value="1" --force', | ||
); | ||
await connectToLocalInstance(); | ||
} else { | ||
//FIXME: run against local instance on iOS too (see https://github.com/coopcycle/coopcycle-ops/issues/97) | ||
await connectToSandbox(); | ||
} | ||
|
||
// Enter address | ||
await waitFor(element(by.id('askAddressAutocomplete'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
await element(by.id('askAddressAutocomplete')).typeText( | ||
'91 rue de rivoli paris', | ||
); | ||
await element(by.id('placeId:ChIJQ4sJbyFu5kcRbp6Sp6NLnog')).tap(); | ||
|
||
// List of restaurants | ||
await expect(element(by.id('restaurantList'))).toBeVisible(); | ||
await chooseRestaurant('Restaurant with cash on delivery'); | ||
|
||
// Restaurant page | ||
await waitFor(element(by.id('restaurantData'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
await waitFor(element(by.id('menuItem:0:0'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
|
||
// Add item | ||
await addProduct('menuItem:0:0'); | ||
|
||
// Check if footer is present | ||
await waitFor(element(by.id('cartFooter'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
await expect(element(by.id('cartFooter'))).toBeVisible(); | ||
|
||
// Add 2 more items | ||
await addProduct('menuItem:0:1'); | ||
await addProduct('menuItem:1:0'); | ||
|
||
await waitFor(element(by.id('cartSubmit'))) | ||
.toBeVisible() | ||
.withTimeout(5000); | ||
await element(by.id('cartSubmit')).tap(); | ||
}); | ||
|
||
describe('restaurant was closed while the customer had been on the More page', () => { | ||
it(`should suggest to choose a new time range (Timing modal)`, async () => { | ||
// Cart summary page | ||
await element(by.id('cartSummarySubmit')).tap(); | ||
|
||
// Authentication page | ||
await expect(element(by.id('loginUsername'))).toBeVisible(); | ||
|
||
try { | ||
await element(by.id('guestCheckoutButton')).tap(); | ||
} catch (e) {} | ||
|
||
// More infos page | ||
await expect(element(by.id('guestCheckoutEmail'))).toBeVisible(); | ||
await expect(element(by.id('checkoutTelephone'))).toBeVisible(); | ||
await expect(element(by.id('moreInfosSubmit'))).toBeVisible(); | ||
|
||
await element(by.id('guestCheckoutEmail')).typeText( | ||
'[email protected]', | ||
); | ||
|
||
// Append "\n" to make sure virtual keybord is hidden after entry | ||
// https://github.com/wix/detox/issues/209 | ||
await element(by.id('checkoutTelephone')).typeText('0612345678'); | ||
await element(by.id('checkoutTelephone')).typeText('\n'); | ||
|
||
await closeRestaurantForToday( | ||
'restaurant_with_cash_on_delivery_owner', | ||
'12345678', | ||
); | ||
|
||
await element(by.id('moreInfosSubmit')).tap(); | ||
|
||
// Time range changed modal | ||
await waitFor(element(by.id('timeRangeChangedModal'))) | ||
.toBeVisible() | ||
.withTimeout(5000); | ||
// Select a shipping time range | ||
await element(by.id('setShippingTimeRange')).tap(); | ||
|
||
await element(by.id('moreInfosSubmit')).tap(); | ||
|
||
// Payment picker page | ||
await expect( | ||
element(by.id('paymentMethod-cash_on_delivery')), | ||
).toBeVisible(); | ||
await element(by.id('paymentMethod-cash_on_delivery')).tap(); | ||
|
||
// Cash on delivery page | ||
await waitFor(element(by.id('cashOnDeliverySubmit'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
}); | ||
}); | ||
}, | ||
); |
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 |
---|---|---|
|
@@ -6,8 +6,8 @@ import { | |
connectToSandbox, | ||
launchApp, | ||
symfonyConsole, | ||
} from '../../../support/commands'; | ||
import { describeif } from '../../../utils'; | ||
} from '../../../../support/commands'; | ||
import { describeif } from '../../../../utils'; | ||
|
||
//FIXME: run against local instance on iOS too (see https://github.com/coopcycle/coopcycle-ops/issues/97) | ||
describeif(device.getPlatform() === 'android')( | ||
|
@@ -69,84 +69,6 @@ describeif(device.getPlatform() === 'android')( | |
await element(by.id('cartSubmit')).tap(); | ||
}); | ||
|
||
describe('restaurant was closed while the customer had been on the Summary page', () => { | ||
it(`should suggest to choose a new time range (Timing modal)`, async () => { | ||
// Cart summary page | ||
|
||
await closeRestaurantForToday( | ||
'restaurant_with_cash_on_delivery_owner', | ||
'12345678', | ||
); | ||
|
||
await element(by.id('cartSummarySubmit')).tap(); | ||
|
||
// Time range changed modal | ||
await waitFor(element(by.id('timeRangeChangedModal'))) | ||
.toBeVisible() | ||
.withTimeout(5000); | ||
// Select a shipping time range | ||
await element(by.id('setShippingTimeRange')).tap(); | ||
|
||
await element(by.id('cartSummarySubmit')).tap(); | ||
|
||
// Authentication page | ||
await expect(element(by.id('loginUsername'))).toBeVisible(); | ||
}); | ||
}); | ||
|
||
describe('restaurant was closed while the customer had been on the More page', () => { | ||
it(`should suggest to choose a new time range (Timing modal)`, async () => { | ||
// Cart summary page | ||
await element(by.id('cartSummarySubmit')).tap(); | ||
|
||
// Authentication page | ||
await expect(element(by.id('loginUsername'))).toBeVisible(); | ||
|
||
try { | ||
await element(by.id('guestCheckoutButton')).tap(); | ||
} catch (e) {} | ||
|
||
// More infos page | ||
await expect(element(by.id('guestCheckoutEmail'))).toBeVisible(); | ||
await expect(element(by.id('checkoutTelephone'))).toBeVisible(); | ||
await expect(element(by.id('moreInfosSubmit'))).toBeVisible(); | ||
|
||
await element(by.id('guestCheckoutEmail')).typeText( | ||
'[email protected]', | ||
); | ||
|
||
// Append "\n" to make sure virtual keybord is hidden after entry | ||
// https://github.com/wix/detox/issues/209 | ||
await element(by.id('checkoutTelephone')).typeText('0612345678'); | ||
await element(by.id('checkoutTelephone')).typeText('\n'); | ||
|
||
await closeRestaurantForToday( | ||
'restaurant_with_cash_on_delivery_owner', | ||
'12345678', | ||
); | ||
|
||
await element(by.id('moreInfosSubmit')).tap(); | ||
|
||
// Time range changed modal | ||
await waitFor(element(by.id('timeRangeChangedModal'))) | ||
.toBeVisible() | ||
.withTimeout(5000); | ||
// Select a shipping time range | ||
await element(by.id('setShippingTimeRange')).tap(); | ||
|
||
await element(by.id('moreInfosSubmit')).tap(); | ||
|
||
// Payment picker page | ||
await expect( | ||
element(by.id('paymentMethod-cash_on_delivery')), | ||
).toBeVisible(); | ||
await element(by.id('paymentMethod-cash_on_delivery')).tap(); | ||
|
||
// Cash on delivery page | ||
await waitFor(element(by.id('cashOnDeliverySubmit'))).toExist().withTimeout(5000); | ||
}); | ||
}); | ||
|
||
describe('restaurant was closed while the customer had been on the Payment page', () => { | ||
it(`should suggest to choose a new time range (Timing modal)`, async () => { | ||
// Cart summary page | ||
|
@@ -182,7 +104,9 @@ describeif(device.getPlatform() === 'android')( | |
await element(by.id('paymentMethod-cash_on_delivery')).tap(); | ||
|
||
// Cash on delivery page | ||
await waitFor(element(by.id('cashOnDeliverySubmit'))).toExist().withTimeout(5000); | ||
await waitFor(element(by.id('cashOnDeliverySubmit'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
|
||
await closeRestaurantForToday( | ||
'restaurant_with_cash_on_delivery_owner', | ||
|
97 changes: 97 additions & 0 deletions
97
e2e/foodtech/checkout/customer__guest/failure__closed_restaurant/on_summary_page.spec.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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { | ||
addProduct, | ||
chooseRestaurant, | ||
closeRestaurantForToday, | ||
connectToLocalInstance, | ||
connectToSandbox, | ||
launchApp, | ||
symfonyConsole, | ||
} from '../../../../support/commands'; | ||
import { describeif } from '../../../../utils'; | ||
|
||
//FIXME: run against local instance on iOS too (see https://github.com/coopcycle/coopcycle-ops/issues/97) | ||
describeif(device.getPlatform() === 'android')( | ||
'checkout for customer guest user; Time range changed modal', | ||
() => { | ||
beforeEach(async () => { | ||
await launchApp(); | ||
|
||
if (device.getPlatform() === 'android') { | ||
symfonyConsole( | ||
'coopcycle:fixtures:load -f cypress/fixtures/checkout.yml', | ||
); | ||
symfonyConsole( | ||
'craue:setting:create --section="general" --name="guest_checkout_enabled" --value="1" --force', | ||
); | ||
await connectToLocalInstance(); | ||
} else { | ||
//FIXME: run against local instance on iOS too (see https://github.com/coopcycle/coopcycle-ops/issues/97) | ||
await connectToSandbox(); | ||
} | ||
|
||
// Enter address | ||
await waitFor(element(by.id('askAddressAutocomplete'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
await element(by.id('askAddressAutocomplete')).typeText( | ||
'91 rue de rivoli paris', | ||
); | ||
await element(by.id('placeId:ChIJQ4sJbyFu5kcRbp6Sp6NLnog')).tap(); | ||
|
||
// List of restaurants | ||
await expect(element(by.id('restaurantList'))).toBeVisible(); | ||
await chooseRestaurant('Restaurant with cash on delivery'); | ||
|
||
// Restaurant page | ||
await waitFor(element(by.id('restaurantData'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
await waitFor(element(by.id('menuItem:0:0'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
|
||
// Add item | ||
await addProduct('menuItem:0:0'); | ||
|
||
// Check if footer is present | ||
await waitFor(element(by.id('cartFooter'))) | ||
.toExist() | ||
.withTimeout(5000); | ||
await expect(element(by.id('cartFooter'))).toBeVisible(); | ||
|
||
// Add 2 more items | ||
await addProduct('menuItem:0:1'); | ||
await addProduct('menuItem:1:0'); | ||
|
||
await waitFor(element(by.id('cartSubmit'))) | ||
.toBeVisible() | ||
.withTimeout(5000); | ||
await element(by.id('cartSubmit')).tap(); | ||
}); | ||
|
||
describe('restaurant was closed while the customer had been on the Summary page', () => { | ||
it(`should suggest to choose a new time range (Timing modal)`, async () => { | ||
// Cart summary page | ||
|
||
await closeRestaurantForToday( | ||
'restaurant_with_cash_on_delivery_owner', | ||
'12345678', | ||
); | ||
|
||
await element(by.id('cartSummarySubmit')).tap(); | ||
|
||
// Time range changed modal | ||
await waitFor(element(by.id('timeRangeChangedModal'))) | ||
.toBeVisible() | ||
.withTimeout(5000); | ||
// Select a shipping time range | ||
await element(by.id('setShippingTimeRange')).tap(); | ||
|
||
await element(by.id('cartSummarySubmit')).tap(); | ||
|
||
// Authentication page | ||
await expect(element(by.id('loginUsername'))).toBeVisible(); | ||
}); | ||
}); | ||
}, | ||
); |
Oops, something went wrong.