This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should trigger a confirmation with a message', () => { | |
cy.get('#confirm-button').click(); | |
cy.on('window:confirm', (text) => { | |
expect(text).to.contains('Would you like to confirm?'); | |
}); | |
cy.get('#confirm-answer').contains('Answer: Yes'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should trigger an alert with a message', () => { | |
cy.get('#alert-button').click(); | |
cy.on('window:alert', (text) => { | |
expect(text).to.contains('This is an alert!'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void addUser_checkReturnedData_shouldCorrespondToDataSent() { | |
GraphQLQuery query = new GraphQLQuery(); | |
query.setQuery("mutation insert_users ($id: uuid!, $name: String!, $rocket: String!) { insert_users(objects: {id: $id, name: $name, rocket: $rocket}) { returning { id name rocket } } }"); | |
User myUser = new User( | |
UUID.randomUUID(), | |
"Bas", | |
"My awesome rocket" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Data | |
public class User { | |
private UUID id; | |
private String name; | |
private String rocket; | |
public User(UUID id, String name, String rocket) { | |
this.id = id; | |
this.name = name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation insert_users($id: uuid!, $name: String!, $rocket: String!) { | |
insert_users(objects: {id: $id, name: $name, rocket: $rocket}) { | |
returning { | |
id | |
name | |
rocket | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void getLaunches_checkMissionName_shouldBeThaicom6_usingJSONObject() { | |
GraphQLQuery query = new GraphQLQuery(); | |
query.setQuery("query getLaunches($limit: Int!){ launches(limit: $limit) { mission_name } }"); | |
JSONObject variables = new JSONObject(); | |
variables.put("limit", 10); | |
query.setVariables(variables.toString()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void getLaunches_checkMissionName_shouldBeThaicom6_usingPOJO() { | |
GraphQLQuery query = new GraphQLQuery(); | |
query.setQuery("query getLaunches($limit: Int!){ launches(limit: $limit) { mission_name } }"); | |
QueryLimit queryLimit = new QueryLimit(); | |
queryLimit.setLimit(10); | |
query.setVariables(queryLimit); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Data | |
public class QueryLimit { | |
private int limit; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"limit": 10 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query getLaunches($limit: Int!){ | |
launches(limit: $limit) { | |
mission_name | |
} | |
} |