import 'codeceptjs'; import { Helper } from 'codeceptjs'; export declare let webDriver: string; export declare let puppeteer: string; export declare class z extends Helper { static timeout: number; static cb: () => Promise; /** * Scrolls element into viewport, waits for that element to become visible & clickable, then performs click action. * Throws error if any of the action fails in two attempts. * The second parameter is a context (CSS or XPath locator) to narrow the search. * ```js * // simple link * z.click('Logout'); * // button of form * z.click('Submit'); * // CSS button * z.click('#form input[type=submit]'); * // XPath * z.click('//form/*[@type=submit]'); * // link in context * z.click('Logout', '#nav'); * // using strict locator * z.click({css: 'nav a.login'}); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {string} context (optional, null by default) element to search in CSS|XPath|Strict locator. */ static click(locators: string, context?: string): Promise; /** * Scrolls element into viewport, waits for that element to become visible & enabled, then clears field value. * Throws error if any of the action fails in two attempts. * ```js * z.clearField('Email'); * z.clearField('user[email]'); * z.clearField('#email'); * ``` * @param {string} locator CSS|XPath|strict locator. */ static clearField(locators: string, setIWait0?: boolean): Promise; /** * Waits for element to be visible, Clears element value & fills given value. * Throws error if any of the action fails in two attempts. * ```js * // by label * z.fillField('Email', 'hello@world.com'); * // by name * z.fillField('password', secret('123456')); * // by CSS * z.fillField('form#login input[name=username]', 'John'); * // or by strict locator * z.fillField({css: 'form#login input[name=username]'} 'John'); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {string} value */ static fillField(locators: string, value: any): Promise; /** * Checks for the visibility of text, if optional context parameter given then searches for the visibility of text on the locator element. * Throws error if any of the action fails in two attempts. * ```js * z.see('Welcome'); // text welcome on a page * z.see('Welcome', '.content'); // text inside .content div * z.see('Register', {css: 'form.register'}); // use strict locator * ``` * @param {string} text * @param {string} context optional, element located by CSS|Xpath|strict locator in which to search for text. */ static see(text: any, context?: string): Promise; /** * Checks the visibilty of an element. * Throws error if any of the action fails in two attempts. * ```js * z.seeElement('#modal'); * ``` * @param {string} locator CSS|XPath|strict locator. */ static seeElement(locators: string): Promise; /** * Opens a webpage in browser with given url. * ```js * z.amOnPage('/'); // opens main page of website * z.amOnPage('https://github.com'); // opens github * z.amOnPage('/login'); // opens a login page * ``` * @param {string} url */ static amOnPage(url: string): Promise; /** * Asserts that two values are equal. If they are not,an assertion error is thrown. * ```js * I.assertEqual(expected,actual) * ``` * @param {any} expected * @param {any} actual */ static assertEqual(expected: any, actual: any): Promise; /** * Returns all window handles. Useful for referencing a specific handle when calling I.switchToWindow(handle) * ```js * const windows = await I.grabAllWindowHandles(); * ``` * @returns {Array} windows */ static grabAllWindowHandles(): Promise; /** * Returns current window handle * ```js * const window = await z.grabCurrentWindowHandle(); * ``` * @returns {any} window */ static grabCurrentWindowHandle(): Promise; /** * Grabs the number of visible elements * ```js * let numOfElements = await z.grabNumberOfVisibleElements('p'); * ``` * @param {string} locator CSS|XPath|strict locator. * @returns {any} totalElements */ static grabNumberOfVisibleElements(locators: string): Promise; /** * Open new tab and switch to it. * ```js * z.openNewTab(); * ``` */ static openNewTab(): Promise; /** * Presses a key or a key in combination with modifier keys in the browser (on a focused element). * ```js * z.pressKey('Backspace'); * ``` * * To press a key in combination with modifier keys, pass the sequence as an array. All modifier keys (`'Alt'`, `'Control'`, `'Meta'`, `'Shift'`) will be released afterwards. * * ```js * z.pressKey(['Control', 'Z']); * ``` * * For specifying operation modifier key based on operating system it is suggested to use `'CommandOrControl'`. * This will press `'Command'` (also known as `'Meta'`) on macOS machines and `'Control'` on non-macOS machines. * * ```js * z.pressKey(['CommandOrControl', 'Z']); * ``` * * Some of the supported key names are: * - `'AltLeft'` or `'Alt'` * - `'AltRight'` * - `'ArrowDown'` * - `'ArrowLeft'` * - `'ArrowRight'` * - `'ArrowUp'` * - `'Backspace'` * - `'Clear'` * - `'ControlLeft'` or `'Control'` * - `'ControlRight'` * - `'Command'` * - `'CommandOrControl'` * - `'Delete'` * - `'End'` * - `'Enter'` * - `'Escape'` * - `'F1'` to `'F12'` * - `'Home'` * - `'Insert'` * - `'MetaLeft'` or `'Meta'` * - `'MetaRight'` * - `'Numpad0'` to `'Numpad9'` * - `'NumpadAdd'` * - `'NumpadDecimal'` * - `'NumpadDivide'` * - `'NumpadMultiply'` * - `'NumpadSubtract'` * - `'PageDown'` * - `'PageUp'` * - `'Pause'` * - `'Return'` * - `'ShiftLeft'` or `'Shift'` * - `'ShiftRight'` * - `'Space'` * - `'Tab'` * @param {string|Array} key */ static pressKey(key: string | string[]): Promise; /** * Reload the current page. * ```js * z.refreshPage(); * ``` */ static refreshPage(): Promise; /** * Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js). * Filename is relative to output folder. Optionally resize the window to the full available page scrollHeight and scrollWidth * to capture the entire page by passing true in as the second argument. * ```js * z.saveScreenshot('debug.png'); * z.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot * ``` * @param {string} fileName * @param {boolean} fullPage optional */ static saveScreenshot(fileName: string, fullPage?: boolean): Promise; /** * Switches frame or in case of null locator reverts to parent. * ```js * z.switchTo('iframe'); // switch to first iframe * z.switchTo(); // switch back to main page * ``` * @param {string} locator optional, CSS|XPath|strict locator. */ static switchTo(locator?: string): Promise; /** * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab. * ```js * z.switchToNextTab(); * z.switchToNextTab(2); * ``` * @param {number} tabNum optional, number of tabs to switch forward, default: 1. * @param {number} timeout optional, time in seconds to wait. */ static switchToNextTab(tabNum?: number, timeout?: number): Promise; /** * Switch to the window with a specified handle. * ```js * const windows = await z.grabAllWindowHandles(); * // do something * await z.switchToWindow( windows[0] ); * * const window = await z.grabCurrentWindowHandle(); * // do something * await z.switchToWindow( window ); * ``` * @param {string} window */ static switchToWindow(window?: any): Promise; /** * Pauses execution for a number of seconds. * ```js * z.wait(2); // wait 2 secs * ``` * @param {number} timeout */ static wait(timeout: any): Promise; /** * Waits for the visibility of element & for the specified value to be in value attribute. * ```js * z.waitForValue('//input', "GoodValue"); * ``` * @param {string} locator input field locator. * @param {string} value * @param {number} timeout optional, default timeout is value mentioned against key "waitForTimeout" */ static waitForValue(locators: string, value: string, timeout?: number): Promise; /** * Waits for the visibility of element. * ```js * z.waitForVisible('#popup'); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {number} timeout optional, default timeout is value mentioned against key "waitForTimeout" */ static waitForVisible(locators: string, timeout?: number): Promise; /** * Waits for a text to appear. * Element can be located by CSS or XPath. Narrow down search results by providing context. * ```js * z.waitForText('Thank you, form has been submitted'); * z.waitForText('Thank you, form has been submitted', 5, '#modal'); * ``` * @param {string} text * @param {number} timeout optional, default timeout is value mentioned against key "waitForTimeout" * @param {string} locator optional, CSS|XPath|strict locator. */ static waitForText(text: string, timeout?: number, locator?: string): Promise; /** * Waits for an element to be removed or become invisible on a page. * Element can be located by CSS or XPath. * ```js * z.waitForInvisible('#popup'); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {number} timeout optional, default timeout is value mentioned against key "waitForTimeout" */ static waitForInvisible(locators: string, timeout?: number): Promise; /** * Waits for an element to become enabled. * Element can be located by CSS or XPath. * ```js * z.waitForEnabled('#popup'); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {number} timeout optional, default timeout is value mentioned against key "waitForTimeout" */ static waitForEnabled(locators: string, timeout?: number): Promise; /** * Waits for an element to be present on page. * Element can be located by CSS or XPath. * ```js * z.waitForElement('.btn.continue'); * z.waitForElement('.btn.continue', 5); // wait for 5 secs * ``` * @param {string} locator CSS|XPath|strict locator. * @param {number} timeout optional, default timeout is value mentioned against key "waitForTimeout" */ static waitForElement(locators: string, timeout?: number): Promise; /** * Waits for an element to be clickable. * Element can be located by CSS or XPath. * ```js * z.waitForClickable('.btn.continue'); * z.waitForClickable('.btn.continue', 5); // wait for 5 secs * ``` * @param {string} locator CSS|XPath|strict locator. * @param {number} timeout optional, default timeout is value mentioned against key "waitForTimeout" */ static waitForClickable(locators: string, timeout?: number): Promise; /** * Waits for an element to be visible. * Element can be located by CSS or XPath. * ```js * z.attachFile('Avatar', 'data/avatar.jpg'); * z.attachFile('form input[name=avatar]', 'data/avatar.jpg'); * ``` * @param {string} locator label|name|CSS|XPath|strict locator. * @param {string} filepath local file path relative to codecept.json config file */ static attachFile(locators: string, filepath: string): Promise; /** * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab. * ```js * z.switchToPreviousTab(); * z.switchToPreviousTab(2); * ``` * @param {number} tabNum optional, number of tabs to switch backward, default: 1. * @param {number} timeout optional, time in seconds to wait. */ static switchToPreviousTab(tabNum?: number, timeout?: number): Promise; /** * Close current tab. * ```js * z.closeCurrentTab(); * ``` */ static closeCurrentTab(): Promise; /** * Close all tabs except for the current one. * ```js * z.closeOtherTabs(); * ``` */ static closeOtherTabs(): Promise; /** * Scroll element into viewport. * ```js * z.scrollIntoView('#submit'); * z.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" }); * z.scrollIntoView('#submit', true); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {any} alignTop optional, or scrollIntoViewOptions (optional), * see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView. */ static scrollIntoView(locators: string, alignTop?: any): Promise; /** * Retrieves a text from an element located by CSS or XPath and returns it to test. * Resumes test execution, so should be used inside static async with await operator. * If multiple elements found returns an array of texts. * ```js * let pin = await z.grabTextFrom('#pin'); * ``` * @param {string} locator element located by CSS|XPath|strict locator. * @returns {string|string[]} text */ static grabTextFrom(locators: string): Promise; /** * Retrieves an attribute from an element located by CSS or XPath and returns it to test. An array as a result will be returned if there are more than one matched element. * Resumes test execution, so should be used inside static async with await operator. * ```js * let hint = await z.grabAttributeFrom('#tooltip', 'title'); * ``` * @param {string} locator element located by CSS|XPath|strict locator. * @param {string} attribute attribute name. * @returns {string} text */ static grabAttributeFrom(locators: string, attribute: string): Promise; /** * Scrolls element into viewport, waits for that element to become visible & clickable. Also checks if element is already checked. * Then selects a checkbox or radio button. * * The second parameter is a context (CSS or XPath locator) to narrow the search. * ```js * z.checkOption('#agree'); * z.checkOption('I Agree to Terms and Conditions'); * z.checkOption('agree', '//form'); * ``` * @param {string} locator checkbox located by label | name | CSS | XPath | strict locator. * @param {string} context optional element located by CSS | XPath | strict locator. */ static checkOption(locators: string, context?: string): Promise; /** * Checks that a text is not present on a page, if optional context parameter given then searches for the invisibility of text on the locator element. * Use context parameter to narrow down the search. * Throws error if any of the action fails in two attempts. * ```js * z.dontSee('Login'); // assume we are already logged in. * z.dontSee('Login', '.nav'); // no login inside .nav element * ``` * @param {string} text which is not present. * @param {string} context optional, element located by CSS|Xpath|strict locator in which to search for text. */ static dontSee(text: string, context?: string): Promise; /** * Checks that element is not visible (or in DOM) * Throws error if any of the action fails in two attempts. * ```js * z.seeElement('#modal'); * ``` * @param {string} locator CSS|XPath|strict locator. */ static dontSeeElement(locators: string): Promise; /** * Scrolls element into viewport, waits for that element to become visible & clickable, then performs double click action. * Throws error if any of the action fails in two attempts. * The second parameter is a context (CSS or XPath locator) to narrow the search. * ```js * z.doubleClick('Edit'); * z.doubleClick('Edit', '.actions'); * z.doubleClick({css: 'button.accept'}); * z.doubleClick('.btn.edit'); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {string} context (optional, null by default) element to search in CSS|XPath|Strict locator. */ static doubleClick(locators: string, context?: string): Promise; /** * Scrolls element into viewport, waits for that element to become visible & clickable, then Drag an item to a destination element. * Throws error if any of the action fails in two attempts. * * ```js * z.dragAndDrop('#dragHandle', '#container'); * ``` * @param {string} srcLocator CSS|XPath|strict locator. * @param {string} destLocator CSS|XPath|Strict locator. */ static dragAndDrop(srcLocator: string, destLocator: string): Promise; /** * Executes sync script on a page. * Pass arguments to function as additional parameters. * Will return execution result to a test. * In this case you should use static async function and await to receive results. * * Example with jQuery DatePicker: * * ```js * // change date of jQuery DatePicker * z.executeScript(function() { * // now we are inside browser context * $('date').datetimepicker('setDate', new Date()); * }); * ``` * Can return values. Don't forget to use `await` to get them. * * ```js * let date = await z.executeScript(function(el) * // only basic types can be returned * return $(el).datetimepicker('getDate').tostring(); * } '#date'); // passing jquery selector * ``` * @param {string|function} fn function to be executed in browser context. * @param {...any} args to be passed to function. * */ static executeScript(fn: any | ((...params: any[]) => any), ...args: any[]): Promise; /** * Scrolls element into viewport, waits for that element to become visible & clickable, then selects an option in a drop-down select. * Throws error if any of the action fails in two attempts. * * ```js * z.selectOption('Choose Plan', 'Monthly'); // select by label * z.selectOption('subscription', 'Monthly'); // match option by text * z.selectOption('subscription', '0'); // or by value * z.selectOption('//form/select[@name=account]','Premium'); * z.selectOption('form select[name=account]', 'Premium'); * z.selectOption({css: 'form select[name=account]'} 'Premium'); * ``` * Provide an array for the second argument to select multiple options. * ```js * z.selectOption('Which OS do you use?', ['Android', 'iOS']); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {string|string[]} option CSS|XPath|Strict locator. */ static selectOption(locators: string, option: string): Promise; /** * Checks for element to be present, scrolls into view & Moves cursor to element matched by locator. * Extra shift can be set with offsetX and offsetY options. * * ```js * z.moveCursorTo('.tooltip'); * z.moveCursorTo('#submit', 5,5); * ``` * * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator. * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset. * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset. * * */ static moveCursorTo(locators: string, offsetX?: number, offsetY?: number): Promise; /** * Checks for element to be present, scrolls into view, waits for element to be visible and retrieves a value from a form element located by CSS or XPath, returns it to test. * Resumes test execution, so **should be used inside async function with `await`** operator. * * ```js * let email = await z.grabValueFrom('input[name=email]'); * ``` * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator. * @returns {Promise} attribute value * */ static grabValueFrom(locators: string): Promise; /** * Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt. * ```js * await z.cancelPopup(); * ``` */ static cancelPopup(): Promise; /** * Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt. * Don't confuse popups with modal windows, as created by [various * libraries](http://jster.net/category/windows-modals-popups). * ```js * await z.acceptPopup(); * ``` */ static acceptPopup(): Promise; /** * Checks that the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`, contains the * given string. * * @param {string} text value to check. * * ```js * await z.seeInPopup("value"); * ``` * */ static seeInPopup(text: string): Promise; /** * Gets a cookie object by name. * If none provided gets all cookies. * Resumes test execution, so **should be used inside async function with `await`** operator. * * ```js * let cookie = await z.grabCookie('auth'); * assert(cookie.value, '123456'); * ``` * * @param {?string} [name=null] cookie name. * @returns {Promise} attribute value * */ static grabCookie(name: string): Promise; /** * Get current URL from browser * Resumes test execution, so **should be used inside async function with `await`** operator. * * ```js * let url = await z.grabCurrentUrl(); * ``` * */ static grabCurrentUrl(): Promise; /** * Scrolls element into viewport, waits for that element to become visible & enabled, then Force clicks an element * ```js * z.forceClick('#hiddenButton'); * z.forceClick('Click me', '#hidden'); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {string} context (optional, null by default) element to search in CSS|XPath|Strict locator. */ static forceClick(locators: string, context?: string): Promise; /** * Asserts that an element is visible a given number of times * ```js * await z..seeNumberOfVisibleElements('.buttons', 3); * ``` * @param {string} locator CSS|XPath|strict locator. * @param {number} num number of elements.. * */ static seeNumberOfVisibleElements(locators: string, num: number): Promise; /** * Checks that title contains text. * ```js * z.seeInTitle('Home Page'); * ``` * @param {string} text value to check. */ static seeInTitle(text: any): Promise; /** * Performs a swipe Right inside an element. * Can be slow or fast swipe. * ```js * z.swipeRight('#container'); * * @param {string} locator an element on which to perform swipe * @param {string}[speed='slow'] a speed to perform: `slow` or `fast`. */ static swipeRight(locators: string, speed?: string): Promise; /** * Scrolls to element matched by locator. Extra shift can be set with offsetX and offsetY options. * ```js * z.scrollTo('footer'); * z.scrollTo('#submit', 5, 5); * ``` * @param {string} locator located by CSS|XPath|strict locator. * @param {number} offsetX (optional, 0 by default) X-axis offset * @param {number} offsetY (optional, 0 by default) Y-axis offset. * */ static scrollTo(locators: string, offsetX?: number, offsetY?: number): Promise; /** * Scroll page to the bottom. * ```js * z.scrollPageToBottom(); */ static scrollPageToBottom(): Promise; /** * Scroll page to the top. * ```js * z.scrollPageToTop(); */ static scrollPageToTop(): Promise; /** * Asserts that two values are not equal. If they are ,an assertion error is thrown. * ```js * z.assertNotEqual(expected,actual) * ``` * @param {any} expected * @param {any} actual */ static assertNotEqual(expected: any, actual: any): Promise; /** * Scrolls element into viewport, waits for that element to become visible. * Then Verifies that the specified checkbox is not checked. * * ```js * z.dontSeeCheckboxIsChecked('#agree'); * z.dontSeeCheckboxIsChecked('I agree to terms'); * z.dontSeeCheckboxIsChecked('agree'); * ``` * @param {string} field located by label|name|CSS|XPath|strict locator. */ static dontSeeCheckboxIsChecked(locators: string): Promise; /** * Scrolls element into viewport, waits for that element to become visible. * Then Checks that the given input field or textarea equals to given value. * * ```js * z.seeInField('Username', 'davert'); * z.seeInField({css: 'form textarea'},'Type your comment here'); * z.seeInField('#searchform input','Search'); * ``` * @param {string} field located by label|name|CSS|XPath|strict locator. * @param {string} value value to check. */ static seeInField(locators: string, value: string): Promise; /** * Scrolls element into viewport, waits for that element to become visible. * Then Verifies that the specified checkbox is checked. * * ```js * z.seeCheckboxIsChecked('Agree'); * z.seeCheckboxIsChecked('#agree'); * z.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'}); * ``` * @param {string} field located by label|name|CSS|XPath|strict locator. */ static seeCheckboxIsChecked(locators: string): Promise; /** * Types out the given text into an active field. * To slow down typing use a second parameter, to set interval between key presses. * Note: Should be used when fillField is not an option. * ```js * z.type('Type this out.'); * * // typing values with a 100ms interval * z.type('4141555311111111', 100); * // When passing in an array * z.type(['T', 'E', 'X', 'T']) * * @param {string} key|keys key or array of keys to type. * @param {number} delay (optional) delay in ms between key presses */ static type(key: string | string[], delay?: number): Promise; /** * Resize the current window to provided width and height. * First parameter can be set to `maximize`. * ```js * z.resizeWindow(width, height) */ static resizeWindow(width: any, height?: any): Promise; /** * Grab number of open tabs. * Resumes test execution, so **should be used inside async function with `await`** operator. * * ```js * let tabs = await z.grabNumberOfOpenTabs(); * ``` * */ static grabNumberOfOpenTabs(): Promise; /** * Checks that current url contains a provided fragment. * * @param {string} url value to check. * * ```js * await z.seeInCurrentUrl("url"); * ``` * */ static seeInCurrentUrl(url: string): Promise; /** * Retrieves a page title and returns it to test. * Resumes test execution, so **should be used inside async function with `await`** operator. * * ```js * let tabs = await z.grabTitle(); * ``` * */ static grabTitle(): Promise; /** * Enters a directory In local filesystem. * Starts from a current directory * z.amInPath('output/downloads'); * @param {string} openPath */ static amInPath(openPath: string): Promise; /** * Waits for file to be present in current directory. * * ```js * z.handleDownloads(); * z.click('Download large File'); * z.amInPath('output/downloads'); * z.waitForFile('largeFilesName.txt', 10); // wait 10 seconds for file * ``` * @param {string} name * @param {number} [sec] seconds to wait */ static waitForFile(name: string, sec?: number): Promise; /** * Checks that file with a name including given text exists in the current directory. * *```js * z.handleDownloads(); * z.click('Download as PDF'); * z.amInPath('output/downloads'); * z.seeFileNameMatching('.pdf'); * ``` */ static seeFileNameMatching(text: string): Promise; /** * Checks that file found by `seeFile` doesn't include text. * @param {string} text * @param {string} [encoding='utf8'] */ static dontSeeInThisFile(text: string, encoding?: string): Promise; /** * Checks that all elements with given locator have given attributes. * * ```js * z.seeAttributesOnElements('//form', { method: "post"}); * ``` * * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator. * @param {object} attributes attributes and their values to check. * */ static seeAttributesOnElements(locators: string, attributes: any): Promise; /** * Checks that a given Element is present in the DOM * Element is located by CSS or XPath. * * ```js * z.seeElementInDOM('#modal'); * ``` * @param {string} locator element located by CSS|XPath|strict locator. * */ static seeElementInDOM(locators: string): Promise; /** * Appends text into the field. * A field can be located by text, accessibility id, id. * * ```js * z.appendField('name', 'davert'); * ``` * * @param {string} field * @param {string} value */ static appendField(locators: string, value: string): Promise; /** * Waits for an element to become not attached to the DOM on a page (by default waits for 1sec). * Element can be located by CSS or XPath. * * ```js * z.waitForDetached('#popup'); * ``` * * @param {string} locator element located by CSS|XPath|strict locator. * @param {number} timeout (optional, `1` by default) time in seconds to wait */ static waitForDetached(locators: string, timeout?: number): Promise; /** * Sends POST request to API. * * ```js * I.sendPostRequest('/api/users.json', { "email": "user@user.com" }); * ``` * * @param {*} url * @param {*} payload * @param {object} headers */ static sendPostRequest(url: any, payload?: any, headers?: any): Promise; /** * Send GET request to REST API * * ```js * I.sendGetRequest('/api/users.json'); * ``` * * @param {*} url * @param {object} headers */ static sendGetRequest(url: any, headers?: any): Promise; /** * Opposite to `seeElementInDOM`. Checks that element is not on page. * * ```js * I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not * ``` * * @param {string} locator located by CSS|XPath|Strict locator. */ static dontSeeElementInDOM(locators: string): Promise; /** * Checks that text is equal to provided one. * * ```js * I.seeTextEquals('text', 'h1'); * ``` * * @param {string} text element value to check. * @param {string} optional [context] element located by CSS|XPath|strict locator. */ static seeTextEquals(text: string, context?: string): Promise; /** * Checks that title is equal to provided one. * * ```js * z.seeTitleEquals('Test title.'); * ``` * * @param {string} text value to check. */ static seeTitleEquals(text: string): Promise; /** * Clears a cookie by name, * if none provided clears all cookies. * * ```js * z.clearCookie(); * z.clearCookie('test'); * ``` * * @param {string} (optional, `null` by default) cookie name * */ static clearCookie(cookie?: string): Promise; /** * Retrieves the innerHTML from an element located by CSS or XPath and returns it to test. * Resumes test execution, so **should be used inside async function with `await`** operator. * If more than one element is found - an array of HTMLs returned. * * ```js * let postHTML = await z.grabHTMLFrom('#post'); * ``` * * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator. * @returns {Promise} HTML code for an element */ static grabHTMLFrom(locators: string): Promise; /** * Retrieves all the innerHTML from elements located by CSS or XPath and returns it to test. * Resumes test execution, so should be used inside async function with await operator. * * ```js * let postHTML = await z.grabHTMLFromAll('#post'); * ``` * * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator. * @returns {Promise} HTML code for an element */ static grabHTMLFromAll(locators: string): Promise; /** * Checks that current url does not contain a provided fragment. * * @param {string} url value to check. * Appium: support only web testing */ static dontSeeInCurrentUrl(url: string): Promise; /** * Checks that current url is equal to provided one. * If a relative url provided, a configured url will be prepended to it. * So both examples will work: * * ```js * z.seeCurrentUrlEquals('/register'); * z.seeCurrentUrlEquals('http://my.site.com/register'); * ``` * * @param {string} url value to check. */ static seeCurrentUrlEquals(url: string): Promise; /** * Asserts that an element appears a given number of times in the DOM. * Element is located by label or name or CSS or XPath. * * * ```js * z.seeNumberOfElements('#submitBtn', 1); * ``` * * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator. * @param {number} num number of elements. * * {{ react }} */ static seeNumberOfElements(locators: string, num: number): Promise; /** * Checks that cookie with given name does not exist. * * ```js * z.dontSeeCookie('auth'); // no auth cookie * ``` * * @param {string} name cookie name. * */ static dontSeeCookie(name: string): Promise; /** * Checks that current url is not equal to provided one. * If a relative url provided, a configured url will be prepended to it. * * ```js * z.dontSeeCurrentUrlEquals('/login'); // relative url are ok * z.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok * ``` * * @param {string} url value to check. * */ static dontSeeCurrentUrlEquals(url: string): Promise; /** * Checks that title does not contain text. * * ```js * z.dontSeeInTitle('Error'); * ``` * * @param {string} text value to check. * */ static dontSeeInTitle(text: any): Promise; /** * Checks that the current page does not contains the given string in its raw source code. * * ```js * z.dontSeeInSource('