-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding new tests for date picker #1
base: master
Are you sure you want to change the base?
Conversation
beforeEach(() => { | ||
// guess, there is a bug here, cause 6 month corresponds to June, however cy.clock is | ||
// defined as July. | ||
const now = new Date(2020, 7, 3).getTime() |
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.
7 - июль же?
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.
тут я брала август, как 7 месяц)
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.
Спасибо. Тесты написаны вполне здорово! Вы раньше случайно не писали на сайпрессе?
Оставил буквально пару комментариев по поводу выбранных селекторов. Спасибо за участие в воркшопе :)
.contains("Check-in") | ||
.parent() |
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.
Я бы сделал cy.get("input").eq(0)
– потому что название вот этих лейблочек оно не постоянное и может легко сломать тесты. А первый инпут всегда будет отвечать за старт
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.
супер! спасибо за комент!
.findByLabelText("Aug 3, 2020") | ||
.should("be.enabled") | ||
.should("have.attr", "tabindex", "-1") | ||
.should("have.attr", "data-mui-test", "DateRangeDay"); |
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.
data-mui-test
это аттрибут который предназначен как-раз для тестирования, чтобы находить элемент. Чтобы проверить что день выбран в принципе достаточно tabIndex, но можно еще проверить на класс .Mui-selected
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.
ага, спасибо.
cy.get("@dateRangePicker") | ||
.contains("Check-in") | ||
.parent() | ||
.find("input") | ||
.should("have.value", "07/31/2020"); | ||
|
||
cy.get("@dateRangePicker") | ||
.contains("Check-out") | ||
.parent() | ||
.find("input") | ||
.should("have.value", "08/28/2020"); |
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.
тут бы я проверил что нужный отрезок был выбран в самом календаре.
потому что получается что тут мы сначала вводим текст в инпуты и потом сразу проверяем что этот же текст в инпутах остался 🤷♂️
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.
вот тут согласна, но я не додумалась как проверить именно что отрезок выбран, по каким атрибутам.
cy.executeInDatePicker() | ||
.findByLabelText("Aug 28, 2020") | ||
.should("have.focus") | ||
.should("be.focused"); |
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.
Тут явно не хватает проверки что между 4 и 24 августа даты подсвечены
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.
я подумаю как это реализовать.
// guess, there is a bug here, cause 6 month corresponds to June, however cy.clock is | ||
// defined as July. |
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.
все правильно :)
new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]])
monthIndex
Integer value representing the month, beginning with 0 for January to 11 for December.
from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date
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.
оооо) спасибо)
.click(); | ||
|
||
cy.get("@datepicker") | ||
.findByPlaceholderText("mm/dd/yyyy") |
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.
текстбокс лучше было бы найти с помощью просто .find("input")
или еще лучше .findByRole("textbox")
.findByLabelText("Jul 26, 2020") | ||
.should("be.focused"); | ||
}); | ||
it.only("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.
ай-ай-ай .only :D
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.
эх
Спасибо за воркшоп, это был мой первый опыт с Сайпресом и получилось очень интересно, отдельное спасибо за практическую часть и домашку, извините что не сразу отписала, как так закрутилась и забыла. Ф вообще больше Java человек и все эти JS штучки иногда вводят в заблуждение. |
No description provided.