From 1b4a5dc31b8c38d5d5636c8a19d1c1b1f39c62a6 Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Sat, 14 Dec 2019 15:52:57 +0100 Subject: [PATCH] feat: update @verdaccio/ui-theme@0.3.9 (#1623) * feat: update @verdaccio/ui-theme - new login screen * test: update e2e we need to keep in sync with ui repo, but this will be removed soon * chore: restore yarn lock * chore: update lock file --- package.json | 2 +- test/e2e/e2e.spec.js | 57 +++++++++++++++++++++++++------------------ yarn.lock | Bin 373058 -> 373058 bytes 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 25d1dda1d..0e3c1e90f 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@verdaccio/local-storage": "8.4.2", "@verdaccio/readme": "8.4.2", "@verdaccio/streams": "8.2.0", - "@verdaccio/ui-theme": "0.3.2", + "@verdaccio/ui-theme": "0.3.9", "JSONStream": "1.3.5", "async": "3.1.0", "body-parser": "1.19.0", diff --git a/test/e2e/e2e.spec.js b/test/e2e/e2e.spec.js index a52cc1a83..4b5382f5e 100644 --- a/test/e2e/e2e.spec.js +++ b/test/e2e/e2e.spec.js @@ -1,14 +1,11 @@ -/** - * @prettier - */ - +export const HELP_TITLE = 'No Package Published Yet.'; const scopedPackageMetadata = require('./partials/pkg-scoped'); const protectedPackageMetadata = require('./partials/pkg-protected'); describe('/ (Verdaccio Page)', () => { let page; // this might be increased based on the delays included in all test - jest.setTimeout(200000); + jest.setTimeout(20000); const clickElement = async function(selector, options = { button: 'middle', delay: 100 }) { const button = await page.$(selector); @@ -16,29 +13,32 @@ describe('/ (Verdaccio Page)', () => { await button.click(options); }; - const evaluateSignIn = async function() { - const text = await page.evaluate(() => document.querySelector('#header--button-login').textContent); - expect(text).toMatch('Login'); + const evaluateSignIn = async function(matchText = 'Login') { + const text = await page.evaluate(() => { + return document.querySelector('button[data-testid="header--button-login"]').textContent; + }); + + expect(text).toMatch(matchText); }; const getPackages = async function() { - return await page.$$('.package-list-items .package-link a'); + return await page.$$('.package-title'); }; const logIn = async function() { - await clickElement('#header--button-login'); + await clickElement('button[data-testid="header--button-login"]'); await page.waitFor(500); // we fill the sign in form - const signInDialog = await page.$('#login--form-container'); - const userInput = await signInDialog.$('#login--form-username'); + const signInDialog = await page.$('#login--dialog'); + const userInput = await signInDialog.$('#login--dialog-username'); expect(userInput).not.toBeNull(); - const passInput = await signInDialog.$('#login--form-password'); + const passInput = await signInDialog.$('#login--dialog-password'); expect(passInput).not.toBeNull(); await userInput.type('test', { delay: 100 }); await passInput.type('test', { delay: 100 }); await passInput.dispose(); // click on log in - const loginButton = await page.$('#login--form-submit'); + const loginButton = await page.$('#login--dialog-button-submit'); expect(loginButton).toBeDefined(); await loginButton.focus(); await loginButton.click({ delay: 100 }); @@ -55,40 +55,43 @@ describe('/ (Verdaccio Page)', () => { await page.close(); }); - test('should load without error', async () => { - const text = await page.evaluate(() => document.body.textContent); + test('should display title', async () => { + const text = await page.title(); + await page.waitFor(1000); - // FIXME: perhaps it is not the best approach - expect(text).toContain('Powered by'); + expect(text).toContain('verdaccio-server-e2e'); }); test('should match title with no packages published', async () => { const text = await page.evaluate(() => document.querySelector('#help-card__title').textContent); - expect(text).toMatch('No Package Published Yet'); + expect(text).toMatch(HELP_TITLE); }); + // test('should match title with first step', async () => { const text = await page.evaluate(() => document.querySelector('#help-card').textContent); expect(text).toContain('npm adduser --registry http://0.0.0.0:55558'); }); + // test('should match title with second step', async () => { const text = await page.evaluate(() => document.querySelector('#help-card').textContent); expect(text).toContain('npm publish --registry http://0.0.0.0:55558'); }); - + // test('should match button Login to sign in', async () => { await evaluateSignIn(); }); + // test('should click on sign in button', async () => { - const signInButton = await page.$('#header--button-login'); + const signInButton = await page.$('button[data-testid="header--button-login"]'); await signInButton.click(); await page.waitFor(1000); - const signInDialog = await page.$('#login--form-container'); - + const signInDialog = await page.$('#login--dialog'); expect(signInDialog).not.toBeNull(); }); + // test('should log in an user', async () => { // we open the dialog @@ -97,6 +100,7 @@ describe('/ (Verdaccio Page)', () => { const buttonLogout = await page.$('#header--button-logout'); expect(buttonLogout).toBeDefined(); }); + // test('should logout an user', async () => { // we assume the user is logged already @@ -106,6 +110,7 @@ describe('/ (Verdaccio Page)', () => { await page.waitFor(1000); await evaluateSignIn(); }); + // test('should check registry info dialog', async () => { const registryInfoButton = await page.$('#header--button-registryInfo'); @@ -118,6 +123,7 @@ describe('/ (Verdaccio Page)', () => { const closeButton = await page.$('#registryInfo--dialog-close'); closeButton.click(); }); + // test('should publish a package', async () => { await global.__SERVER__.putPackage(scopedPackageMetadata.name, scopedPackageMetadata); @@ -127,13 +133,16 @@ describe('/ (Verdaccio Page)', () => { const packagesList = await getPackages(); expect(packagesList).toHaveLength(1); }); + // test('should navigate to the package detail', async () => { const packagesList = await getPackages(); + // console.log("-->packagesList:", packagesList); const firstPackage = packagesList[0]; await firstPackage.click({ clickCount: 1, delay: 200 }); await page.waitFor(1000); const readmeText = await page.evaluate(() => document.querySelector('.markdown-body').textContent); + expect(readmeText).toMatch('test'); }); @@ -141,7 +150,7 @@ describe('/ (Verdaccio Page)', () => { const versionList = await page.$$('.sidebar-info .detail-info'); expect(versionList).toHaveLength(1); }); - + // test('should display dependencies tab', async () => { const dependenciesTab = await page.$$('#dependencies-tab'); expect(dependenciesTab).toHaveLength(1); diff --git a/yarn.lock b/yarn.lock index 40eae9784b96f40f45865e78c6696a39a7848459..adfd65069068e53c5ce4cf5e41d9fd2506b6cf1f 100644 GIT binary patch delta 199 zcmX@~NbJxfv4$;-J$@pVN>*G73T3H9#hLke3Q7ig#(I{M3uW}CpYvl>(Y4eoNv~2i zOG`6IGcYwaG_^D|N-{}GG`37NvP?}fwXjT0PPVWxHa0Ucu(X^!(NZkbGcTmTHNQME z-^|xCBW!z4K@L*FCH!_Xz%GQTpT(jv6L+0etp&A+^?GCME1#LpnbH?hpWIMq8m vxG2CeOFKQlr7E=Cz|-5YtlY)Z#6LN}wY|%q5r~<9m>Gy!ws-ln?nndx+?7ED delta 186 zcmX@~NbJxfv4$;-J$_6^O4H}2G1*W5;Kax~{gxl2gtn1hNqUvCS(-_rk$GZLlCimk zVWOqEiJ^(PajL0lQd*jMVw#z$K}vF};q-+WOcJ3<6`sy6Nk%E@9uWm*F8;0+7HNi_ zX`$u;#p!N_j-{n86^Rz+zDZ>fg=wzF&S}2xPDUZFEV7E`jwHv iE=B&HfkwfF<>`*@?OpziK+FWh%s|Ytz003