Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(playwright): Convert Cypress tests to Playwright - 2 #1246

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ runs:
node_modules
*/*/node_modules
~/.cache/Cypress
~/.cache/ms-playwright
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-dependencies
- name: Cache artifacts
id: cache-artifacts
Expand All @@ -21,3 +20,10 @@ runs:
packages/*/dist
packages/core/build
key: ${{ runner.os }}-${{ github.run_id }}-artifacts
- name: Cache playwright binaries
id: cache-playwright-binaries
uses: actions/cache@v3
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-${{ hashFiles('playwright/package.json') }}-playwright-binaries
54 changes: 46 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ jobs:
e2e:
needs: prepare
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
shard: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -165,20 +169,54 @@ jobs:
- name: Set up Playwright browsers
run: yarn test:e2e:install

- name: Set up Slice Machine project
run: |
yarn workspaces foreach --include '{@slicemachine/adapter-next,@slicemachine/manager,@slicemachine/plugin-kit,start-slicemachine}' --parallel --topological-dev run build
yarn workspace slice-machine-ui pack --out ../../e2e-projects/next/sm.tgz
yarn workspace cimsirp add -D ./sm.tgz

- name: Running E2E tests
run: yarn test:e2e
run: yarn test:e2e --shard ${{ matrix.shard }}
env:
PRISMIC_URL: https://wroom.io
WROOM_EMAIL: ${{ secrets.EMAIL }}
WROOM_PASSWORD: ${{ secrets.PASSWORD }}
DEBUG: pw:test

- name: Upload blob report to GitHub Actions Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e-all-blob-reports
path: playwright/blob-report
retention-days: 1

e2e-merge-reports:
needs: e2e
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Restore cache
uses: ./.github/actions/restore-cache

- name: Set up Node
uses: ./.github/actions/setup-node

- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: e2e-all-blob-reports
path: playwright/e2e-all-blob-reports

- name: Merge into HTML Report
run: yarn test:e2e:merge-reports --reporter html ./e2e-all-blob-reports

- name: Upload HTML report
uses: actions/upload-artifact@v3
if: failure()
with:
name: Playwright HTML report
path: playwright/playwright-report/
retention-days: 30
name: html-report--attempt-${{ github.run_attempt }}
path: playwright/playwright-report
retention-days: 14

e2e-cypress:
needs: prepare
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/slices/00-create.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const editedSliceName = "EditedSliceName";
const sliceId = "test_slice"; // generated automatically from the slice name
const lib = ".--slices";

describe("Create Slices", () => {
describe.skip("Create Slices", () => {
beforeEach(() => {
cy.setSliceMachineUserContext({});
cy.clearProject();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/slices/01-duplicates.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const sliceName = "DuplicateSlices";
const sliceId = "duplicate_slices";
const lib = ".--slices";

describe("Duplicate Slices", () => {
describe.skip("Duplicate Slices", () => {
beforeEach(() => {
cy.setSliceMachineUserContext({});
cy.clearProject();
Expand Down
72 changes: 0 additions & 72 deletions cypress/e2e/updates/sidebar.cy.js

This file was deleted.

2 changes: 1 addition & 1 deletion cypress/e2e/updates/simulator-tooltip.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("simulator tooltip", () => {

cy.contains("Simulate your slices").should("exist");

cy.contains("Got It").click();
cy.contains("Got it").click();

cy.contains("Simulate your slices").should("not.exist");

Expand Down
75 changes: 0 additions & 75 deletions cypress/e2e/updates/video-tooltip.cy.js

This file was deleted.

2 changes: 1 addition & 1 deletion cypress/e2e/user-flows/scenario_custom_screenshots.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { menu } from "../../pages/menu";
import { sliceBuilder } from "../../pages/slices/sliceBuilder";
import { changesPage } from "../../pages/changes/changesPage";

describe("I am an existing SM user and I want to upload screenshots on variations of an existing Slice", () => {
describe.skip("I am an existing SM user and I want to upload screenshots on variations of an existing Slice", () => {
let slice;
const initSliceData = (random = Date.now()) => ({
id: `test_custom_screenshots${random}`,
Expand Down
46 changes: 0 additions & 46 deletions cypress/e2e/user-flows/scenario_slice_association.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,50 +78,4 @@ describe.skip("I am an existing SM user (Next) and I want to associate a Slice t
cy.contains("Repeatable Rich Text Field");
cy.contains("Repeatable Key Text Field");
});

it("Push the newly created custom type and slice", () => {
changesPage.goTo().pushChanges().isUpToDate();
});

it.skip("Add the Slice to the Custom Type", () => {
cy.visit(`/custom-types/${customTypeId}`);

cy.get("[data-cy=update-slices]").click();
cy.get(`[data-cy=shared-slice-card-${sliceId}]`).click();
cy.get("[data-cy=update-slices-modal]").submit();

customTypeBuilder.save();

cy.reload();
cy.contains(sliceName);
});

it.skip("Push the custom type with the Slice associated", () => {
changesPage.goTo().pushChanges().isUpToDate();
});

it.skip("Displays and fill the satisfaction survey and the survey never reappears after", () => {
const lastSyncChange = Date.now() - 1000 * 60 * 60 * 2;

// Setting the context to display the survey
cy.setSliceMachineUserContext({
hasSendAReview: false,
lastSyncChange,
});

// Visit a page
cy.visit("/");

cy.get("#review-form");
cy.get("[data-cy=review-form-score-3]").click();
cy.get("[data-cy=review-form-comment]").type(
"Cypress test - testing the comment of the survey",
);
cy.get("#review-form").submit();

cy.reload();
cy.waitUntil(() => cy.get("[data-cy=create-ct]"));

cy.get("#review-form").should("not.exist");
});
});
Loading
Loading