diff --git a/e2e/features/basicFunctionality.feature b/e2e/features/basicFunctionality.feature new file mode 100644 index 0000000..3cc5148 --- /dev/null +++ b/e2e/features/basicFunctionality.feature @@ -0,0 +1,12 @@ +Feature: Access the application + +Scenario: Access the main view of the App + Given A new unregistered user + When Accessing the App + Then The carousel loads + + +Scenario: Change App Language + Given A user in the main view + When Pressing the change language button + Then Language should change diff --git a/e2e/features/groups.feature b/e2e/features/groups.feature new file mode 100644 index 0000000..4a9880f --- /dev/null +++ b/e2e/features/groups.feature @@ -0,0 +1,16 @@ +Feature: Group Management + +Scenario: Create a group + Given An already registered user at groups view + When Creating a group + Then The group is created + +Scenario: Create a group with no people + Given An already registered user at groups view + When Creating a group without adding people + Then A popup appears + +Scenario: Create a group with no name + Given An already registered user at groups view + When Creating a group without setting a name + Then A popup appears \ No newline at end of file diff --git a/e2e/features/login.feature b/e2e/features/login.feature index a43a97a..aa8afcd 100644 --- a/e2e/features/login.feature +++ b/e2e/features/login.feature @@ -1,6 +1,6 @@ -Feature: Access the application +Feature: Basic access to the application -Scenario: Edit profile info - Given An already registered user on the profile page - When I click the edit profile button - Then The edit profile page appears +Scenario: Login to an account + Given An unlogged user with account + When I click Log in + Then I should be logged in diff --git a/e2e/features/navigation.feature b/e2e/features/navigation.feature new file mode 100644 index 0000000..0978f09 --- /dev/null +++ b/e2e/features/navigation.feature @@ -0,0 +1,16 @@ +Feature: Basic access to the views of the application + +Scenario: Access the route list correctly + Given A logged in user + When Navigating to my routes + Then He is at /routes/list + +Scenario: Access the route creation correctly + Given A logged in user + When Navigating to route creation + Then He is at /routes/add + +Scenario: Access the route shared routes correctly + Given A logged in user + When Navigating to shared route + Then He is at /routes/shared diff --git a/e2e/features/routes.feature b/e2e/features/routes.feature new file mode 100644 index 0000000..52781ce --- /dev/null +++ b/e2e/features/routes.feature @@ -0,0 +1,22 @@ +Feature: Route Management + +Scenario: Create a route + Given An already registered user at route creation view + When Creating a route + Then The route is created + +Scenario: Error popup when no title + Given An already registered user at route creation view + When Creating a route with no title + Then The route is not created and a popup appears + +Scenario: Error popup when no points + Given An already registered user at route creation view + When Creating a route with no points + Then The route is not created and a popup appears + + +Scenario: Error popups with no data at all + Given An already registered user at route creation view + When Creating a route with no data + Then The route is not created and two popups appear \ No newline at end of file diff --git a/e2e/step-definitions/basicFunctionality.steps.js b/e2e/step-definitions/basicFunctionality.steps.js new file mode 100644 index 0000000..67ba31a --- /dev/null +++ b/e2e/step-definitions/basicFunctionality.steps.js @@ -0,0 +1,70 @@ +const {defineFeature, loadFeature}=require('jest-cucumber'); +const feature = loadFeature('./e2e/features/basicFunctionality.feature'); +const expect = require('expect-puppeteer'); +const puppeteer = require('puppeteer'); + +jest.setTimeout(400000); +let page = null; + +function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} +defineFeature(feature, (test) => { + + beforeEach(async () => { + await delay(10000); + //Open browser + const browser = await puppeteer.launch({ + //headless let watch the chrome window interacting with the application + headless: false, + defaultViewport: null + }); + page = await browser.newPage(); + await page.goto('http://localhost:3000'); + }); + + test('Access the main view of the App', ({ given, when, then }) => { + + + given('A new unregistered user', async () => { + // Default case, already unregistered + }); + + when('Accessing the App', async () => { + await page.waitForSelector('div[id="root"]'); // wait to load + }); + + then('The carousel loads', async () => { + await page.waitForSelector('div[id="root"]'); + await expect(page).toMatchElement('div[id="root"]'); + + await page.waitForSelector('div[id="container"]'); + await expect(page).toMatchElement('div[id="container"]'); + + await page.waitForFunction('document.querySelector("body").innerText.includes("Bienvenido")'); + }); + }); + + test('Change App Language', ({ given, when, then }) => { + + + given('A user in the main view', async () => { + await page.waitForSelector('div[id="root"]'); // wait to load + }); + + when('Pressing the change language button', async () => { + await page.waitForSelector('[id="dropdown-item-button"]'); + await page.click('[id="dropdown-item-button"]'); + + await page.waitForFunction('document.querySelector("body").innerText.includes("Inglés")'); + await page.click('button.dropdown-item'); + }); + + then('Language should change', async () => { + await page.waitForSelector('div[id="root"]'); + await page.waitForFunction('document.querySelector("body").innerText.includes("Welcome")'); + }); + }); +}); \ No newline at end of file diff --git a/e2e/step-definitions/groups.steps.js b/e2e/step-definitions/groups.steps.js new file mode 100644 index 0000000..95e911a --- /dev/null +++ b/e2e/step-definitions/groups.steps.js @@ -0,0 +1,152 @@ +const {defineFeature, loadFeature}=require('jest-cucumber'); +const feature = loadFeature('./e2e/features/groups.feature'); +const expect = require('expect-puppeteer'); +const puppeteer = require('puppeteer'); +//const a = require("../support/field"); + +jest.setTimeout(400000); +let idp = "https://uo263624.solid.community"; +let account = "uo263624"; +let page = null; + +function a(){ + //return "viadeen3atest123"; + return Buffer.from("SXo5X1NlVjRfJA==", "base64").toString('utf-8'); +} + +function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} + +defineFeature(feature, (test) => { + + beforeEach(async () => { + await delay(10000); + //Open browser + const browser = await puppeteer.launch({ + //headless let watch the chrome window interacting with the application + headless: false, + defaultViewport: null + }); + page = await browser.newPage(); + await page.goto('http://localhost:3000'); + + // Login + await page.waitForSelector('button.btn-outline-light'); + await page.click('button.btn-outline-light'); + + const [popup] = await Promise.all([ + new Promise((resolve) => {page.once('popup', resolve);}), + ]); + + await popup.waitForSelector('input[type="url"]'); + await expect(popup).toFill('input[type="url"]', idp); + await popup.click('[type="submit"]'); + + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); + await popup.waitForSelector('input[id="username"]'); + await expect(popup).toFill('input[id="username"]', account); + await expect(popup).toFill('input[id="password"]', a()); + await popup.click('[type="submit"]'); + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); + await page.waitForFunction('document.querySelector("body").innerText.includes("bienvenido")'); + }); + + test('Create a group', ({ given, when, then }) => { + + + given('An already registered user at groups view', async () => { + // logged in done + // move to correct view + await page.goto('http://localhost:3000/#/groups'); + await page.waitForFunction('document.querySelector("body").innerText.includes("pos de amig")'); + }); + + when('Creating a group', async () => { + await page.waitForSelector("[id=btnCreateGroup]"); + await page.click('a[id="btnCreateGroup"]'); + + // wait for the cards to load + await delay(1000); + await page.waitForSelector("div.card"); + await page.click('button.btn-success'); + + // Wait for correctly added popup + await page.waitForFunction('document.querySelector("body").innerText.includes("adido correct")'); + + // name and submit + await expect(page).toFill('input', "My cucumber group"); + await page.click('button[id="btnCreate"]'); + }); + + then('The group is created', async () => { + await page.waitForSelector("div.card-body"); + await page.waitForFunction('document.querySelector("div").innerText.includes("My cucumber group")'); + }); + }); + + test('Create a group with no people', ({ given, when, then }) => { + + + given('An already registered user at groups view', async () => { + // logged in done + // move to correct view + await page.goto('http://localhost:3000/#/groups'); + await page.waitForFunction('document.querySelector("body").innerText.includes("pos de amig")'); + }); + + when('Creating a group without adding people', async () => { + await page.waitForSelector("[id=btnCreateGroup]"); + await page.click('a[id="btnCreateGroup"]'); + + // wait for the cards to load + await delay(1000); + await page.waitForSelector("div.card"); + + // name and submit + await expect(page).toFill('input', "My cucumber group"); + await page.click('button[id="btnCreate"]'); + }); + + then('A popup appears', async () => { + await page.waitForFunction('document.querySelector("div").innerText.includes("menos un miembro")'); + }); + }); + + test('Create a group with no name', ({ given, when, then }) => { + + + given('An already registered user at groups view', async () => { + // logged in done + // move to correct view + await page.goto('http://localhost:3000/#/groups'); + await page.waitForFunction('document.querySelector("body").innerText.includes("pos de amig")'); + }); + + when('Creating a group without setting a name', async () => { + await page.waitForSelector("[id=btnCreateGroup]"); + await page.click('a[id="btnCreateGroup"]'); + + // wait for the cards to load + await delay(1000); + await page.waitForSelector("div.card"); + await page.click('button.btn-success'); + + // Wait for correctly added popup + await page.waitForFunction('document.querySelector("body").innerText.includes("adido correct")'); + + // submit + await page.click('button[id="btnCreate"]'); + }); + + then('A popup appears', async () => { + await page.waitForFunction('document.querySelector("div").innerText.includes("nombre no puede estar")'); + }); + }); +}); \ No newline at end of file diff --git a/e2e/step-definitions/login.steps.js b/e2e/step-definitions/login.steps.js index 149078c..8b39a80 100644 --- a/e2e/step-definitions/login.steps.js +++ b/e2e/step-definitions/login.steps.js @@ -1,30 +1,72 @@ const {defineFeature, loadFeature}=require('jest-cucumber'); const feature = loadFeature('./e2e/features/login.feature'); -//const podUtils = require('../../src/scripts/podUtils'); -const actions = require('../support/actions'); -const selectors = require('../support/selectors'); +const expect = require('expect-puppeteer'); +const puppeteer = require('puppeteer'); +//import a from "../support/field"; -defineFeature((feature, test) => { +jest.setTimeout(400000); +let idp = "https://uo263624.solid.community"; +let account = "uo263624"; +let page = null; - test('Edit profile info', ({ given, when, then }) => { - - jest.setTimeout(30000); +function a(){ + return Buffer.from("SXo5X1NlVjRfJA==", "base64").toString('utf-8'); +} - beforeEach(async () => { - await page.goto('http://localhost:3000/#/profile'); +function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} + +defineFeature(feature, (test) => { + + beforeEach(async () => { + await delay(10000); + //Open browser + const browser = await puppeteer.launch({ + //headless let watch the chrome window interacting with the application + headless: false, + defaultViewport: null }); - + page = await browser.newPage(); + await page.goto('http://localhost:3000'); + }); + + test('Login to an account', ({ given, when, then }) => { + - given('An already registered user on the profile page', () => { - + given('An unlogged user with account', async () => { + // Default case, already unregistered }); - - when('I click the edit profile button', async () => { - //await expect(page).toClick('button', { text: 'Edit profile' , setTimeout: 30000}) + + when('I click Log in', async () => { + await page.waitForSelector('button.btn-outline-light'); + await page.click('button.btn-outline-light'); + + const [popup] = await Promise.all([ + new Promise((resolve) => {page.once('popup', resolve);}), + ]); + + await popup.waitForSelector('input[type="url"]'); + await expect(popup).toFill('input[type="url"]', idp); + await popup.click('[type="submit"]'); + + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); + await popup.waitForSelector('input[id="username"]'); + await expect(popup).toFill('input[id="username"]', account); + await expect(popup).toFill('input[id="password"]', a()); + await popup.click('[type="submit"]'); + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); }); - - then('The edit profile page appears', async () => { - //await expect(page).toMatchElement('h1', { text: 'Edit profile info'}) + + then('I should be logged in', async () => { + await page.waitForFunction('document.querySelector("body").innerText.includes("bienvenido")'); + await page.waitForFunction('document.querySelector("body").innerText.includes("Cerrar sesión")'); }); }); }); \ No newline at end of file diff --git a/e2e/step-definitions/navigation.js b/e2e/step-definitions/navigation.js new file mode 100644 index 0000000..fd6565d --- /dev/null +++ b/e2e/step-definitions/navigation.js @@ -0,0 +1,136 @@ +const {defineFeature, loadFeature}=require('jest-cucumber'); +const feature = loadFeature('./e2e/features/navigation.feature'); +const expect = require('expect-puppeteer'); +const puppeteer = require('puppeteer'); +//const a = require("../support/field"); + +jest.setTimeout(400000); +let idp = "https://uo263624.solid.community"; +let account = "uo263624"; +let page = null + +function a(){ + return Buffer.from("SXo5X1NlVjRfJA==", "base64").toString('utf-8'); +} + +function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} + +defineFeature(feature, (test) => { + + beforeEach(async () => { + delay(10000); + //Open browser + const browser = await puppeteer.launch({ + //headless let watch the chrome window interacting with the application + headless: false, + defaultViewport: null + }); + page = await browser.newPage(); + await page.goto('http://localhost:3000'); + + // Login + await page.waitForSelector('button.btn-outline-light'); + await page.click('button.btn-outline-light'); + + const [popup] = await Promise.all([ + new Promise((resolve) => {page.once('popup', resolve);}), + ]); + + await popup.waitForSelector('input[type="url"]'); + await expect(popup).toFill('input[type="url"]', idp); + await popup.click('[type="submit"]'); + + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); + await popup.waitForSelector('input[id="username"]'); + await expect(popup).toFill('input[id="username"]', account); + await expect(popup).toFill('input[id="password"]', a()); + await popup.click('[type="submit"]'); + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); + await page.waitForFunction('document.querySelector("body").innerText.includes("bienvenido")'); + }); + + test('Access the route list correctly', ({ given, when, then }) => { + + + given('A logged in user', async () => { + // done + }); + + when('Navigating to my routes', async () => { + await page.evaluate(() => { + let btns = [...document.querySelectorAll("a")]; + btns.forEach(async function (btn) { + if (btn.firstChild.innerText === "Gestión de rutas"){ + btn.click(); + } + }); + }); + //await page.waitForSelector("button.nav-link"); + //await page.click("button.nav-link"); + await page.waitForSelector("[id=routeListNavButton]"); + await page.click("[id=routeListNavButton]"); + }); + + then('He is at /routes/list', async () => { + expect(page.url()).toBe("http://localhost:3000/#/routes/list"); + }); + }); + + test('Access the route creation correctly', ({ given, when, then }) => { + + + given('A logged in user', async () => { + + }); + + when('Navigating to route creation', async () => { + await page.evaluate(() => { + let btns = [...document.querySelectorAll("a")]; + btns.forEach(async function (btn) { + if (btn.firstChild.innerText === "Gestión de rutas"){ + btn.click(); + } + }); + }); + await page.waitForSelector("[id=routeAddNavButton]"); + await page.click("[id=routeAddNavButton]"); + }); + + then('He is at /routes/add', async () => { + expect(page.url()).toBe("http://localhost:3000/#/routes/add"); + }); + }); + + test('Access the route shared routes correctly', ({ given, when, then }) => { + + + given('A logged in user', async () => { + + }); + + when('Navigating to shared route', async () => { + await page.evaluate(() => { + let btns = [...document.querySelectorAll("a")]; + btns.forEach(async function (btn) { + if (btn.firstChild.innerText === "Gestión de rutas"){ + btn.click(); + } + }); + }); + await page.waitForSelector("[id=routeSharedNavButton]"); + await page.click("[id=routeSharedNavButton]"); + }); + + then('He is at /routes/shared', async () => { + expect(page.url()).toBe("http://localhost:3000/#/routes/shared"); + }); + }); +}); \ No newline at end of file diff --git a/e2e/step-definitions/routes.steps.js b/e2e/step-definitions/routes.steps.js new file mode 100644 index 0000000..c42e77e --- /dev/null +++ b/e2e/step-definitions/routes.steps.js @@ -0,0 +1,206 @@ +const {defineFeature, loadFeature}=require('jest-cucumber'); +const feature = loadFeature('./e2e/features/routes.feature'); +const expect = require('expect-puppeteer'); +const puppeteer = require('puppeteer'); +//const a = require("../support/field"); + +jest.setTimeout(400000); +let idp = "https://uo263624.solid.community"; +let account = "uo263624"; +let page = null; + +function a(){ + //return "viadeen3atest123"; + return Buffer.from("SXo5X1NlVjRfJA==", "base64").toString('utf-8'); +} + +function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} + +defineFeature(feature, (test) => { + + beforeEach(async () => { + await delay(10000); + //Open browser + const browser = await puppeteer.launch({ + //headless let watch the chrome window interacting with the application + headless: false, + defaultViewport: null + }); + page = await browser.newPage(); + await page.goto('http://localhost:3000'); + + // Login + await page.waitForSelector('button.btn-outline-light'); + await page.click('button.btn-outline-light'); + + const [popup] = await Promise.all([ + new Promise((resolve) => {page.once('popup', resolve);}), + ]); + + await popup.waitForSelector('input[type="url"]'); + await expect(popup).toFill('input[type="url"]', idp); + await popup.click('[type="submit"]'); + + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); + await popup.waitForSelector('input[id="username"]'); + await expect(popup).toFill('input[id="username"]', account); + await expect(popup).toFill('input[id="password"]', a()); + await popup.click('[type="submit"]'); + await popup.waitForNavigation({ + waitUntil: 'networkidle2' + }); + await page.waitForFunction('document.querySelector("body").innerText.includes("bienvenido")'); + }); + + test('Create a route', ({ given, when, then }) => { + + + given('An already registered user at route creation view', async () => { + // logged in done + // move to correct view + await page.goto('http://localhost:3000/#/routes/add'); + await page.waitForSelector("[id=routeNameInput]"); + }); + + when('Creating a route', async () => { + await page.waitForSelector("[id=routeNameInput]"); + await expect(page).toFill('[id="routeNameInput"]', "Cucumber test Route"); + await expect(page).toFill('textarea', "Description of the route Route"); + await delay(300); + + // Point 1 + await page.mouse.move(100, 650); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + // Point 2 + await page.mouse.move(100, 700); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + // Point 3 + await page.mouse.move(200, 700); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + //Point 4 + await page.mouse.move(200, 650); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + /* Depending on resolution, and scrren, at least some of the points will render */ + + await page.click('button[id="btnSave"]'); + }); + + then('The route is created', async () => { + await page.waitForFunction('document.querySelector("body").innerText.includes("Lista de ")'); + await page.waitForFunction('document.querySelector("div").innerText.includes("Cucumber")'); + }); + }); + + test('Error popup when no title', ({ given, when, then }) => { + + + given('An already registered user at route creation view', async () => { + // logged in done + // move to correct view + await page.goto('http://localhost:3000/#/routes/add'); + await page.waitForSelector("[id=routeNameInput]"); + }); + + when('Creating a route with no title', async () => { + await page.waitForSelector("textarea"); + await expect(page).toFill('textarea', "Description of the route Route"); + await delay(300); + + // Point 1 + await page.mouse.move(100, 650); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + // Point 2 + await page.mouse.move(100, 700); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + // Point 3 + await page.mouse.move(200, 700); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + //Point 4 + await page.mouse.move(200, 650); + await page.mouse.down({ button: 'left' }); + await page.mouse.up({ button: 'left' }); + await delay(300); + + /* Depending on resolution, and scrren, at least some of the points will render */ + + await page.click('button[id="btnSave"]'); + }); + + then('The route is not created and a popup appears', async () => { + await page.waitForSelector("textarea"); + await page.waitForFunction('document.querySelector("div").innerText.includes("no puede estar vac")'); + }); + }); + + test('Error popup when no points', ({ given, when, then }) => { + + + given('An already registered user at route creation view', async () => { + // logged in done + // move to correct view + await page.goto('http://localhost:3000/#/routes/add'); + await page.waitForSelector("[id=routeNameInput]"); + }); + + when('Creating a route with no points', async () => { + await page.waitForSelector("[id=routeNameInput]"); + await expect(page).toFill('[id="routeNameInput"]', "Cucumber test Route"); + await expect(page).toFill('textarea', "Description of the route Route"); + await page.click('button[id="btnSave"]'); + }); + + then('The route is not created and a popup appears', async () => { + await page.waitForSelector("textarea"); + await page.waitForFunction('document.querySelector("body").innerText.includes("contener al menos dos")'); + }); + }); + + test('Error popups with no data at all', ({ given, when, then }) => { + + + given('An already registered user at route creation view', async () => { + // logged in done + // move to correct view + await page.goto('http://localhost:3000/#/routes/add'); + await page.waitForSelector("[id=routeNameInput]"); + }); + + when('Creating a route with no data', async () => { + await page.waitForSelector("[id=routeNameInput]"); + await page.click('button[id="btnSave"]'); + }); + + then('The route is not created and two popups appear', async () => { + await page.waitForSelector("textarea"); + await page.waitForFunction('document.querySelector("div").innerText.includes("no puede estar vac")'); + await page.waitForFunction('document.querySelector("body").innerText.includes("contener al menos dos")'); + }); + }); +}); \ No newline at end of file diff --git a/e2e/support/actions.js b/e2e/support/actions.js deleted file mode 100644 index 4060a3d..0000000 --- a/e2e/support/actions.js +++ /dev/null @@ -1,57 +0,0 @@ -// Dependencies -const pages = require('./pages'); -const selectors = require('./selectors'); -const scope = require('./scope'); - -// Defines whether puppeteer runs Chrome in headless mode. -let headless = true; -let slowMo = 0; -// Chrome is set to run headlessly and with no slowdown in CircleCI -if (process.env.CIRCLECI) {headless = true;} -if (process.env.CIRCLECI) {slowMo = 0;} - -const pending = (callback) => { - callback(null, 'pending'); -}; - -const visitHomepage = async () => { - if (!scope.browser) { - scope.browser = await scope.driver.launch({ headless, slowMo }); - } - scope.context.currentPage = await scope.browser.newPage(); - scope.context.currentPage.setViewport({ width: 1280, height: 1024 }); - const url = scope.host + pages.home; - const visit = await scope.context.currentPage.goto(url, { - waitUntil: 'networkidle2' - }); - return visit; -}; - -const clickOnItem = async (link) => { - const { currentPage } = scope.context; - return await currentPage.click(selectors.links[link]); -}; - -const takenToPage = async (pageName) => { - const url = scope.host + pages[pageName]; - const urlMatched = scope.context.currentPage.waitForFunction( - `window.location.href === '${url}'`, - { mutation: true } - ); - await urlMatched; -}; - -const pressButton = async (button) => { - const { currentPage } = scope.context; - return await currentPage.click(selectors.buttons[button]); -}; - - -module.exports = { - pending, - headless, - visitHomepage, - clickOnItem, - takenToPage, - pressButton -}; diff --git a/e2e/support/pages.js b/e2e/support/pages.js deleted file mode 100644 index f9fffbb..0000000 --- a/e2e/support/pages.js +++ /dev/null @@ -1,11 +0,0 @@ -const pages = { - home: '#/home', - profile: '#/profile', - friends: '#/friends', - routesList: '#/routes/list', - routesAdd: '#/routes/add', - routesExample: '#/routes/example', - editProfile: '#/editProfile' -}; - -module.exports = pages; diff --git a/e2e/support/scope.js b/e2e/support/scope.js deleted file mode 100644 index f053ebf..0000000 --- a/e2e/support/scope.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/e2e/support/selectors.js b/e2e/support/selectors.js deleted file mode 100644 index 9c39616..0000000 --- a/e2e/support/selectors.js +++ /dev/null @@ -1,13 +0,0 @@ -// These are ways of being able to identify HTML elements to interact with and check. -const selectors = { - links: { - Github: 'a[href="https://github.com/Arquisoft/viade_en3a"]' - }, - buttons: { - EditProfile: 'button', - SignIn: 'button', - SignUp: 'button' - } -}; - -module.exports = selectors; diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index 57a7bbc..febd52b 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -2,7 +2,7 @@ module.exports = { server: { command: `npm start`, port: 3000, - launchTimeout: 10000, + launchTimeout: 100000, debug: true }, }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f8745b3..7331aec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8912,6 +8912,11 @@ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" + }, "immer": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/immer/-/immer-1.10.0.tgz", @@ -10989,6 +10994,51 @@ "object.assign": "^4.1.0" } }, + "jszip": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.4.0.tgz", + "integrity": "sha512-gZAOYuPl4EhPTXT0GjhI3o+ZAz3su6EhLrKUoAivcKqyqC7laS5JEv4XWZND9BgcDcF83vI85yGbDmDR6UhrIg==", + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "set-immediate-shim": "~1.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -11088,6 +11138,14 @@ "type-check": "~0.3.2" } }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "requires": { + "immediate": "~3.0.5" + } + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -15535,6 +15593,34 @@ "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=" }, + "selenium-webdriver": { + "version": "4.0.0-alpha.7", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-alpha.7.tgz", + "integrity": "sha512-D4qnTsyTr91jT8f7MfN+OwY0IlU5+5FmlO5xlgRUV6hDEV8JyYx2NerdTEqDDkNq7RZDYc4VoPALk8l578RBHw==", + "requires": { + "jszip": "^3.2.2", + "rimraf": "^2.7.1", + "tmp": "0.0.30" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + }, + "tmp": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz", + "integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=", + "requires": { + "os-tmpdir": "~1.0.1" + } + } + } + }, "selfsigned": { "version": "1.10.7", "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", @@ -15690,6 +15776,11 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, "set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", @@ -19603,24 +19694,6 @@ "dev": true, "requires": { "@babel/runtime-corejs3": "^7.8.3" - }, - "dependencies": { - "@babel/runtime-corejs3": { - "version": "7.9.2", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.9.2.tgz", - "integrity": "sha512-HHxmgxbIzOfFlZ+tdeRKtaxWOMUoCG5Mu3wKeUmOxjYrwb3AAHgnmtCUbPPK11/raIWLIBK250t8E2BPO0p7jA==", - "dev": true, - "requires": { - "core-js-pure": "^3.0.0", - "regenerator-runtime": "^0.13.4" - } - }, - "regenerator-runtime": { - "version": "0.13.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", - "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", - "dev": true - } } }, "xtend": { diff --git a/package.json b/package.json index 6d0fe69..b410d4b 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "react-router-dom": "^5.1.2", "react-scripts": "^3.4.0", "react-toastify": "^5.5.0", + "selenium-webdriver": "^4.0.0-alpha.7", "shx": "0.3.2", "solid-acl-utils": "github:otto-aa/solid-acl-utils", "solid-auth-client": "^2.4.1", @@ -49,6 +50,7 @@ "build": "react-scripts build", "test": "react-scripts test --coverage", "test:e2e": "jest -c e2e/jest.config.js", + "jest": "jest -c e2e/jest.config.js", "docs": "shx rm -rf build/docs && asciidoctor -D build/docs -a imagesdir=./images -r asciidoctor-diagram src/docs/index.adoc && shx cp -R src/docs/images build/docs", "eject": "react-scripts eject" }, diff --git a/src/components/navBar/navBar.js b/src/components/navBar/navBar.js index 8d59232..7efac35 100644 --- a/src/components/navBar/navBar.js +++ b/src/components/navBar/navBar.js @@ -57,14 +57,14 @@ function MyNavBar(props) {