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

Set up cypress tests #2477

Merged
merged 9 commits into from
Aug 20, 2024
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
18 changes: 9 additions & 9 deletions client/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { defineConfig } from "cypress";

export default defineConfig({
numTestsKeptInMemory: 20,
defaultCommandTimeout: 30000,
defaultCommandTimeout: 10000,
e2e: {
setupNodeEvents(on, config) {
on("before:browser:launch", (browser = {}, launchOptions) => {
Expand All @@ -41,12 +41,12 @@ export default defineConfig({

baseUrl: "http://localhost:8000",
},
env: {
db: {
host: "localhost",
user: "root",
password: "helloworld",
database: "doenet_local",
},
},
// env: {
// db: {
// host: "localhost",
// user: "root",
// password: "helloworld",
// database: "doenet_local",
// },
// },
});
81 changes: 81 additions & 0 deletions client/cypress/e2e/Folders/createFolders.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
describe("Create Folders Tests", function () {
before(() => {});

beforeEach(() => {});

// TODO: this test is unfinished, but waiting until
// the folder UI redesign
it("create and share folder", () => {
let code = Date.now().toString();
const scrappyEmail = `scrappy${code}@doo`;
const scoobyEmail = `scooby${code}@doo`;

// create scrappy account so can share content with it
cy.loginAsTestUser({
email: scrappyEmail,
firstNames: "Scrappy",
lastNames: "Doo",
});

cy.loginAsTestUser({
email: scoobyEmail,
firstNames: "Scooby",
lastNames: "Doo",
});

cy.visit("/");

cy.get('[data-test="Activities"]').click();
cy.get('[data-test="New Button"]').click();
cy.get('[data-test="Add Folder Button"]').click();

cy.get('[data-test="Editable Title"]').type("My new folder{enter}");
cy.get('[data-test="Activity Link"]').click();

cy.get('[data-test="Folder Heading"]').should(
"contain.text",
"My new folder",
);

cy.get('[data-test="New Button"]').click();
cy.get('[data-test="Add Folder Button"]').click();
cy.get('[data-test="Editable Title"]').type(`Private folder${code}{enter}`);

cy.get('[data-test="New Button"]').click();
cy.get('[data-test="Add Folder Button"]').click();
cy.get('[data-test="Editable Title"]')
.eq(1)
.type(`Shared folder${code}{enter}`);

cy.get('[data-test="Card Menu Button"]').eq(1).click();
cy.get('[data-test="Share Menu Item"]').eq(1).click({ force: true });
cy.get('[data-test="Email address"]').type(`${scrappyEmail}{enter}`);
cy.get('[data-test="Status message"]').should("contain.text", scrappyEmail);
cy.get('[data-test="Close Share Drawer Button"]').click();

cy.get('[data-test="Activity Link"]').eq(1).click();
cy.get('[data-test="Folder Heading"]').should(
"contain.text",
`Shared folder${code}`,
);

cy.get('[data-test="New Button"]').click();
cy.get('[data-test="Add Activity Button"]').click();

cy.get('[data-test="Activity Name Editable"]').type(
"Shared activity{enter}",
);

cy.iframe().find(".cm-editor").type(`Hello${code}!{enter}`);
cy.iframe().find('[data-test="Viewer Update Button"]').click();
cy.iframe().find(".doenet-viewer").should("contain.text", `Hello${code}!`);

cy.loginAsTestUser({
email: scrappyEmail,
});
cy.visit("/");

cy.get('[data-test="Community"]').click();
cy.get('[data-test="Search"]').type(`folder${code}{enter}`);
});
});
Loading