|
| 1 | +/// <reference types="cypress" /> |
| 2 | + |
| 3 | +// const sizes = ["macbook-11", "macbook-13", "macbook-15", "macbook-16"]; |
| 4 | +const sizes = ["macbook-16"]; |
| 5 | +const exercises2 = [ |
| 6 | + { id: "follow_line", webGui: true }, |
| 7 | + { id: "vacuum_cleaner", webGui: true }, |
| 8 | + { id: "autoparking", webGui: true }, |
| 9 | + { id: "follow_person", webGui: true }, |
| 10 | + { id: "vacuum_cleaner_loc", webGui: true }, |
| 11 | + { id: "global_navigation", webGui: true }, |
| 12 | + { id: "rescue_people", webGui: true }, |
| 13 | + { id: "obstacle_avoidance", webGui: true }, |
| 14 | + { id: "3d_reconstruction", webGui: true }, |
| 15 | + { id: "amazon_warehouse", webGui: true }, |
| 16 | + { id: "montecarlo_laser_loc", webGui: true }, |
| 17 | + { id: "montecarlo_visual_loc", webGui: true }, |
| 18 | + { id: "marker_visual_loc", webGui: true }, |
| 19 | + { id: "laser_mapping", webGui: true }, |
| 20 | + { id: "basic_computer_vision", webGui: true }, |
| 21 | + { id: "follow_road", webGui: true }, |
| 22 | + { id: "pick_place", webGui: false }, |
| 23 | + { id: "image_classification", webGui: true }, |
| 24 | + { id: "object_detection", webGui: true }, |
| 25 | + { id: "drone_gymkhana", webGui: true }, |
| 26 | + { id: "power_tower_inspection", webGui: true }, |
| 27 | + { id: "end_to_end_visual_control", webGui: true }, |
| 28 | + { id: "digital_image_processing", webGui: true }, |
| 29 | + { id: "car_junction", webGui: true }, |
| 30 | + { id: "machine_vision", webGui: false }, |
| 31 | + { id: "labyrinth_escape", webGui: true }, |
| 32 | +]; |
| 33 | +const exercises = [{ id: "follow_line", webGui: true }]; |
| 34 | + |
| 35 | +context("Exercises", () => { |
| 36 | + beforeEach(() => { |
| 37 | + cy.visit("http://127.0.0.1:7164/academy/"); |
| 38 | + // Cypress.on("uncaught:exception", (err, runnable) => { |
| 39 | + // // returning false here prevents Cypress from |
| 40 | + // // failing the test |
| 41 | + // return false; |
| 42 | + // }); |
| 43 | + }); |
| 44 | + |
| 45 | + afterEach(() => { |
| 46 | + cy.get("#return-academy").click(); |
| 47 | + }); |
| 48 | + |
| 49 | + sizes.forEach((size) => { |
| 50 | + exercises.forEach((exercise) => { |
| 51 | + it(`Exercise: ${exercise.id}`, () => { |
| 52 | + cy.viewport(size); |
| 53 | + cy.get(`#${exercise.id}`).click(); |
| 54 | + cy.contains("academy.py", { timeout: 1000 }); |
| 55 | + if (exercise.webGui) { |
| 56 | + cy.get(`#webgui-container`, { timeout: 1000 }); |
| 57 | + } |
| 58 | + |
| 59 | + // Test docs |
| 60 | + cy.window().then((win) => { |
| 61 | + cy.stub(win, "open").as("windowOpen"); |
| 62 | + }); |
| 63 | + cy.get("#theory-button").click(); |
| 64 | + cy.get("@windowOpen").should("have.been.called"); |
| 65 | + |
| 66 | + cy.get("@windowOpen") |
| 67 | + .its("lastCall.args.0") |
| 68 | + .then((newWindowUrl) => { |
| 69 | + expect(newWindowUrl.href).to.equal( |
| 70 | + "https://jderobot.github.io/RoboticsAcademy/exercises/AutonomousCars/follow_line/" |
| 71 | + ); |
| 72 | + }); |
| 73 | + |
| 74 | + cy.get("#info-button").click(); |
| 75 | + cy.get("@windowOpen").should("have.been.called"); |
| 76 | + |
| 77 | + cy.get("@windowOpen") |
| 78 | + .its("lastCall.args.0") |
| 79 | + .then((newWindowUrl) => { |
| 80 | + expect(newWindowUrl.href).to.equal( |
| 81 | + "https://jderobot.github.io/RoboticsAcademy/user_guide/" |
| 82 | + ); |
| 83 | + }); |
| 84 | + |
| 85 | + cy.get("#forum-button").click(); |
| 86 | + cy.get("@windowOpen").should("have.been.called"); |
| 87 | + |
| 88 | + cy.get("@windowOpen") |
| 89 | + .its("lastCall.args.0") |
| 90 | + .then((newWindowUrl) => { |
| 91 | + expect(newWindowUrl.href).to.equal( |
| 92 | + "https://github.com/JdeRobot/RoboticsAcademy/discussions" |
| 93 | + ); |
| 94 | + }); |
| 95 | + |
| 96 | + // cy.get("#connect-with-rb").click(); |
| 97 | + // cy.get("#robotics-backend-state", { timeout: 2000 }).contains( |
| 98 | + // "tools_ready", |
| 99 | + // { timeout: 10000 } |
| 100 | + // ); |
| 101 | + }); |
| 102 | + }); |
| 103 | + }); |
| 104 | +}); |
0 commit comments