Best Python code snippet using gherkin-python
EditMatch.jsx
Source:EditMatch.jsx
1import React, { Component } from 'react';2import MatchService from '../../services/MatchService';3class EditMatch extends Component {4 constructor(props){5 super(props)6 this.state={7 op:this.props.match.params.id,8 match_Id:'',9 match_name:'',10 match_genre:'',11 match_language:'',12 match_hours:'',13 match_rating:'',14 match_description:'',15 match_date:''16 }17 }18 componentDidMount(){19 MatchService.getByMatchId(this.state.op).then((response)=>{20 let matchob=response.data;21 this.setState({match_Id:matchob.matchId,22 match_name:matchob.matchName,23 match_genre:matchob.matchGenre,24 match_lanuage:matchob.matchLanguage,25 match_hours:matchob.matchHours,26 match_rating:matchob.matchRating,27 match_description:matchob.matchDescription,28 match_date:matchob.matchDate });29 })30 31 }32 editMatch=(e)=>{33 e.preventDefault();34 console.log(this.state);35 let match={ matchId:this.state.match_Id,36 matchName:this.state.match_name,37 matchGenre:this.state.match_genre,38 matchLanguage:this.state.match_language,39 matchHours:this.state.match_hours,40 matchRating:this.state.match_rating,41 matchDescription:this.state.match_description,42 matchDate:this.state.match_date}43 console.log((JSON.stringify(match)));44 MatchService.editMatch(match);45 console.log("match details updated succesfully");46 this.props.history.push('/Admin');47 }48 49 50 changeMatchNameHandler=(event)=>{this.setState({match_name:event.target.value});}51 changeMatchGenreHandler=(event)=>{this.setState({match_genre:event.target.value});}52 changeMatchLanguageHandler=(event)=>{this.setState({match_language:event.target.value});}53 changeMatchHoursHandler=(event)=>{this.setState({match_hours:event.target.value});}54 changeMatchRatingHandler=(event)=>{this.setState({match_rating:event.target.value});}55 changeMatchDescriptionHandler=(event)=>{this.setState({match_description:event.target.value});}56 changeMatchDateHandler=(event)=>{this.setState({match_date:event.target.value});}57 changeMatchIdHandler=(event)=>{this.setState({match_Id:event.target.value});}58 render() {59 return (60 <section>61 <div class="custom-container">62 63 <form onSubmit={this.editMatch} style={{background:'white'}}>64 <div class="col-lg-6 text-center text-lg-left" >65 <div class="section-title">66 <h1>Edit Match Details</h1>67 </div>68 </div>69 <hr />70 <div class="form-row">71 <div class="form-group">72 <div class="input-data">73 <input74 type="text"75 class="form-control"76 formControlName="matchId"77 name='match_Id'78 id='match_Id'79 required80 value={this.state.match_Id} 81 onChange={this.changeMatchIdHandler}82 83 />84 <div class="underline"></div>85 <label for="">Match Id</label>86 </div>87 </div>88 </div>89 <div class="form-row">90 <div class="form-group">91 <div class="input-data">92 <input93 type="text"94 class="form-control"95 formControlName="matchName"96 name='match_name'97 id='match_name'98 required99 value={this.state.match_name} 100 onChange={this.changeMatchNameHandler}101 102 />103 <div class="underline"></div>104 <label for="">Match Name</label>105 </div>106 </div>107 </div>108 <div class="form-row">109 <div class="form-group">110 <div class="row">111 <div class="col input-data">112 <input113 type="text"114 class="form-control"115 formControlName="matchGenre"116 name='match_genre'117 id='match_genre'118 value={this.state.match_genre} 119 onChange={this.changeMatchGenreHandler}120 121 required122 />123 <div class="underline"></div>124 <label for="">Match Genre</label>125 </div>126 <div class="col input-data">127 <input128 type="text"129 class="form-control"130 formControlName="matchLanguage"131 name='match_language'132 id='match_language'133 value={this.state.match_language} 134 onChange={this.changeMatchLanguageHandler}135 required136 />137 <div class="underline"></div>138 <label for="">Match Language</label>139 </div>140 </div>141 </div>142 </div>143 <div class="form-row">144 <div class="form-group">145 <div class="row">146 <div class="col input-data">147 <input148 type="text"149 class="form-control"150 formControlName="matchHours"151 name='match_hours'152 id='match-hours'153 value={this.state.match_hours} 154 onChange={this.changeMatchHoursHandler}155 required156 />157 <div class="underline"></div>158 <label for="">Match Hours</label>159 </div>160 <div class="col input-data">161 <input162 type="number"163 class="form-control"164 formControlName="matchRating"165 name='match_rating'166 id='match_rating'167 value={this.state.match_rating} 168 onChange={this.changeMatchRatingHandler}169 required170 />171 <div class="underline"></div>172 <label for="">Match Rating</label>173 </div>174 </div>175 </div>176 </div>177 <div class="form-group">178 <div class="form-row">179 <div class="input-data textarea">180 <textarea181 rows="8"182 cols="80"183 formControlName="matchDescription"184 name='match_description'185 id='match_description'186 value={this.state.match_description} 187 onChange={this.changeMatchDescriptionHandler}188 required189 ></textarea>190 <div class="underline"></div>191 <label for="">Match Description</label>192 </div>193 </div>194 <div class="form-row">195 <div class="date">196 <input197 type="date"198 class="form-control"199 placeholder="Enter Match Date"200 formControlName="matchDate"201 name='match_date'202 id='match_date'203 value={this.state.match_date} 204 onChange={this.changeMatchDateHandler}205 />206 </div>207 </div>208 </div>209 <div>210 <button211 type="submit"212 class="btn btn-primary"213 214 >215 update changes216 </button>217 </div>218 </form>219 </div>220 </section>221 );222 }223}...
Addmatch.jsx
Source:Addmatch.jsx
1import React, { Component } from 'react';2import './AddMatch.css';3import MatchService from '../../services/MatchService';4class Addmatch extends Component {5 constructor(){6 super();7 this.state={8 match_name:'',9 match_genre:'',10 match_language:'',11 match_hours:'',12 match_rating:'',13 match_description:'',14 match_date:'' 15 }16 this.changeMatchNameHandler=this.changeMatchNameHandler.bind(this);17 this.changeMatchGenreHandler=this.changeMatchGenreHandler.bind(this);18 this.changeMatchLanguageHandler=this.changeMatchLanguageHandler.bind(this);19 this.changeMatchHoursHandler=this.changeMatchHoursHandler.bind(this);20 this.changeMatchRatingHandler=this.changeMatchRatingHandler.bind(this);21 this.changeMatchDescriptionHandler=this.changeMatchDescriptionHandler.bind(this);22 this.changeMatchDateHandler=this.changeMatchDateHandler.bind(this);23 this.addMatch=this.addMatch.bind(this);24 }25 addMatch=(u)=>{26 u.preventDefault();27 let match={matchName:this.state.match_name,28 matchGenre:this.state.match_genre,29 matchLanguage:this.state.match_language,30 matchHours:this.state.match_hours,31 matchRating:this.state.match_rating,32 matchDescription:this.state.match_description,33 matchDate:this.state.match_date}34 console.log((JSON.stringify(match)));35 MatchService.matchAdd(match)36 .then(response => {37 console.log('Match Added successfully', response.data);38 this.props.history.push('/Admin');39 });40 }41 changeMatchNameHandler=(event)=>{this.setState({match_name:event.target.value});}42 changeMatchGenreHandler=(event)=>{this.setState({match_genre:event.target.value});}43 changeMatchLanguageHandler=(event)=>{this.setState({match_language:event.target.value});}44 changeMatchHoursHandler=(event)=>{this.setState({match_hours:event.target.value});}45 changeMatchRatingHandler=(event)=>{this.setState({match_rating:event.target.value});}46 changeMatchDescriptionHandler=(event)=>{this.setState({match_description:event.target.value});}47 changeMatchDateHandler=(event)=>{this.setState({match_date:event.target.value});}48 render() {49 return (50 51 <section>52 <div class="custom-container">53 54 <form onSubmit={this.addMatch} style={{background:'white'}}>55 <div class="col-lg-6 text-center text-lg-left" style={{background:'blue'}}>56 <div class="section-title">57 <h1>Add Match</h1>58 </div>59 </div>60 <hr />61 <div class="form-row">62 <div class="form-group">63 <div class="input-data">64 <input65 type="text"66 class="form-control"67 formControlName="matchName"68 name='match_name'69 id='match_name'70 required71 value={this.state.match_name} 72 onChange={this.changeMatchNameHandler}73 />74 <div class="underline"></div>75 <label for="">Match Name</label>76 </div>77 </div>78 </div>79 <div class="form-row">80 <div class="form-group">81 <div class="row">82 <div class="col input-data">83 <input84 type="text"85 class="form-control"86 formControlName="matchGenre"87 name='match_genre'88 id='match_genre'89 value={this.state.match_genre} 90 onChange={this.changeMatchGenreHandler}91 required92 />93 <div class="underline"></div>94 <label for="">Match Genre</label>95 </div>96 <div class="col input-data">97 <input98 type="text"99 class="form-control"100 formControlName="matchLanguage"101 name='match_language'102 id='match_language'103 value={this.state.match_language} 104 onChange={this.changeMatchLanguageHandler}105 required106 />107 <div class="underline"></div>108 <label for="">Match Language</label>109 </div>110 </div>111 </div>112 </div>113 <div class="form-row">114 <div class="form-group">115 <div class="row">116 <div class="col input-data">117 <input118 type="text"119 class="form-control"120 formControlName="matchHours"121 name='match_hours'122 id='match-hours'123 value={this.state.match_hours} 124 onChange={this.changeMatchHoursHandler}125 required126 />127 <div class="underline"></div>128 <label for="">Match Hours</label>129 </div>130 <div class="col input-data">131 <input132 type="number"133 class="form-control"134 formControlName="matchRating"135 name='match_rating'136 id='match_rating'137 value={this.state.match_rating} 138 onChange={this.changeMatchRatingHandler}139 required140 />141 <div class="underline"></div>142 <label for="">Match Rating</label>143 </div>144 </div>145 </div>146 </div>147 <div class="form-group">148 <div class="form-row">149 <div class="input-data textarea">150 <textarea151 rows="8"152 cols="80"153 formControlName="matchDescription"154 name='match_description'155 id='match_description'156 value={this.state.match_description} 157 onChange={this.changeMatchDescriptionHandler}158 required159 ></textarea>160 <div class="underline"></div>161 <label for="">Match Description</label>162 </div>163 </div>164 <div class="form-row">165 <div class="date">166 <input167 type="date"168 class="form-control"169 placeholder="Enter Match Date"170 formControlName="matchDate"171 name='match_date'172 id='match_date'173 value={this.state.match_date} 174 onChange={this.changeMatchDateHandler}175 />176 </div>177 </div>178 </div>179 <div>180 <button181 type="submit"182 class="btn btn-primary"183 184 >185 Add Match186 </button>187 </div>188 </form>189 </div>190</section>191 );192 }193}...
MatchList.jsx
Source:MatchList.jsx
1// import React, { Component } from "react";2// import MatchService from '../../services/MatchService';3// import { Link } from "react-router-dom";4// class TutorialsList extends Component {5// constructor(props) {6// super(props);7// this.onChangeSearchTitle = this.onChangeSearchTitle.bind(this);8// this.retrieveMatchs = this.retrieveMatchs.bind(this);9// this.refreshList = this.refreshList.bind(this);10// // this.searchTitle = this.searchTitle.bind(this);11// this.state = {12// matchs: [],13// match_id: -1,14// match_date: new Date().toLocaleString(),15// match_description: "",16// match_genre: "",17// match_hours: "",18// match_language: "",19// match_name: "",20// match_rating: "",21// show_show_id: -122// };23// }24// componentDidMount() {25// this.retrieveMatchs();26// }27// onChangeSearchTitle(e) {28// const searchTitle = e.target.value;29// this.setState({30// searchTitle: searchTitle31// });32// } 33// retrieveMatchs() {34// MatchService.getMatchs()35// .then(response => {36// this.setState({37// matchs: response.data38// });39// console.log(response.data);40// })41// .catch(e => {42// console.log(e);43// });44// }45// refreshList() {46// this.retrieveMatchs();47// this.setState({48// match_id: -1,49// match_date: new Date().toLocaleString(),50// match_description: "",51// match_genre: "",52// match_hours: "",53// match_language: "",54// match_name: "",55// match_rating: "",56// show_show_id: -157// });58// }59// // searchTitle() {60// // MatchService.findByTitle(this.state.searchTitle)61// // .then(response => {62// // this.setState({63// // tutorials: response.data64// // });65// // console.log(response.data);66// // })67// // .catch(e => {68// // console.log(e);69// // });70// // }71// render() {72// const { searchTitle, tutorials, currentTutorial, currentIndex } = this.state;73// return (74// <div className="list row">75// <div className="col-md-8">76// <div className="input-group mb-3">77// <input78// type="text"79// className="form-control"80// placeholder="Search by title"81// value={searchTitle}82// onChange={this.onChangeSearchTitle}83// />84// <div className="input-group-append">85// <button86// className="btn btn-outline-secondary"87// type="button"88// onClick={this.searchTitle}89// >90// Search91// </button>92// </div>93// </div>94// </div>95// <div className="col-md-6">96// <h4>Matchs List</h4>97// <ul className="list-group">98// {tutorials &&99// tutorials.map((tutorial, index) => (100// <li101// className={102// "list-group-item " +103// (index === currentIndex ? "active" : "")104// }105// onClick={() => this.setActiveTutorial(tutorial, index)}106// key={index}107// >108// {tutorial.title}109// </li>110// ))}111// </ul>112// <button113// className="m-3 btn btn-sm btn-danger"114// onClick={this.removeAllTutorials}115// >116// Remove All117// </button>118// </div>119// <div className="col-md-6">120// {currentTutorial ? (121// <div>122// <h4>Tutorial</h4>123// <div>124// <label>125// <strong>Title:</strong>126// </label>{" "}127// {currentTutorial.title}128// </div>129// <div>130// <label>131// <strong>Description:</strong>132// </label>{" "}133// {currentTutorial.description}134// </div>135// <div>136// <label>137// <strong>Status:</strong>138// </label>{" "}139// {currentTutorial.published ? "Published" : "Pending"}140// </div>141// <Link142// to={"/tutorials/" + currentTutorial.id}143// className="badge badge-warning"144// >145// Edit146// </Link>147// </div>148// ) : (149// <div>150// <br />151// <p>Please click on a Tutorial...</p>152// </div>153// )}154// </div>155// </div>156// );157// }158// }...
BookMatch.jsx
Source:BookMatch.jsx
1import React, { Component } from 'react';2import { Navbar, Nav, Container } from 'react-bootstrap';3import MatchService from '../../services/MatchService';4class BookMatch extends Component {5 constructor(props) {6 super(props)7 this.state = {8 op: this.props.match.params.id,9 matcharr: []10 // match_Id: '',11 // match_name: '',12 // match_genre: '',13 // match_language: '',14 // match_hours: '',15 // match_rating: '',16 // match_description: '',17 // match_date: ''18 }19 }20 componentDidMount() {21 MatchService.getByMatchId(this.state.op).then((response) => {22 console.log("in did mount");23 this.setState({ matcharr: response.data })24 console.log(this.state.matcharr)25 // let matchob = response.data;26 // this.setState({27 // match_Id: matchob.matchId,28 // match_name: matchob.matchName,29 // match_genre: matchob.matchGenre,30 // match_lanuage: matchob.matchLanguage,31 // match_hours: matchob.matchHours,32 // match_rating: matchob.matchRating,33 // match_description: matchob.matchDescription,34 // match_date: matchob.matchDate35 // });36 })37 }38 // editMatch = (e) => {39 // e.preventDefault();40 // console.log(this.state);41 // let match = {42 // matchId: this.state.match_Id,43 // matchName: this.state.match_name,44 // matchGenre: this.state.match_genre,45 // matchLanguage: this.state.match_language,46 // matchHours: this.state.match_hours,47 // matchRating: this.state.match_rating,48 // matchDescription: this.state.match_description,49 // matchDate: this.state.match_date50 // }51 // console.log((JSON.stringify(match)));52 // MatchService.editMatch(match);53 // console.log("match details updated succesfully");54 // this.props.history.push('/Admin');55 // }56 // changeMatchNameHandler = (event) => { this.setState({ match_name: event.target.value }); }57 // changeMatchGenreHandler = (event) => { this.setState({ match_genre: event.target.value }); }58 // changeMatchLanguageHandler = (event) => { this.setState({ match_language: event.target.value }); }59 // changeMatchHoursHandler = (event) => { this.setState({ match_hours: event.target.value }); }60 // changeMatchRatingHandler = (event) => { this.setState({ match_rating: event.target.value }); }61 // changeMatchDescriptionHandler = (event) => { this.setState({ match_description: event.target.value }); }62 // changeMatchDateHandler = (event) => { this.setState({ match_date: event.target.value }); }63 // changeMatchIdHandler = (event) => { this.setState({ match_Id: event.target.value }); }64 render() {65 return (66 <div>67 <h2 className="text-center">Match Details</h2>68 <div className='row'>69 <table striped bordered hover variant="dark">70 <thead>71 <tr>72 <th>Match Id</th>73 <th> Match Name</th>74 <th>Match Genre</th>75 <th> Match Hours</th>76 <th> Match Language</th>77 <th> Match Description</th>78 <th> Match Rating</th>79 <th> Show Id</th>80 </tr>81 </thead>82 <tbody>83 {84 85 <tr key={this.state.matcharr.showId}>86 <td>{this.state.matcharr.matchId}</td>87 <td>{this.state.matcharr.matchName}</td>88 <td>{this.state.matcharr.matchGenre}</td>89 <td>{this.state.matcharr.matchHours}</td>90 <td>{this.state.matcharr.matchLanguage}</td>91 <td>{this.state.matcharr.matchDescription}</td>92 <td>{this.state.matcharr.matchRating}</td>93 <td>{this.state.matcharr.showId}</td>94 {/* <td>95 <button className="btn btn-success" onClick={()=>this.editStadium(stadium.stadiumId)}>edit</button> </td>96 <td> <button className="btn btn-danger" onClick={()=>this.deleteStadium(stadium.stadiumId)}>delete</button></td>97 <td> <button className="btn btn-success" onClick={()=>this.addScreen(stadium.stadiumId)}>Add Screen</button>98 </td> */}99 </tr>100 }101 </tbody>102 </table>103 </div>104 </div>105 );106 }107}...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!