- Cypress - Discussion
- Cypress - Useful Resources
- Cypress - Quick Guide
- Cypress - GitHub
- Cypress - Plugins
- Cypress - Reports
- Cypress - Configuration of JSON File
- Cypress - Hooks
- Cypress - Environment Variables
- Cypress - Fixtures
- Cypress - Custom Commands
- Cypress - Debugging
- Cypress - Screenshots and Videos
- Cypress - Dashboards
- Cypress - Prompt Pop-up Window
- Cypress - Data Driven Testing
- Cypress - File Upload
- Cypress - Get and Post
- Cypress - Cookies
- Cypress - Mouse Actions
- Cypress - Web Tables
- Cypress - Frames
- Cypress - Hidden Elements
- Cypress - Child Windows
- Cypress - Alerts
- Cypress - Dropdown
- Cypress - Tabs
- Cypress - Checkbox
- Cypress - jQuery
- Cypress - Working with XHR
- Cypress - Asynchronous Behavior
- Cypress - Text Verification
- Cypress - Assertions
- Cypress - Locators
- Cypress - Aliases
- Cypress - Variables
- Cypress - Basic Commands
- Cypress - Supported Browsers
- Cypress - Build First Test
- Cypress - Test Runner
- Cypress - Architecture and Environment Setup
- Cypress - Introduction
- Cypress - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Cypress - Cookies
Cypress处理方法Cookies.pstenOnce()和Cookies.defaults()。 这种方法Cookies.debug()在 co发生任何变化时,可生成对 con的标识。
否则,“Cypress”在每次试验执行之前会拆除所有 co。 我们可以利用Cypress.Cookies.p reservesOnce()保存其姓名的 co,以供其他测试使用。
Syntax
The syntax for the authorities related to the cookies in Cypress are as follows -
如果 co基价值被配置或清除,这将产生ole木。
Cypress.Cookies.debug(enable, option)
这里
• 如果能够减少厨师的.。
选择——没收 co的违约值,例如保存 co。
Cypress.Cookies.debug(true) // logs will generate if cookies are modified cy.clearCookie( cookie1 ) cy.setCookie( cookie2 , val )
减少伐木量。
Cypress.Cookies.debug(true, { verbose: false }) Cypress.Cookies.debug(false) // logs will not generate if cookies are modified
以下的辛迪加将保护 co,在进行另一次试验之前不会予以清除。
Cypress.Cookies.preserveOnce(cookie names...)
这一辛迪加用于改变全球组合,并维持一组用于测试的 co。 任何修改都将适用于这一特定测试(仍保留在cy/支持/指数档案中,并在测试执行之前装上)。
Cypress.Cookies.defaults(option) Cypress.Cookies.defaults({ preserve: cookie1 })
这里 the cookie named cookie1 will not be cleared before running the test.
Cookie Methods
热带风暴中的一些ok基方法如下:
cy.clearCookies() − It removes all the cookies from present domain and subdomain.
cy.clearCookie(姓名) 它用名称将 co子从浏览器中删除。
cy.getCookie(姓名)- 它用名称从浏览器处获得 co。
cy.getCookies() - 它用于获取所有 co。
cy.setCookie(姓名)- 它可以召集一个厨师。
Implementation
下面是“Cypress”中的 co基方法的实施。
describe( Tutorialspoint Test , function () { // test case it( Scenario 1 , function (){ // launch the apppcation cy.visit("https://accounts.google.com"); // enable cookie logging Cypress.Cookies.debug(true) //set cookie cy.setCookie( cookie1 , value1 ) //get cookie by name and verify value cy.getCookie( cookie1 ).should( have.property , value , value1 ) //clear cookie by name cy.clearCookie( cookie ) //get all cookies cy.getCookies() //clear all cookies cy.clearCookies() //verify no cookies cy.getCookies().should( be.empty ) }); });
产出如下:
Advertisements