How to use sessions.setSessionData method in Cypress

Best JavaScript code snippet using cypress

MovieListFull.js

Source:MovieListFull.js Github

copy

Full Screen

1import React, { useEffect, useState } from 'react';2import DatePicker from 'react-datepicker';3import 'react-datepicker/dist/react-datepicker.css';4import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';5import { faCalendarAlt } from '@fortawesome/free-solid-svg-icons';6import SearchBar from './SearchBar/SearchBar';7import Loader from '../Loader/Loader';8import MovieListSingle from './MovieListSingle/MovieListSingle';9import $ from 'jquery';10import jQuery from 'jquery';11import starOn from '../../images/rate/star-on.svg';12import starOff from '../../images/rate/star-off.svg';13import { useTranslation } from 'react-i18next';14import axios from 'axios';15const MovieListFull = ({ language="Georgia", getStartDateFromMovieList, getMovieId }) => {16 const [startDate, setStartDate] = useState(new Date());17 const [searchTerm, setSearchTerm] = useState('');18 const [movieListData, setMovieListData] = useState([]);19 const [loading, setLoading] = useState(false);20 const [selectValue, setSelectValue] = useState(''); //ჟანრები21 const [sessionData, setSessionData] = useState([]);22 const [backUpMovies, setBackUpMovies] = useState([]);23 const [filteredResults, setFilteredResults] = useState([]);24 const { t } = useTranslation();25 const selectHandle = (e) => {26 setSelectValue(e.target.value);27 };28 // send startDate to MovieFull component29 useEffect(() => {30 getStartDateFromMovieList(startDate);31 }, [startDate]);32 //ჟანრების ასარჩევი ფუნქცია33 const handleChange = (e) => {34 setSearchTerm(e.target.value);35 };36 //ყველა ფილმის რექვესთი37 const apiCallMovieList = async () => {38 try {39 setLoading(true);40 const result = await axios(41 `https://kinosakartvelo.ge/admin-panel/api/v1/posters`42 );43 setMovieListData(result.data.data);44 setBackUpMovies(result.data.data);45 setStartDate(new Date());46 setLoading(false);47 } catch (error) {48 setLoading(false);49 console.log(error);50 }51 };52 // imdb request53 const apiCallIMDB = async () => {54 try {55 setLoading(true);56 const result = await axios(57 `https://kinosakartvelo.ge/admin-panel/api/v1/posters?IMDB[gt]=5`58 );59 setMovieListData(result.data.data);60 setLoading(false);61 } catch (error) {62 setLoading(false);63 console.log(error);64 }65 };66 //კალენდარის თარიღის მიხედვით ფილმები67 useEffect(() => {68 setFilteredResults(69 sessionData.filter(70 (session) =>71 session.Date ===72 startDate73 .toLocaleString('en-GB', { hour12: false })74 .slice(0, 10)75 .split('/')76 .join('.')77 )78 );79 {80 }81 }, [startDate, sessionData]);82 //სესსიის რექვესთი83 const apiCallSessions = async () => {84 try {85 setLoading(true);86 const result = await axios(87 `https://kinosakartvelo.ge/admin-panel/api/v1/sessions`88 );89 setSessionData(result.data.data);90 setStartDate(new Date());91 setLoading(false);92 } catch (error) {93 setLoading(false);94 console.log(error);95 }96 };97 useEffect(() => {98 apiCallMovieList();99 apiCallSessions();100 }, []);101 useEffect(() => {102 apiCallMovieList();103 }, [selectValue == 'All']);104 //Filter Functions105 const allMovies = () => {106 setMovieListData(backUpMovies);107 };108 //ჟანრების მიხედვით ფილტრაცია109 useEffect(() => {110 let newArr = backUpMovies.filter((movie) => {111 return movie.Genre.filter((genre) => genre == selectValue) == selectValue;112 });113 setMovieListData(newArr);114 }, [selectValue]);115 //ფილტრი, ფილმის სტატუსის მიხედვით: "პრემიერა"116 const premiereFilter = () => {117 let newArr = backUpMovies.filter((item) => {118 return item.movieStatus === 'premiera';119 });120 setMovieListData(newArr);121 };122 //ფილტრი, ფილმის სტატუსის მიხედვით: "ახლა კინოში"123 const nowInCinema = () => {124 setMovieListData(backUpMovies.filter((item) => item.movieStatus === 'now'));125 };126 //ფილტრი, ფილმის სტატუსის მიხედვით: "მალე კინოში"127 const comingSoon = () => {128 setMovieListData(129 backUpMovies.filter((item) => item.movieStatus === 'soon')130 );131 };132 //ფილმების ძებნა133 useEffect(() => {134 const results = backUpMovies.filter((person) =>135 language === 'Georgia'136 ? person.GEO.title.toLowerCase().includes(searchTerm)137 : language === 'United_Kingdom'138 ? person.EN.title.toLowerCase().includes(searchTerm)139 : person.RU.title.toLowerCase().includes(searchTerm)140 );141 setMovieListData(results);142 }, [searchTerm]);143 // **** jQuery ****144 useEffect(() => {145 /* jQuery Raty - A Star Rating Plugin */146 (function ($) {147 var methods = {148 init: function (settings) {149 return this.each(function () {150 methods.destroy.call(this);151 this.opt = $.extend(true, {}, $.fn.raty.defaults, settings);152 var that = $(this),153 inits = ['number', 'readOnly', 'score', 'scoreName'];154 methods._callback.call(this, inits);155 if (this.opt.precision) {156 methods._adjustPrecision.call(this);157 }158 this.opt.number = methods._between(159 this.opt.number,160 0,161 this.opt.numberMax162 );163 this.opt.path = this.opt.path || '';164 if (165 this.opt.path &&166 this.opt.path.charAt(this.opt.path.length - 1) !== '/'167 ) {168 this.opt.path += '/';169 }170 this.stars = methods._createStars.call(this);171 this.score = methods._createScore.call(this);172 methods._apply.call(this, this.opt.score);173 var space = this.opt.space ? 4 : 0,174 width =175 this.opt.width ||176 this.opt.number * this.opt.size + this.opt.number * space;177 if (this.opt.cancel) {178 this.cancel = methods._createCancel.call(this);179 width += this.opt.size + space;180 }181 if (this.opt.readOnly) {182 methods._lock.call(this);183 } else {184 that.css('cursor', 'pointer');185 methods._binds.call(this);186 }187 if (this.opt.width !== false) {188 that.css('width', width);189 }190 methods._target.call(this, this.opt.score);191 that.data({ settings: this.opt, raty: true });192 });193 },194 _adjustPrecision: function () {195 this.opt.targetType = 'score';196 this.opt.half = true;197 },198 _apply: function (score) {199 if (score && score > 0) {200 score = methods._between(score, 0, this.opt.number);201 this.score.val(score);202 }203 methods._fill.call(this, score);204 if (score) {205 methods._roundStars.call(this, score);206 }207 },208 _between: function (value, min, max) {209 return Math.min(Math.max(parseFloat(value), min), max);210 },211 _binds: function () {212 if (this.cancel) {213 methods._bindCancel.call(this);214 }215 methods._bindClick.call(this);216 methods._bindOut.call(this);217 methods._bindOver.call(this);218 },219 _bindCancel: function () {220 methods._bindClickCancel.call(this);221 methods._bindOutCancel.call(this);222 methods._bindOverCancel.call(this);223 },224 _bindClick: function () {225 var self = this,226 that = $(self);227 self.stars.on('click.raty', function (evt) {228 self.score.val(229 self.opt.half || self.opt.precision230 ? that.data('score')231 : this.alt232 );233 if (self.opt.click) {234 self.opt.click.call(self, parseFloat(self.score.val()), evt);235 }236 });237 },238 _bindClickCancel: function () {239 var self = this;240 self.cancel.on('click.raty', function (evt) {241 self.score.removeAttr('value');242 if (self.opt.click) {243 self.opt.click.call(self, null, evt);244 }245 });246 },247 _bindOut: function () {248 var self = this;249 $(this).on('mouseleave.raty', function (evt) {250 var score = parseFloat(self.score.val()) || undefined;251 methods._apply.call(self, score);252 methods._target.call(self, score, evt);253 if (self.opt.mouseout) {254 self.opt.mouseout.call(self, score, evt);255 }256 });257 },258 _bindOutCancel: function () {259 var self = this;260 self.cancel.on('mouseleave.raty', function (evt) {261 $(this).attr('src', self.opt.path + self.opt.cancelOff);262 if (self.opt.mouseout) {263 self.opt.mouseout.call(self, self.score.val() || null, evt);264 }265 });266 },267 _bindOverCancel: function () {268 var self = this;269 self.cancel.on('mouseover.raty', function (evt) {270 $(this).attr('src', self.opt.path + self.opt.cancelOn);271 self.stars.attr('src', self.opt.path + self.opt.starOff);272 methods._target.call(self, null, evt);273 if (self.opt.mouseover) {274 self.opt.mouseover.call(self, null);275 }276 });277 },278 _bindOver: function () {279 var self = this,280 that = $(self),281 action = self.opt.half ? 'mousemove.raty' : 'mouseover.raty';282 self.stars.on(action, function (evt) {283 var score = parseInt(this.alt, 10);284 if (self.opt.half) {285 var position = parseFloat(286 (evt.pageX - $(this).offset().left) / self.opt.size287 ),288 plus = position > 0.5 ? 1 : 0.5;289 score = score - 1 + plus;290 methods._fill.call(self, score);291 if (self.opt.precision) {292 score = score - plus + position;293 }294 methods._roundStars.call(self, score);295 that.data('score', score);296 } else {297 methods._fill.call(self, score);298 }299 methods._target.call(self, score, evt);300 if (self.opt.mouseover) {301 self.opt.mouseover.call(self, score, evt);302 }303 });304 },305 _callback: function (options) {306 for (var i in options) {307 if (typeof this.opt[options[i]] === 'function') {308 this.opt[options[i]] = this.opt[options[i]].call(this);309 }310 }311 },312 _createCancel: function () {313 var that = $(this),314 icon = this.opt.path + this.opt.cancelOff,315 cancel = $('<img />', {316 src: icon,317 alt: 'x',318 title: this.opt.cancelHint,319 class: 'raty-cancel',320 });321 if (this.opt.cancelPlace == 'left') {322 that.prepend('&#160;').prepend(cancel);323 } else {324 that.append('&#160;').append(cancel);325 }326 return cancel;327 },328 _createScore: function () {329 return $('<input />', {330 type: 'hidden',331 name: this.opt.scoreName,332 }).appendTo(this);333 },334 _createStars: function () {335 var that = $(this);336 for (var i = 1; i <= this.opt.number; i++) {337 var title = methods._getHint.call(this, i),338 icon =339 this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff';340 icon = this.opt.path + this.opt[icon];341 $('<img />', { src: icon, alt: i, title: title }).appendTo(this);342 if (this.opt.space) {343 that.append(i < this.opt.number ? '&#160;' : '');344 }345 }346 return that.children('img');347 },348 _error: function (message) {349 $(this).html(message);350 $.error(message);351 },352 _fill: function (score) {353 var self = this,354 hash = 0;355 for (var i = 1; i <= self.stars.length; i++) {356 var star = self.stars.eq(i - 1),357 select = self.opt.single ? i == score : i <= score;358 if (self.opt.iconRange && self.opt.iconRange.length > hash) {359 var irange = self.opt.iconRange[hash],360 on = irange.on || self.opt.starOn,361 off = irange.off || self.opt.starOff,362 icon = select ? on : off;363 if (i <= irange.range) {364 star.attr('src', self.opt.path + icon);365 }366 if (i == irange.range) {367 hash++;368 }369 } else {370 var icon = select ? 'starOn' : 'starOff';371 star.attr('src', this.opt.path + this.opt[icon]);372 }373 }374 },375 _getHint: function (score) {376 var hint = this.opt.hints[score - 1];377 return hint === '' ? '' : hint || score;378 },379 _lock: function () {380 var score = parseInt(this.score.val(), 10), // TODO: 3.1 >> [['1'], ['2'], ['3', '.1', '.2']]381 hint = score382 ? methods._getHint.call(this, score)383 : this.opt.noRatedMsg;384 $(this).data('readonly', true).css('cursor', '').attr('title', hint);385 this.score.attr('readonly', 'readonly');386 this.stars.attr('title', hint);387 if (this.cancel) {388 this.cancel.hide();389 }390 },391 _roundStars: function (score) {392 var rest = (score - Math.floor(score)).toFixed(2);393 if (rest > this.opt.round.down) {394 var icon = 'starOn'; // Up: [x.76 .. x.99]395 if (this.opt.halfShow && rest < this.opt.round.up) {396 // Half: [x.26 .. x.75]397 icon = 'starHalf';398 } else if (rest < this.opt.round.full) {399 // Down: [x.00 .. x.5]400 icon = 'starOff';401 }402 this.stars403 .eq(Math.ceil(score) - 1)404 .attr('src', this.opt.path + this.opt[icon]);405 } // Full down: [x.00 .. x.25]406 },407 _target: function (score, evt) {408 if (this.opt.target) {409 var target = $(this.opt.target);410 if (target.length === 0) {411 methods._error.call(this, 'Target selector invalid or missing!');412 }413 if (this.opt.targetFormat.indexOf('{score}') < 0) {414 methods._error.call(this, 'Template "{score}" missing!');415 }416 var mouseover = evt && evt.type == 'mouseover';417 if (score === undefined) {418 score = this.opt.targetText;419 } else if (score === null) {420 score = mouseover ? this.opt.cancelHint : this.opt.targetText;421 } else {422 if (this.opt.targetType == 'hint') {423 score = methods._getHint.call(this, Math.ceil(score));424 } else if (this.opt.precision) {425 score = parseFloat(score).toFixed(1);426 }427 if (!mouseover && !this.opt.targetKeep) {428 score = this.opt.targetText;429 }430 }431 if (score) {432 score = this.opt.targetFormat433 .toString()434 .replace('{score}', score);435 }436 if (target.is(':input')) {437 target.val(score);438 } else {439 target.html(score);440 }441 }442 },443 _unlock: function () {444 $(this)445 .data('readonly', false)446 .css('cursor', 'pointer')447 .removeAttr('title');448 this.score.removeAttr('readonly', 'readonly');449 for (var i = 0; i < this.opt.number; i++) {450 this.stars.eq(i).attr('title', methods._getHint.call(this, i + 1));451 }452 if (this.cancel) {453 this.cancel.css('display', '');454 }455 },456 cancel: function (click) {457 return this.each(function () {458 if ($(this).data('readonly') !== true) {459 methods[click ? 'click' : 'score'].call(this, null);460 this.score.removeAttr('value');461 }462 });463 },464 click: function (score) {465 return $(this).each(function () {466 if ($(this).data('readonly') !== true) {467 methods._apply.call(this, score);468 if (!this.opt.click) {469 methods._error.call(470 this,471 'You must add the "click: function(score, evt) { }" callback.'472 );473 }474 this.opt.click.call(this, score, $.Event('click'));475 methods._target.call(this, score);476 }477 });478 },479 destroy: function () {480 return $(this).each(function () {481 var that = $(this),482 raw = that.data('raw');483 if (raw) {484 that485 .off('.raty')486 .empty()487 .css({ cursor: raw.style.cursor, width: raw.style.width })488 .removeData('readonly');489 } else {490 that.data('raw', that.clone()[0]);491 }492 });493 },494 getScore: function () {495 var score = [],496 value;497 $(this).each(function () {498 value = this.score.val();499 score.push(value ? parseFloat(value) : undefined);500 });501 return score.length > 1 ? score : score[0];502 },503 readOnly: function (readonly) {504 return this.each(function () {505 var that = $(this);506 if (that.data('readonly') !== readonly) {507 if (readonly) {508 that.off('.raty').children('img').off('.raty');509 methods._lock.call(this);510 } else {511 methods._binds.call(this);512 methods._unlock.call(this);513 }514 that.data('readonly', readonly);515 }516 });517 },518 reload: function () {519 return methods.set.call(this, {});520 },521 score: function () {522 return arguments.length523 ? methods.setScore.apply(this, arguments)524 : methods.getScore.call(this);525 },526 set: function (settings) {527 return this.each(function () {528 var that = $(this),529 actual = that.data('settings'),530 news = $.extend({}, actual, settings);531 that.raty(news);532 });533 },534 setScore: function (score) {535 return $(this).each(function () {536 if ($(this).data('readonly') !== true) {537 methods._apply.call(this, score);538 methods._target.call(this, score);539 }540 });541 },542 };543 $.fn.raty = function (method) {544 if (methods[method]) {545 return methods[method].apply(546 this,547 Array.prototype.slice.call(arguments, 1)548 );549 } else if (typeof method === 'object' || !method) {550 return methods.init.apply(this, arguments);551 } else {552 $.error('Method ' + method + ' does not exist!');553 }554 };555 $.fn.raty.defaults = {556 cancel: false,557 cancelHint: 'Cancel this rating!',558 cancelOff: 'cancel-off.png',559 cancelOn: 'cancel-on.png',560 cancelPlace: 'left',561 click: undefined,562 half: false,563 halfShow: true,564 hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'],565 iconRange: undefined,566 mouseout: undefined,567 mouseover: undefined,568 noRatedMsg: 'Not rated yet!',569 number: 5,570 numberMax: 20,571 path: '',572 precision: false,573 readOnly: false,574 round: { down: 0.25, full: 0.6, up: 0.76 },575 score: undefined,576 scoreName: 'score',577 single: false,578 size: 16,579 space: true,580 starHalf: 'star-half.png',581 starOff: 'star-off.png',582 starOn: 'star-on.png',583 target: undefined,584 targetFormat: '{score}',585 targetKeep: false,586 targetText: '',587 targetType: 'hint',588 width: undefined,589 };590 })(jQuery);591 }, [movieListData, filteredResults]);592 useEffect(() => {593 //3. Rating scrore init594 //Rating star595 $('.score').raty({596 width: 130,597 score: 0,598 starOff: starOff,599 starOn: starOn,600 });601 //4. Sorting by category602 // sorting function603 $('.tags__item').click(function (e) {604 //prevent the default behaviour of the link605 e.preventDefault();606 //active sorted item607 $('.tags__item').removeClass('item-active');608 $(this).addClass('item-active');609 var filter = $(this).attr('data-filter');610 //show all the list items(this is needed to get the hidden ones shown)611 $('.movie--preview').show();612 $('.pagination').show();613 /*using the :not attribute and the filter class in it we are selecting614 only the list items that don't have that class and hide them '*/615 if (filter.toLowerCase() !== 'all') {616 $('.movie--preview:not(.' + filter + ')').hide();617 //Show pagination on filter = all;618 $('.pagination').hide();619 }620 });621 //5. Toggle function for additional content622 //toggle timetable show623 $('.movie__show-btn').click(function (ev) {624 ev.preventDefault();625 $(this).parents('.movie--preview').find('.time-select').slideToggle(500);626 });627 $('.time-select__item').click(function () {628 $('.time-select__item').removeClass('active');629 $(this).addClass('active');630 });631 }, [filteredResults]);632 // console.log(genre);633 return (634 <>635 {loading && <Loader />}636 <React.Fragment>637 {/* Search bar */}638 <SearchBar639 handleChange={handleChange}640 searchTerm={searchTerm}641 setSearchTerm={setSearchTerm}642 />643 {/* Main content */}644 <section className='container'>645 <div className='col-sm-12'>646 <h2 className='page-heading'>{t('movieListFull-title')}</h2>647 <div className='select-area'>648 <form className='select' method='get'></form>649 {/* <i class='far fa-calendar-alt'></i> */}650 {/* <FontAwesomeIcon icon='calendar-alt' /> */}651 <div className='customCalendarIcon'>652 <FontAwesomeIcon icon={faCalendarAlt} size='lg' />653 </div>654 {/* <div className="datepicker">655 <span className="datepicker__marker"><i className="fa fa-calendar" />{t('movieListFull-date')}</span>656 <input type="text" id="datepicker" defaultValue="03/10/2014" className="datepicker__input" />657 </div> */}658 <DatePicker659 dateFormat='dd/MM/yyyy'660 selected={startDate}661 onChange={(date) => setStartDate(date)}662 minDate={new Date()}663 placeholderText={new Date()664 .toLocaleString('en-GB', { hour12: false })665 .slice(0, 10)666 .split('-')667 .reverse()668 .join('/')}669 />670 <div className='genres-on-movieList'>671 {t('movieListFull-genre')}:672 </div>673 <form className='select select--film-category'>674 <select675 onChange={(e) => selectHandle(e)}676 name='select_item'677 className='select__sort'>678 <option value='All'>{t('All')}</option>679 <option value='Animation'>{t('Animation')}</option>680 <option value='Biography'>{t('Biography')}</option>681 <option value='Crime'>{t('Crime')}</option>682 <option value='Documentary'>{t('Documentary')}</option>683 <option value='Drama'>{t('Drama')}</option>684 <option value='Adult'>{t('Adult')}</option>685 <option value='Western'>{t('Western')}</option>686 <option value='History'>{t('History')}</option>687 <option value='Comedy'>{t('Comedy')}</option>688 <option value='Romance'>{t('Romance')}</option>689 <option value='Musical'>{t('Musical')}</option>690 <option value='Short'>{t('Short')}</option>691 <option value='Mystery'>{t('Mystery')}</option>692 <option value='Music'>{t('Music')}</option>693 <option value='Action'>{t('Action')}</option>694 <option value='War'>{t('War')}</option>695 <option value='Family'>{t('Family')}</option>696 <option value='Horror'>{t('Horror')}</option>697 <option value='TVSeries'>{t('TVSeries')}</option>698 <option value='Sport'>{t('Sport')}</option>699 <option value='Thriller'>{t('Thriller')}</option>700 <option value='Fantasy'>{t('Fantasy')}</option>701 <option value='Anime'>{t('Anime')}</option>702 </select>703 </form>704 </div>705 <div className='tags-area'>706 <div className='tags tags--unmarked'>707 <span className='tags__label'>{t('movieListFull-sort')}:</span>708 <ul>709 <li className='item-wrap'>710 <a711 onClick={allMovies}712 href='#'713 className='tags__item item-active'714 data-filter='all'>715 {t('movieListFull-li1')}716 </a>717 </li>718 <li className='item-wrap' onClick={() => apiCallIMDB()}>719 <a href='#' className='tags__item' data-filter='release'>720 {t('movieListFull-li2')}721 </a>722 </li>723 <li className='item-wrap' onClick={premiereFilter}>724 <a href='#' className='tags__item' data-filter='popularity'>725 {t('movieListFull-li3')}726 </a>727 </li>728 <li className='item-wrap' onClick={nowInCinema}>729 <a href='#' className='tags__item' data-filter='comments'>730 {t('movieListFull-li4')}731 </a>732 </li>733 <li className='item-wrap' onClick={comingSoon}>734 <a href='#' className='tags__item' data-filter='ending'>735 {t('movieListFull-li5')}736 </a>737 </li>738 </ul>739 </div>740 </div>741 {/* Movie preview item */}742 {movieListData.length > 0 && filteredResults.length > 0 ? (743 movieListData744 .filter((item) =>745 filteredResults.find((item2) => {746 return item2.Movie_ID == item.movieID;747 })748 )749 .map((item) => {750 return (751 <li key={item.id}>752 <div className='movie some movie--full movie--preview--new'>753 <MovieListSingle754 item={item}755 language={language}756 getMovieId={getMovieId}757 />758 </div>759 </li>760 );761 })762 ) : (763 <h1 className='noMovie'>{t('movieNotFound')}</h1>764 )}765 </div>766 </section>767 </React.Fragment>768 </>769 );770};...

