Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Added test for courses page and lesson content #175

Merged
merged 6 commits into from
Apr 12, 2022
Merged

Added test for courses page and lesson content #175

merged 6 commits into from
Apr 12, 2022

Conversation

rodrigoaguilera
Copy link
Contributor

No description provided.

@rodrigoaguilera rodrigoaguilera force-pushed the js-tests branch 3 times, most recently from 8e5d630 to a71f43b Compare April 8, 2022 12:44
@rodrigoaguilera rodrigoaguilera force-pushed the js-tests branch 3 times, most recently from 345f781 to b127e5f Compare April 8, 2022 15:27
@kalabro kalabro linked an issue Apr 11, 2022 that may be closed by this pull request
@@ -33,7 +33,7 @@ jobs:
composer config repositories.systemseed/anu_lms path ../anu_lms && \
composer config minimum-stability dev && \
composer require "systemseed/anu_lms:*@dev" && \
composer require --dev drupal/core-dev:^9 && \
composer require --dev drupal/core-dev:^9 drupal/pathauto && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How should we install on local for running tests? I tried composer -- require systemseed/anu_lms:dev-js-tests --prefer-source and it did NOT download pathauto. I had to manually install it.

Copy link
Contributor Author

@rodrigoaguilera rodrigoaguilera Apr 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a simple issue. Drupalci somehow downloads the dev-dependencies of a module for testing. We are trying to emulate what drupalci does which I believe is not open source.

I think this situation will be different with the change from drupalci to gitlabci. It will draw inspiration and code from drupalspoons.
https://gitlab.com/drupalspoons/webmasters/-/tree/master/#local-development

So the main idea is that we shouldn't be installing anu_lms as part of another project (such as basilio) to develop it but anu_lms should spawn its own drupal site, therefore the dev-dependencies will be downloaded since it will be a composer install in the root of the anu_lms project.
This means that composer -- require systemseed/anu_lms:dev-js-tests --prefer-source can't be used for the development of anu_lms as it will NEVER pull the dev dependencies. Only when anu_lms is the root project.

This line in the circleci is just a patch before deciding to move to drupal.org. Added a comment to clarify

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting info, thanks for sharing the details @rodrigoaguilera !

@@ -102,25 +102,38 @@ const ContentNavigation = ({
<Button
{...buttonProps}
onClick={() => history.push({ pathname: `/section-${currentIndex + 2}` })}
aria-label={Drupal.t('Next', {}, { context: 'ANU LMS' })}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's the right way to use aria-label. It doesn't make sense from a11y point of view if the button already contains the same text.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the aria-labels in favor of data-test attributes

@@ -78,7 +78,7 @@ const ListElement = ({ items, type }) => (
<StyledIcon fontSize="small">brightness_1</StyledIcon>
</ListItemIcon>

<ListItemText>
<ListItemText data-anu-lms-list-item-text>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use data-test="anu-lms-list-item-text" instead? See https://docs.cypress.io/guides/references/best-practices#Real-World-Example for example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted to data-test attributes

// Check for itself. This gives the opportunity for configuration
// to be installed such as pathauto patterns.
if (!in_array('anu_lms_demo_content', $modules)) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥


$assert->waitForElementVisible('css', '[aria-label=Next]')->click();
// Dividers.
$assert->waitForElementVisible('css', '[aria-label=Next]')->click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we will add more checks inside those lessons later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are good for the scope of this testing.

@kalabro
Copy link
Contributor

kalabro commented Apr 11, 2022

@rodrigoaguilera I managed to run the tests on M1+DDEV using ddev/ddev#3578 (comment) + ddev/ddev#3578 (comment)

All of them passed 🔥🔥🔥

I will document it in #177

@rodrigoaguilera rodrigoaguilera requested a review from kalabro April 12, 2022 08:09
@kalabro kalabro merged commit 8803534 into 2.x Apr 12, 2022
@kalabro kalabro deleted the js-tests branch April 12, 2022 08:22
@smustgrave
Copy link

smustgrave commented Jun 29, 2022

@kalabro could you post a full recipe of how you got it working with m1? Trying to follow the comment but no luck.

Scratch that got it working!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add basic test coverage
3 participants