Day 17 快没文章了 先偷渡cypress 改天改写一下

.url 抓取测试url

.window 使用window物件

.its 在window底下使用localstorage

import { buildUser } from '../xx';

describe('register a new user', () => {
	const user = buildUser();

	cy.visit('/')
		.findByText(/register/i)
		.click()
		.findByLobelText(/username/i)
		.type(user.username)
		.findByLobelText(/password/i)
		.type(user.password)
		.findByText(/submit/i)
		.click()
		.url()
		.should('eq', 'http://localhost:8080/')
		.window()
		.its('localhost.token')
		.should('be.a', 'string')
		.findByTestId('username-display')
		.should('have.text', user.username)
});

模拟 http responsive error

cy.server().route({
	method: 'POST',
	url: 'http://localhost:3000/register',
	status: 500,
	response: {},
});

模拟request

cy.request({
	url: 'http:/localhost:3000/register',
	method: 'POST',
	body: user,
});

很多重复的指令,可以透过custom commands 去

cy.server().route({
	method: 'POST',
	url: 'http://localhost:3000/register',
	status: 500,
	response: {}
})

<<:  连续 30 天 玩玩看 ProtoPie - Day 17

>>:  [Day 17]从零开始学习 JS 的连续-30 Days---AJAX--方法介绍

【图解演算法教学】【Tree】二元树遍历 vs LeetCode 501 找众数

Youtube连结:https://bit.ly/3m1VQWV 在我们了解Binary Tree...

Firebase来帮忙资料上传 Day 12

将资料上传至Firebase上 使用UIImagePikerController来选取照片上传 使用...

Day24 - 如何盘中计算技术指标且发送讯号到line: 不同频率分K计算

之前我们学会了如何用talib计算一分K技术指标,也学会了如何用line发送通知。因为shioaji...

Day 14 - Grid 排版

如果上一篇威尔猪讲的 Flex 是十字形排版法,那今天讲的 Grid 就属於棋盘格排版法。它比 F...

Day 21. Unity 介面与Unreal Engine介面比较

我Day 2有关於Unity介面的介绍,一般来说,学习顺序是Unity -> Unreal,因...