Full Screen

Full Screen

MovieFullDesc.js

Source:MovieFullDesc.js Github

copy

Full Screen

1import React, { useState, useEffect } from "react";2import {3 StyleSheet,4 Text,5 View,6 Image,7 Dimensions,8 ScrollView,9 Button,10 SafeAreaView,11} from "react-native";12import { Ionicons } from "@expo/vector-icons";13import Spinner from "../components/Spinner";14import Calendar from "../components/Calendar";15import axios from "axios";16import moment from "moment";17const { width: screenWidth } = Dimensions.get("window");18const MovieFullDesc = ({ navigation }) => {19 const [sessionData, setSessionData] = useState([]);20 const [loading, setLoading] = useState(false);21 const [startDate, setStartDate] = useState();22 const [activeBtn, setActiveBtn] = useState("");23 const [chosenTime, setChosenTime] = useState("");24 //Api Request for sessions25 const apiCallPosters = async () => {26 try {27 setLoading(true);28 const result = await axios(29 `https://kinosakartvelo.ge/admin-panel/api/v1/sessions`30 );31 setSessionData(result.data.data);32 setLoading(false);33 } catch (error) {34 setLoading(false);35 console.log(error);36 }37 };38 const activeBtnHandler = (index, time) => {39 setActiveBtn(index);40 setChosenTime(time);41 if (activeBtn === index) {42 setActiveBtn("");43 setChosenTime("");44 }45 };46 useEffect(() => {47 apiCallPosters();48 }, []);49 //Reset Time when change calendar day50 useEffect(() => {51 setChosenTime("");52 }, [startDate]);53 //Get item from Navigation54 let item = navigation.getParam("item");55 return (56 <>57 {loading && <Spinner />}58 {!loading && (59 <SafeAreaView>60 <ScrollView>61 <View style={styles.container}>62 <Image63 style={styles.Image}64 source={{65 uri: `https://kinosakartvelo.ge/admin-panel/images/posters/${item.imgLandscape}`,66 }}67 />68 </View>69 <View>70 <Text style={styles.genreCont}>71 {item.Genre.map((genre) => genre + ", ")}72 </Text>73 </View>74 <View>75 <View style={styles.imdbCont}>76 <Text style={styles.genre}>77 {item.GEO.title.slice(0, 15)}...78 </Text>79 <Text style={styles.imdb}>80 <Ionicons name="play" size={32} color="orange" /> {item.IMDB}81 IMDB82 </Text>83 </View>84 <Text style={styles.description}>{item.GEO.description}</Text>85 </View>86 <Calendar startDate={startDate} setStartDate={setStartDate} />87 <View>88 <View89 style={{90 display: "flex",91 flexWrap: "wrap",92 flexDirection: "row",93 justifyContent: "flex-start",94 alignItems: "flex-start",95 marginVertical: 20,96 }}97 >98 {sessionData.Time !== "" ? (99 sessionData.map((session, index) => {100 if (101 session.Date ===102 moment(startDate).utc().local().format("DD.MM.YYYY")103 ) {104 return (105 <SafeAreaView106 style={styles.btnContainer}107 key={session.Sessions_ID}108 >109 <View style={styles.timeBtn}>110 <Button111 onPress={activeBtnHandler.bind(112 null,113 index,114 session.Time115 )}116 color={activeBtn === index ? "red" : null}117 title={session.Time}118 />119 </View>120 </SafeAreaView>121 );122 }123 })124 ) : (125 <Text>No Movie</Text>126 )}127 </View>128 <Text>არჩეული დრო: {chosenTime}</Text>129 </View>130 <View style={{ marginTop: 10 }}>131 <Button132 disabled={chosenTime ? false : true}133 onPress={() =>134 navigation.navigate("Hall", {135 time: chosenTime,136 date: startDate,137 })138 }139 title="Next"140 />141 </View>142 </ScrollView>143 </SafeAreaView>144 )}145 </>146 );147};148const styles = StyleSheet.create({149 container: {150 alignItems: "center",151 },152 Image: {153 marginTop: -70,154 width: 400,155 height: 350,156 borderRadius: 5,157 resizeMode: "contain",158 },159 genreCont: {160 paddingLeft: 10,161 },162 genre: {163 fontSize: 21,164 fontWeight: "bold",165 paddingLeft: 10,166 },167 imdbCont: {168 marginTop: 10,169 width: screenWidth,170 flex: 1,171 flexDirection: "row",172 justifyContent: "space-between",173 },174 imdb: {175 fontSize: 21,176 alignItems: "center",177 justifyContent: "center",178 paddingRight: 10,179 },180 description: {181 textAlign: "center",182 paddingHorizontal: 20,183 marginTop: 15,184 fontSize: 15,185 },186 btnContainer: {187 padding: 5,188 },189 btnActive: {190 backgroundColor: "red",191 },192 timeBtn: {193 flexShrink: 1,194 width: 70,195 },196});197MovieFullDesc.navigationOptions = ({ navigation }) => {198 let item = navigation.getParam("item");199 return {200 headerTitle: item.GEO.title,201 };202};...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { sessions } = require('cypress/types/sinon');2describe('Session', () => {3 it('Session Test', () => {4 cy.get('input[name="q"]').type('Cypress');5 cy.get('input[name="btnK"]').click();6 cy.get('div.g').find('a').first().invoke('text').as('getLink');7 cy.get('@getLink').then((text) => {8 sessions.setSessionData('link', text);9 });10 cy.get('input[name="q"]').clear().type('Cypress {enter}');11 cy.get('div.g').find('a').first().should('have.text', sessions.getSessionData('link'));12 });13});14{15}16 ✓ Session Test (2100ms)17 1 passing (3s)18 (Results)

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful