Skip to content

Commit

Permalink
added datatestids and renders plugin in CODAP
Browse files Browse the repository at this point in the history
  • Loading branch information
nstclair-cc committed Sep 20, 2024
1 parent b0ac425 commit c30c0fe
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
57 changes: 38 additions & 19 deletions cypress/e2e/workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,47 @@ context("Test the overall app in CODAP v3", () => {
it("renders Get Data button", () => {
ae.getApp().find("button").should("have.text", "Get Data");
});
it.skip("renders Get Data button in CODAP", () => {
cy.visit('https://codap3.concord.org');
it.skip("renders in CODAP", () => {
cy.visit("https://codap3.concord.org");

// Use cy.origin to target a different origin
cy.origin('https://codap3.concord.org', () => {
cy.origin("https://codap3.concord.org", () => {
// All commands targeting codap3.concord.org should be wrapped inside this block
cy.get('#codap-menu-bar-id .cfm-menu.menu-anchor').click();
// Assuming the menu is already visible or triggered open
cy.get('.cfm-menu .menuItem').contains('Import...').click();
// Ensure the modal dialog is visible
cy.get('.modal-dialog[data-testid="modal-dialog"]').should('be.visible');
// Click the "URL" tab to switch to the URL import option
cy.get('.workspace-tabs ul li').contains('URL').click();
// Ensure the URL import tab is visible
cy.get('.dialogTab.urlImport').should('be.visible');

// Find the URL input field and type the Cypress base URL
cy.get('.dialogTab.urlImport input[placeholder="URL"]').type(Cypress.config('baseUrl'));
// Click on the "Import" button
// this would have been a beautiful thing to have if the Import button was functional :-/
cy.get('.dialogTab.urlImport .buttons button').contains('Import').click();
//ae.getApp().find("button").should("have.text", "Get Data");
cy.get("[data-testid=tool-shelf-button-options]").click();
cy.get("[data-testid=tool-shelf-button-web-view]").click();
cy.get("[data-testid=web-view-url-input]").clear();
cy.get("[data-testid=web-view-url-input]").type(Cypress.config('baseUrl'));

Check failure on line 21 in cypress/e2e/workspace.test.ts

View workflow job for this annotation

GitHub Actions / Build and Run Jest Tests

Strings must use doublequote
cy.get("[data-testid=OK-button]").click();
cy.wait(1500);
// // Check that the "Attributes" dropdown is visible
// cy.get('[data-testid="dropdown-attributes"]').should('be.visible');

// // Check that the "Countries" dropdown is visible
// cy.get('[data-testid="dropdown-countries"]').should('be.visible');

// // Check that the header is visible
// cy.get('[data-testid="attributes-header"]').should('be.visible');


// // click the "Get Data button"
// cy.get('[data-testid="who-get-data-button"]').scrollIntoView().should('be.visible');
// cy.get('[data-testid="who-get-data-button"]').click();
// cy.get('#codap-menu-bar-id .cfm-menu.menu-anchor').click();
// // Assuming the menu is already visible or triggered open
// cy.get('.cfm-menu .menuItem').contains('Import...').click();
// // Ensure the modal dialog is visible
// cy.get('.modal-dialog[data-testid="modal-dialog"]').should('be.visible');
// // Click the "URL" tab to switch to the URL import option
// cy.get('.workspace-tabs ul li').contains('URL').click();
// // Ensure the URL import tab is visible
// cy.get('.dialogTab.urlImport').should('be.visible');

// // Find the URL input field and type the Cypress base URL
// cy.get('.dialogTab.urlImport input[placeholder="URL"]').type(Cypress.config('baseUrl'));
// // Click on the "Import" button
// // this would have been a beautiful thing to have if the Import button was functional :-/
// cy.get('.dialogTab.urlImport .buttons button').contains('Import').click();
// //ae.getApp().find("button").should("have.text", "Get Data");

});

Expand Down
2 changes: 1 addition & 1 deletion src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const App = () => {
dataStatus === "incomplete" && <div className="incomplete"><WarningIcon /> Some data requested are not available</div>
}
</div>
<button onClick={handleCreateData} disabled={getDataDisabled}>Get Data</button>
<button onClick={handleCreateData} disabled={getDataDisabled} data-testid="who-get-data-button">Get Data</button>
</div>
{
infoVisible && <InfoModal onClose={handleInfoClick} />
Expand Down

0 comments on commit c30c0fe

Please sign in to comment.