From 4313bd22cd4602a1e89f132da256cfb60ff760d3 Mon Sep 17 00:00:00 2001 From: Sem Bauke Date: Tue, 21 May 2024 18:01:09 +0200 Subject: [PATCH] feat: convert "show certification" tests to Playwright (#54899) --- cypress/e2e/default/show-certification.ts | 31 ----------------------- e2e/show-certificate-else.spec.ts | 4 +++ 2 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 cypress/e2e/default/show-certification.ts diff --git a/cypress/e2e/default/show-certification.ts b/cypress/e2e/default/show-certification.ts deleted file mode 100644 index af56f6d5a5c..00000000000 --- a/cypress/e2e/default/show-certification.ts +++ /dev/null @@ -1,31 +0,0 @@ -const rwdCert = '/certification/certifieduser/responsive-web-design'; - -const elements = { - fccLogo: "[data-cy='freeCodeCamp-logo']", - msLogo: "[data-cy='microsoft-logo']", - issueDate: "[data-cy='issue-date']", - quincySignature: "[data-cy='quincy-signature']", - msSignature: "[data-cy='microsoft-signature']", - solutionWidget: "[data-cy='solution-widget']" -}; - -describe('A certification,', function () { - before(() => { - cy.task('seed', ['certified-user']); - }); - - describe("while viewing someone else's Responsive Web Design Certification,", function () { - it('should only render public components', () => { - cy.visit(rwdCert); - - cy.get('.donation-section').should('not.exist'); - cy.contains('successfully completed'); - cy.contains('Responsive Web Design'); - cy.contains('Add this certification to my LinkedIn profile').should( - 'not.exist' - ); - cy.contains('Share this certification on Twitter').should('not.exist'); - cy.get(elements.solutionWidget).should('be.visible'); - }); - }); -}); diff --git a/e2e/show-certificate-else.spec.ts b/e2e/show-certificate-else.spec.ts index e235e56f40c..42df08db40e 100644 --- a/e2e/show-certificate-else.spec.ts +++ b/e2e/show-certificate-else.spec.ts @@ -20,4 +20,8 @@ test.describe('Show certification else', () => { await expect(page.getByTestId('linkedin-share-btn')).toBeHidden(); await expect(page.getByTestId('twitter-share-btn')).toBeHidden(); }); + + test('while viewing someone else, it should not show the donation section', async () => { + await expect(page.getByRole('button', { name: 'Donate' })).toBeHidden(); + }); });