@@ -19,14 +19,13 @@ let apiId;
1919describe ( "Create GraphQl API from file" , ( ) => {
2020 const username = 'admin' ;
2121 const password = 'admin' ;
22+ const filmSubscriberRole = `FilmSubscriber${ Utils . generateRandomNumber ( ) } ` ;
2223 const filepath = 'api_artifacts/schema_graphql.graphql' ;
2324 const modifiedFilepath = 'api_artifacts/modified_schema_graphql.graphql' ;
2425 const apiVersion = '1.0.0' ;
25- let apiContext ;
26- let apiName ;
27- let applicationName ;
28- let applicationCreated = false ;
29- let filmSubscriberRole ;
26+ const apiContext = `/swapi${ Utils . generateRandomNumber ( ) } ` ;
27+ const apiName = `StarWarsAPIGQL${ Utils . generateRandomNumber ( ) } ` ;
28+ const applicationName = 'Graphql Client App' ;
3029 const starWarsQueryRequest = `query{
3130 human(id:1000){\n
3231 id\n
@@ -95,7 +94,6 @@ describe("Create GraphQl API from file", () => {
9594
9695 beforeEach ( function ( ) {
9796 //add role filmsubscriber
98- filmSubscriberRole = `FilmSubscriber${ Utils . generateRandomNumber ( ) } ` ;
9997 cy . carbonLogin ( username , password ) ;
10098 cy . visit ( '/carbon/role/add-step1.jsp' ) ;
10199 cy . get ( 'input[name="roleName"]' ) . type ( filmSubscriberRole ) ;
@@ -119,9 +117,6 @@ describe("Create GraphQl API from file", () => {
119117 } )
120118
121119 it ( "Verify GraphQl API Capabilities" , ( ) => {
122- apiContext = `/swapi${ Utils . generateRandomNumber ( ) } ` ;
123- apiName = `StarWarsAPIGQL${ Utils . generateRandomNumber ( ) } ` ;
124- applicationName = `Graphql Client App ${ Utils . generateRandomNumber ( ) } ` ;
125120
126121 //create a graphql API
127122 cy . createGraphqlAPIfromFile ( apiName , apiVersion , apiContext , filepath ) . then ( value => {
@@ -183,7 +178,7 @@ describe("Create GraphQl API from file", () => {
183178 . should ( 'not.have.class' , 'Mui-disabled' ) . click ( { force : true } ) ;
184179 cy . contains ( 'Revision Created Successfully' ) ;
185180 cy . contains ( 'Revision Deployed Successfully' ) ;
186- // cy.contains('div[role="button"]', 'Successfully Deployed').should('exist');
181+ cy . contains ( 'div[role="button"]' , 'Successfully Deployed' ) . should ( 'exist' ) ;
187182
188183 //publish
189184 cy . get ( "#left-menu-overview" , { timeout : Cypress . env ( 'largeTimeout' ) } ) . click ( ) ;
@@ -196,9 +191,6 @@ describe("Create GraphQl API from file", () => {
196191
197192 // create an application
198193 cy . createApplication ( applicationName , "50PerMin" , "Sample Description" ) ;
199- cy . then ( ( ) => {
200- applicationCreated = true ;
201- } ) ;
202194
203195 //go to apis
204196 cy . get ( '[data-testid="itest-link-to-apis"]' ,
@@ -285,10 +277,8 @@ expect(JSON.stringify(resp.body)).to.include(starWarsSubscriptionResponse);
285277
286278
287279 after ( function ( ) {
288- if ( applicationCreated ) {
289- cy . deleteApplication ( applicationName ) ;
290- cy . logoutFromDevportal ( ) ;
291- }
280+ cy . deleteApplication ( applicationName ) ;
281+ cy . logoutFromDevportal ( ) ;
292282 cy . loginToPublisher ( username , password ) ;
293283 cy . log ( "app id " + apiId ) ;
294284 // Test is done. Now delete the api
0 commit comments