-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
- wrap tests in "flavor" factory - remove ci setup (doesn't work with old URL anymore) BREAKING CHANGE: this requires the url to be /examples/js/e-commerce instead of /examples/e-commerce. This means that until the package is in the monorepo, its tests wouldn't pass. After the main monorepo PR is merged, this repo will move inside and will no longer be published.
This PR is ready for review, but should not be merged as there's no need to have this next version tagged outside of the InstantSearch monorepo |
it('navigates to the e-commerce demo', async () => { | ||
await browser.url('examples/e-commerce/'); | ||
}); | ||
export function brandAndQuery(flavor: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function brandAndQuery(flavor: string) { | |
export function createBrandAndQueryTestSuite(flavor: string) { |
it('selects "Apple" brand in list', async () => { | ||
await browser.clickRefinementListItem('Apple'); | ||
}); | ||
describe('Search on specific brand and query filtering', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe('Search on specific brand and query filtering', () => { | |
describe('search on specific brand and query filtering', () => { |
it('navigates to the e-commerce demo', async () => { | ||
await browser.url('examples/e-commerce/'); | ||
}); | ||
export function category(flavor: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function category(flavor: string) { | |
export function createCategoryTestSuite(flavor: string) { |
it('navigates to the e-commerce demo', async () => { | ||
await browser.url('examples/e-commerce/'); | ||
}); | ||
export function brandAndQuery(flavor: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type should be typeof flavors[number]
, same for the other factories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had that first but the flavor
file needs to be cjs for it to work in the config, and then I'm either writing the flavours twice without validation, or have it as a string (what I preferred in the end)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah 😞 Can't we use .mjs
configs with WebdriverIO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with newer versions we can do it in typescript I think, I'll look if possible to upgrade once migrated in monorepo
it('selects "Appliances" category in list', async () => { | ||
await browser.clickHierarchicalMenuItem('Appliances'); | ||
}); | ||
describe('Search on specific category', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe('Search on specific category', () => { | |
describe('search on specific category', () => { |
`examples/e-commerce/search/Appliances%2FSmall+Kitchen+Appliances/?${params.toString()}` | ||
); | ||
}); | ||
export function initialStateFromRoute(flavor: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function initialStateFromRoute(flavor: string) { | |
export function createInitialStateFromRouteTestSuite(flavor: string) { |
it('navigates to the e-commerce demo', async () => { | ||
await browser.url('examples/e-commerce/'); | ||
}); | ||
export function pagination(flavor: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function pagination(flavor: string) { | |
export function createPaginationTestSuite(flavor: string) { |
it('navigates to next page', async () => { | ||
await browser.clickNextPage(); | ||
}); | ||
describe('Page navigation', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe('Page navigation', () => { | |
describe('page navigation', () => { |
describe('InstantSearch - Search on specific price range', () => { | ||
let lowerBound: number; | ||
let upperBound: number; | ||
export function priceRange(flavor: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function priceRange(flavor: string) { | |
export function createPriceRangeTestSuite(flavor: string) { |
import { brandAndQuery } from './specs/brand-and-query.spec'; | ||
import { category } from './specs/category.spec'; | ||
import { initialStateFromRoute } from './specs/initial-state-from-route.spec'; | ||
import { pagination } from './specs/pagination.spec'; | ||
import { priceRange } from './specs/price-range.spec'; | ||
import { flavors } from './flavors'; | ||
|
||
flavors.forEach(flavor => { | ||
describe(flavor, () => { | ||
brandAndQuery(flavor); | ||
category(flavor); | ||
initialStateFromRoute(flavor); | ||
pagination(flavor); | ||
priceRange(flavor); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { brandAndQuery } from './specs/brand-and-query.spec'; | |
import { category } from './specs/category.spec'; | |
import { initialStateFromRoute } from './specs/initial-state-from-route.spec'; | |
import { pagination } from './specs/pagination.spec'; | |
import { priceRange } from './specs/price-range.spec'; | |
import { flavors } from './flavors'; | |
flavors.forEach(flavor => { | |
describe(flavor, () => { | |
brandAndQuery(flavor); | |
category(flavor); | |
initialStateFromRoute(flavor); | |
pagination(flavor); | |
priceRange(flavor); | |
}); | |
}); | |
import { createBrandAndQueryTestSuite } from './specs/brand-and-query.spec'; | |
import { createCategoryTestSuite } from './specs/category.spec'; | |
import { createInitialStateFromRouteTestSuite } from './specs/initial-state-from-route.spec'; | |
import { createPaginationTestSuite } from './specs/pagination.spec'; | |
import { createPriceRangeTestSuite } from './specs/price-range.spec'; | |
import { flavors } from './flavors'; | |
flavors.forEach(flavor => { | |
describe(flavor, () => { | |
createBrandAndQueryTestSuite(flavor); | |
createCategoryTestSuite(flavor); | |
createInitialStateFromRouteTestSuite(flavor); | |
createPaginationTestSuite(flavor); | |
createPriceRangeTestSuite(flavor); | |
}); | |
}); |
I've done the rewording suggestions in algolia/instantsearch@854a553 |
@Haroenv Will you close this PR then? |
BREAKING CHANGE: this requires the url to be /examples/js/e-commerce instead of /examples/e-commerce. This means that until the package is in the monorepo, its tests wouldn't pass. After the main monorepo PR is merged, this repo will move inside and will no longer be published.