diff --git a/cypress/e2e/file-browser.cy.js b/cypress/e2e/file-browser.cy.js index 80e800d..7cec08f 100644 --- a/cypress/e2e/file-browser.cy.js +++ b/cypress/e2e/file-browser.cy.js @@ -3,6 +3,7 @@ import content from "../fixtures/content:get.json"; import ghConfig from "../fixtures/gh-config.json"; import files from "../fixtures/files:get.json"; import { GITHUB_HOST_REGEX } from "../enums"; +import { checkTour } from "../helper"; const dummySession = { url: "https://api.github.com/repos/", @@ -66,9 +67,16 @@ describe("File browser related tests", () => { ).as("getFiles"); }); + // Test to check if the tour is rendered and close the tour + it("Tour check and click next button", () => { + cy.visit("/123"); + cy.wait("@getFiles"); + cy.wait(1000); + checkTour(); + }); + // Test to check if the files list is rendered correctly it("Render files list", () => { - cy.visit("/123"); cy.get(".navbar .v-btn.session-file-btn").click(); cy.get(".files-browse-list", { timeout: 12000 }).should( "have.length", @@ -98,6 +106,7 @@ describe("File browser related tests", () => { // Test to check if the existing file is edited correctly it("Edit existing file", () => { editSession = true; + checkTour(); cy.get(".navbar .v-btn.session-file-btn").click(); cy.get(".files-browse-list").eq(6).click(); cy.get(".current-session-btn").click(); diff --git a/cypress/e2e/file.cy.js b/cypress/e2e/file.cy.js index 14e37b3..c669b27 100644 --- a/cypress/e2e/file.cy.js +++ b/cypress/e2e/file.cy.js @@ -2,6 +2,7 @@ import ghConfig from "../fixtures/gh-config.json"; import { GITHUB_HOST, GITHUB_HOST_REGEX } from "../enums"; import content from "../fixtures/content:get.json"; +import { checkTour } from "../helper"; describe("File related tests", () => { // Track content change states @@ -38,8 +39,8 @@ describe("File related tests", () => { ).as("getContent"); }); - // Test resizing/hiding/showing the preview - it("Resize Preview", () => { + // Test to check if the tour is rendered and close the tour + it("Tour check and click next button", () => { // Visit a file with a preview cy.wait(1000); cy.visit( @@ -50,6 +51,12 @@ describe("File related tests", () => { cy.wait("@pullsUpdate"); cy.wait("@getContent"); + cy.wait(1000); + checkTour(); + }); + + // Test resizing/hiding/showing the preview + it("Resize Preview", () => { // Check if the file is loaded cy.get("eox-jsonform").should("exist"); @@ -154,6 +161,7 @@ describe("File related tests", () => { // Test renaming a file it("Rename file", () => { + checkTour(); // Rename the file isRenameFile = true; cy.get("#rename-file-btn").click(); diff --git a/cypress/e2e/files-list.cy.js b/cypress/e2e/files-list.cy.js index 4cbcd95..145c8cb 100644 --- a/cypress/e2e/files-list.cy.js +++ b/cypress/e2e/files-list.cy.js @@ -4,6 +4,7 @@ import ghConfig from "../fixtures/gh-config.json"; import files from "../fixtures/files:get.json"; import content from "../fixtures/content:get.json"; import pullsData from "../fixtures/pulls:get.json"; +import { checkTour } from "../helper"; // State flags to control test behavior let sessionName = false; @@ -131,10 +132,16 @@ describe("Files list related tests", () => { }); }); - // Test that files list renders correctly - it("Render files list", () => { + // Test to check if the tour is rendered and close the tour + it("Tour check and click next button", () => { cy.visit("/123"); cy.wait("@getFiles"); + cy.wait(1000); + checkTour(); + }); + + // Test that files list renders correctly + it("Render files list", () => { cy.get(".files-list", { timeout: 12000 }).should( "have.length", files.length, @@ -305,7 +312,7 @@ describe("Files list related tests", () => { it("Check preview link exists", () => { cy.window().then((win) => { expect(win.gitClerkConfig).to.exist; - cy.get("#deployed-preview-btn").should(($btn) => { + cy.get("#deployed-preview-btn a").should(($btn) => { if (win.gitClerkConfig.deployedPreviewLink) expect($btn.attr("href")).to.equal( win.gitClerkConfig.deployedPreviewLink(pullsData), diff --git a/cypress/e2e/sessions.cy.js b/cypress/e2e/sessions.cy.js index f81ec25..c9d1c39 100644 --- a/cypress/e2e/sessions.cy.js +++ b/cypress/e2e/sessions.cy.js @@ -6,6 +6,7 @@ import { GITHUB_HOST } from "../enums"; import sessionsList from "../fixtures/sessions-list:graphql.json"; import openCount from "../fixtures/open-count:graphql.json"; import closeCount from "../fixtures/closed-count:graphql.json"; +import { checkTour } from "../helper"; const mockQuery = { issueCount: ` @@ -157,6 +158,12 @@ describe("Session list related tests", () => { ); }); + // Test to check if the tour is rendered and close the tour + it("Tour check and click next button", () => { + cy.wait(1000); + checkTour(); + }); + // Test that session titles match expected values it("Validate sessions list items with title name", () => { cy.get(".session-title").each((titleElement, index) => { diff --git a/cypress/helper.js b/cypress/helper.js new file mode 100644 index 0000000..0cd908c --- /dev/null +++ b/cypress/helper.js @@ -0,0 +1,9 @@ +export function checkTour() { + cy.get("body").then(($body) => { + if ($body.find(".driver-popover", { timeout: 120000 }).length > 0) { + cy.get(".driver-popover-close-btn").click(); + } else { + cy.log("Tour not found"); + } + }); +} diff --git a/src/App.vue b/src/App.vue index 86be66b..74ba3d0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,6 +5,8 @@ import { onMounted, provide, ref } from "vue"; import useOctokitStore from "@/stores/octokit.js"; import { initOctokit } from "@/api/index.js"; import { useLoader } from "@/helpers/index.js"; +import "../../EOxElements/elements/tour/src/main.js"; +import "../../EOxElements/elements/tour/dist/eox-tour.css"; const navButtonConfig = ref({}); const navPaginationItems = ref([ @@ -17,9 +19,11 @@ const navPaginationItems = ref([ const fileBrowserDrawer = ref(false); const snackbar = ref(false); const isOctokitInitialised = ref(false); +const tourConfig = ref(null); provide("set-nav-button-config", navButtonConfig); provide("set-nav-pagination-items", navPaginationItems); provide("set-snackbar", snackbar); +provide("set-tour-config", tourConfig); provide("set-file-browser-drawer", fileBrowserDrawer); onMounted(async () => { @@ -48,5 +52,6 @@ onMounted(async () => { > + diff --git a/src/assets/main.css b/src/assets/main.css index c7b950b..1f61654 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -88,3 +88,43 @@ html { font-size: 1rem; font-weight: 700; } + +.driver-popover .driver-popover-close-btn { + right: 8px; + top: 6px; + display: flex; + color: rgb(var(--eox-theme-light-primary)); +} + +.driver-popover footer > .driver-popover-progress-text { + font-size: 12px; + font-weight: 600; + opacity: 0.5; +} + +.driver-popover .driver-popover-arrow { + display: none; +} + +.driver-popover .driver-popover-next-btn, +.driver-popover .driver-popover-prev-btn { + background-color: rgb(var(--eox-theme-light-primary)); + color: white; + font-size: 12px; + padding: 5px 10px; + border-radius: 100px; + display: flex; + align-items: center; + justify-content: center; + gap: 5px; +} + +.driver-popover .driver-popover-btn-disabled { + opacity: 0.5; + pointer-events: none; +} + +.driver-popover .driver-popover-footer nav { + width: 100%; + justify-content: end; +} diff --git a/src/components/file/ActionTabFileEditor.vue b/src/components/file/ActionTabFileEditor.vue index 2a8dc08..fd89818 100644 --- a/src/components/file/ActionTabFileEditor.vue +++ b/src/components/file/ActionTabFileEditor.vue @@ -33,15 +33,17 @@ const props = defineProps({