Skip to content

Instantly share code, notes, and snippets.

View Ramzi-Alqrainy's full-sized avatar

Ramzi Alqrainy Ramzi-Alqrainy

View GitHub Profile
export const openSideMenu = async () => {
if (await isSideMenuOpen()) {
return;
}
await clickDOMBySelector('#menu-handle')
};
@Ramzi-Alqrainy
Ramzi-Alqrainy / openHomePage
Last active September 4, 2019 15:33
openHomePage
export const openHomePage = async () => {
await openPage(`/ar`);
await page.evaluate(async () => {
window.forceLoadAssets = true;
});
await closeSplashScreen();
await page.waitForSelector('.homePage');
await DOMElemByTextExists('h3')('بيع . إشتري . دردش');
@Ramzi-Alqrainy
Ramzi-Alqrainy / closeSplashScreen
Created September 4, 2019 15:24
closeSplashScreen
export const closeSplashScreen = async () => {
if (!await isSplashScreenExists()) {
return;
}
await clickDOMBySelector('#continueToSiteLink')
};
export const DOMElemByTextExists = elemName => async text => {
const dom = await getDOMByText(elemName)(text);
expect(!!dom).toBeTruthy();
};
@Ramzi-Alqrainy
Ramzi-Alqrainy / clickDOMByText
Created September 4, 2019 15:19
clickDOMByText
export const clickDOMByText = elemName => async text => {
const dom = await getDOMByText(elemName)(text);
await awaitFor(.1);
await dom.click();
};
@Ramzi-Alqrainy
Ramzi-Alqrainy / clickDOMBySelector
Created September 4, 2019 15:18
clickDOMBySelector
export const clickDOMBySelector = async selector => {
await page.waitForSelector(selector);
await page.click(selector);
};